Created
January 25, 2016 08:17
-
-
Save mathieu-aubin/c6fab852556dddb49ff6 to your computer and use it in GitHub Desktop.
PHP - Show file source from url query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Including this conditional code to the top of a script allows to display it's content | |
# (sourcecode), highlighted, adding query string "?showSource" to the file request. | |
# ex: http://example.com/scriptname.php?showSource | |
# fully modifiable, __FILE__ can be another local file, query can be changed.... | |
if ($_SERVER['REQUEST_METHOD'] != 'POST' && isset($_GET['showSource'])) { | |
highlight_file(__FILE__); | |
die(); | |
} | |
// start of script code | |
$normal = phpCode['here']; | |
// source: http://phpxmlrpc.sourceforge.net/server.php?showSource=TRUE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I did not know about
highlight_file
, less stupid day after day...