Re: comparing values
| From: | David Robley | Date: | Mon, 05 Mar 2001 23:40:06 +0000 |
| Subject: | Re: comparing values | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42687@lists.php.net to get a copy of this message | ||
On Mon, 5 Mar 2001 18:27, Paul wrote:
> 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
Um, you aren't assigning the result of the function to anything?
$what_you_want_to_see = check_hackers($sourcefile, $filelist);
echo $what_you_want_to_see;
Cheers
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA