Skip to content

Instantly share code, notes, and snippets.

@Flygenring
Last active December 24, 2015 01:59
Show Gist options
  • Save Flygenring/6728000 to your computer and use it in GitHub Desktop.
Save Flygenring/6728000 to your computer and use it in GitHub Desktop.
Allowing view-source for a file on GET requests using a view-source parameter in the query string
<?php
// Allowing view-source on GET requests using a view-source parameter in the query string
if('GET' == $_SERVER['REQUEST_METHOD'] && array_key_exists('view-source', $_GET)) {
highlight_file(__FILE__);
die();
}
// Rest of the code...
@Flygenring
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment