It's definitely going through the if statement as it does "reload" the page - print($_SERVER['HTTP_REFERER']); shows http://www.myserver.com/oldpage.html - which is correct. print("{$userlevel} and {$neededlevel}"); also shows the correct info. $no_permission does have a string, but even if I hard code the message it still doesn't work.
Note though....if I take out include ($_SERVER['HTTP_REFERER']); from the if statement and put in print($_SERVER['HTTP_REFERER']); and print $message - they both display. So I am at a loss.... > No you shouldn't rely on it to do anything important but in your case > its just where the user will be redirected to. Even if someone fakes > the referrer to point to the restricted page it will just go into an > infinite loop. > > > if($userlevel != $neededlevel) { > > include ($_SERVER['HTTP_REFERER']); > > $message = $no_permission; > > $exit; > > } > > > > ...on referring page.... > > > > <? if ($message) { echo $message; } ?> > > Code seems fine. You probably are never entering into that if > statement or the referrer is outputting something unexpected. > Use some print statements to debug this.. > > print("{$userlevel} and {$neededlevel}"); > print($_SERVER['HTTP_REFERER']); > > Of course make sure $no_permission actually contains a string... > > Leo > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php