Cookies/Remember Me

I am brand new to SC, just purchased it today.

One of the first things I’m going to need to do is when a person logs in, I need the option to “remember me” so next time they come to the site, they will automatically be logged in. This is normally done with Cookies, but I don’t see any examples of how to do this in SC.

I also need a way to “forget me”, or logoff which should delete the Cookies.

Thanks,
Alan

Re: Cookies/Remember Me

No answers??

I have got to believe that someone is doing this somewhere. It’s pretty common…

Can anyone help?

Thanks in advance,
Alan

Re: Cookies/Remember Me

This is how I setup a cookie in my login screen:

OnInit:
// so user cannot hit BACK key and gain access from cache
header(“Expires: Mon, 26 Jul 1997 05:00:00 GMT”); // Date in the past
header(“Last-Modified: " . gmdate(“D, d M Y H:i:s”) . " GMT”); // Always modified
header(“Cache-Control: private, no-store, no-cache, must-revalidate”); // HTTP/1.1
header(“Cache-Control: post-check=0, pre-check=0”, false);
header(“Pragma: no-cache”); // HTTP/1.0

OnLoad:
// restore from cookie
if (!EMPTY($_COOKIE[“acweb_UserName”])) {
{input_username} = $_COOKIE[‘acweb_UserName’];
}

OnValidate:
// setup username cookie
$expirytime = time() + 3652460*60; // Change cookie expiry time here
ob_start();
setcookie(“acweb_UserName”,$_SESSION[‘g_username’], $expirytime); // Set up user name cookies
ob_end_flush();

Re: Cookies/Remember Me

Scott,
Thanks so much,
I will try to play with it this weekend.
Alan

Re: Cookies/Remember Me

Hi Scott,
Excellent post…! the cookies works fine…! But How long the cookie can store the value…! where is the exipry checking…!

I want a cookie to hold some value, on each form it has to check the cookie and have a idel time. If there is no action then it has to Logout

please advise

Thanks
Dhana

Re: Cookies/Remember Me

SetCookie will set the expiry time. For an inactivity monitor, there are many posts on the net about this:
http://www.daniweb.com/forums/thread185571.html

Regards,
Scott.