comparing values
| From: | Paul | Date: | Mon, 05 Mar 2001 07:57:02 +0000 |
| Subject: | comparing values | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-42587@lists.php.net to get a copy of this message | ||
below is the code I am using, $sourcefile is a url var
for example http://url/?sourcefile=/this/path/to/whatever.php
$filelist = array("",
"db_auth.conf",
"config.php",
"master.functions.inc"
); /* these are the files I want to protect from this
script */
function check_hackers($sourcefile, $filelist) {
$checkfile = explode("/", $sourcefile); /* seperate the
sourcefile var */
$disallowed = $checkfile[count($checkfile) -1]; /* use only
the last part (filename.ext) */
$filecount = count($filelist); /* count how many files in
array */
while ($tempcount < $filecount) {
$tempfile = $filelist[$tempcount];
if ($tempfile == $disallowed) {
$sourcefile = "source.inc"; /* this is not
returned to the global space .... why not ??? */
echo $disallowed; /* this will echo
the correct thing (config.php) */
echo $tempfile; /* this will echo
the correct thing (config.php) */
return $sourcefile; /* this doesn't work
either ???? what the ??? */
}
$tempcount++;
}
}
check_hackers($sourcefile, $filelist);
Can somebody tell me why this is not return $sourcefile = "source.inc"
.... what am I doing wrong.
Can you please reply to paul@wapdomainz.com PLEASE PLEASE PLEASE