Re: Session Not Saving?
| From: | debbie_dyer | Date: | Sun, 29 Sep 2002 16:59:22 +0000 |
| Subject: | Re: Session Not Saving? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-118083@lists.php.net to get a copy of this message | ||
Are you calling session_start() on the other pages inside the secure area?
----- Original Message -----
From: "Stephen Craton" <webmaster@melchior.us>
To: <php-general@lists.php.net>
Sent: Sunday, September 29, 2002 5:23 PM
Subject: [PHP] Session Not Saving?
> I'm having another problem with my member's area script. When someone
> logs in, it's supposed to register their username into a session and it
> displays fine on the first page. But once you navigate to another part
> of the area, it does not tell you you are logged in, instead it gives me
> the error I set it to give "You are not logged in." Here's the code
> that checks to see if the user is valid:
>
> function check_valid()
> {
> global $valid_user;
> if (session_is_registered("valid_user"))
> {
> echo "<font size='2'>Welcome $valid_user!</font>";
> }
> else
> {
> echo "You are not logged in.";
> exit;
> }
> }
>
> Here's the code that's supposed to save the session:
>
> include_once("funcs.php");
> session_start();
> if($user && $pass)
> {
> if(login($user, $pass))
> {
> $valid_user = $user;
> session_register("valid_user");
> }
> else
> {
> echo "<font face='Arial, Helvetica, sans-serif'
> size='3'><center><b>You supplied an invalid username and password
> combo.
> Try again please.</b></center>";
> exit;
> }
> }
>
> Please help again!!!
>
> Thanks,
> Stephen
> http://www.melchior.us
> http://php.melchior.us
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>