Re: session header issue
| From: | Curt Zirzow | Date: | Wed, 30 Jul 2003 23:04:54 +0000 |
| Subject: | Re: session header issue | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157617@lists.php.net to get a copy of this message | ||
* Thus wrote Sam Folk-Williams (sfolkwilliams@mn.rr.com):
> Problem: instead of sending them to the page they wanted to view, they
> get sent to this URL: login.php?file=/dir/file_name.php?v=123
>
> What's going on here? Why doesn't "Location: $file" return the contents
> of $file? The session check as well as login.php code are below. I'm
> stumped here -- thanks!
>
>
> ////----ON EVERY PAGE IN SITE----//////
>
> //get name of file user is trying to view
> $file=$PHP_SELF."?".$_SERVER['QUERY_STRING'];
> // session check
> session_start();
> if (!session_is_registered("SESSION"))
> {
> // if session check fails, invoke error handler
> header("Location: index.php?file=$file");
> exit();
> }
If this is on the login.php, $file has been set here. That will overwrite
your $file paramater (assuming your using register globals.) Thus
you get your behaviour of url:
login.php?file=/dir/file_name.php?v-123
HTH,
Curt
--
"I used to think I was indecisive, but now I'm not so sure."