Jump to content

Help With Sessions


steviez

Recommended Posts

Hi,

 

I am having some strange problems with sessions in my script.

 

When a user logs in my script sets the sessions as follows:

 

session_start();
$_SESSION['loggedin'] = 1;

 

And then on member only pages i use this code to check if they are logged in:

 

session_start();
if(!isset($_COOKIE['loggedin']) && $_COOKIE['loggedin'] == md5("TRUE"))
    {
    header("location: $secure_url/login.php");
    exit();
    }

 

But it always redirects the users to the login page, but if i echo the session i get the value.

 

Any ideas?

 

Thanks

But

Link to comment
https://forums.phpfreaks.com/topic/100851-help-with-sessions/
Share on other sites

link=topic=192273.msg863757#msg863757 date=1208036971]

have you also troubleshooted the $_SESSIONs? just trying to echoing out the value of them and see if it's printing out the expected result?

 

I have done that and i am getting the exact result that i want. Its only when i try to check if its set.

Link to comment
https://forums.phpfreaks.com/topic/100851-help-with-sessions/#findComment-515734
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.