note 76445 added to function.show-source
| From: | lkj dot korn at gmail dot com | Date: | Mon, 16 Jul 2007 13:37:01 +0000 |
| Subject: | note 76445 added to function.show-source | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128612@lists.php.net to get a copy of this message | ||
I have done a file that highlights a file's source using this script (quite basic actually):
<?php
$file = $_GET['file'];
if(file_exists($file)){
$string = show_source("$file", TRUE);
}
else{
$string = '<b>Sorry, but the file could not be found! Please check your
spelling.</b>';
}
$string = preg_replace("/<*.?code>/", "", $string);
$string = explode('<br />', $string); // using PHP 5.. so it works.. otherwise it
should be <br> I think
$i = 1;
foreach($string as $lines => $line){
echo '<br /><span style="color:
#000">'.$i.'</span> '.$line;
}
?>
Of course this represents a security risk, as content of files can be viewed which shouldn't be
viewed. As I've said this is very basic.
----
Server IP: 194.153.94.10
Probable Submitter: 84.73.71.231
----
Manual Page -- http://www.php.net/manual/en/function.show-source.php
Edit -- https://master.php.net/note/edit/76445
Del: integrated -- https://master.php.net/note/delete/76445/integrated
Del: useless -- https://master.php.net/note/delete/76445/useless
Del: bad code -- https://master.php.net/note/delete/76445/bad+code
Del: spam -- https://master.php.net/note/delete/76445/spam
Del: non-english -- https://master.php.net/note/delete/76445/non-english
Del: in docs -- https://master.php.net/note/delete/76445/in+docs
Del: other reasons-- https://master.php.net/note/delete/76445
Reject -- https://master.php.net/note/reject/76445
Search -- https://master.php.net/manage/user-notes.php