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 [EMAIL PROTECTED]  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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to