note 69045 added to function.highlight-file

From: Date: Mon, 21 Aug 2006 11:53:24 +0000
Subject: note 69045 added to function.highlight-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-116121@lists.php.net to get a copy of this message
It's a basic idea but one maybe worth sharing. <?php switch($_GET['file']) { case 1: highlight_file("file1.php"); break; case 2: highlight_file("file2.php"); break; case 3: highlight_file("file3.php"); break; default: header("Location: ".$_SERVER["PHP_SELF"]); } ?> Save the script as showfile.php and access it like this: <a href="showfile.php?file=1">Click here to see file 1 source code</a> The default case is for people editing the URL to try to access further files. Just don't add any files you don't want users to see, and maybe hard-code in large, random numbers or MD5 hashes. ---- Server IP: 85.116.0.130 Probable Submitter: 212.219.59.241 ---- X-Spam-Status: No, hits=3.5 required=5.0 tests=CLICK_BELOW,DATE_MISSING, FROM_NO_LOWER,HTML_LINK_CLICK_HERE,HTML_MESSAGE autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.highlight-file.php Edit -- https://master.php.net/note/edit/69045 Del: integrated -- https://master.php.net/note/delete/69045/integrated Del: useless -- https://master.php.net/note/delete/69045/useless Del: bad code -- https://master.php.net/note/delete/69045/bad+code Del: spam -- https://master.php.net/note/delete/69045/spam Del: non-english -- https://master.php.net/note/delete/69045/non-english Del: in docs -- https://master.php.net/note/delete/69045/in+docs Del: other reasons-- https://master.php.net/note/delete/69045 Reject -- https://master.php.net/note/reject/69045 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#116121) next »