RE: [PHP] Something is wrong with my sessions..
| From: | Matt Schroebel | Date: | Fri, 19 Jul 2002 14:14:21 +0000 |
| Subject: | RE: [PHP] Something is wrong with my sessions.. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-108508@lists.php.net to get a copy of this message | ||
> From: Chad Day [mailto:cday@atpco.com]
> Sent: Friday, July 19, 2002 10:08 AM
> Subject: [PHP] Something is wrong with my sessions..
> I must be missing something very basic here..
>
> I login to my site successfully.. session values are created so I can
> track/authenticate the user throughout the site:
>
> login.php:
>
> session_start();
>
> (logic)
>
> $VALID_USER = '1';
> session_register("OL_VALID_USER");
>
> (redirect to other page)
>
>
> Then on the other page, the access is checked:
>
> otherpage.php:
>
> session_start();
>
> require("functions.php");
>
> check_access();
>
> functions.php:
>
> function check_access() {
> global $VALID_USER;
> if (session_is_registered("VALID_USER")) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Don't you mean:
session_is_registered("OL_VALID_USER");
> return true;
> } else {
> Header("Location: login.php");
> exit();
> }
> }