Jump to content

Keeping logged in with SESSIONS


Canman2005

Recommended Posts

Hi all

 

I have a members login page which is secured with SESSIONS, when you login a SESSION is created and that's what determins if you should see member content or not.

 

I want to try and keep the member logged in for the MAXIMUM time possible, so even when they close a browser a re-open, it would remember them and they should not have to log in again.

 

What do you feel is the best way to do this so that I can maximise the length of time they are logged in.

 

Any advice would be ace

 

Thanks

Link to comment
Share on other sites

Thanks, I have managed to get the following, but I get "Parse error: syntax error, unexpected T_STRING in C:\web\test.php on line 5" when its run, any ideas?

 

$_POST['username'] = 'xx';
$_POST['pass'] = 'yy';
$hour = time() + 60*60*24*1000
setcookie("ID_my_site", $_POST['username'], $hour); 
setcookie("Key_my_site", $_POST['pass'], $hour); 

print $_COOKIE['ID_my_site']; 
print $_COOKIE['Key_my_site'];

 

Thanks

Link to comment
Share on other sites

Yes, thanks, managed to see that in the end.

 

I am now using

 

$timeset = time() + 60*60*24*1000;
setcookie("cookie_ef_username", $_POST['email'], $hour);
setcookie("cookie_ef_password", $_POST['password'], $hour);

 

Which works fine until the browser is closed and then it seems to loose the cookie data, why could that be?

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.