Jump to content


Photo

Quick Question


  • Please log in to reply
1 reply to this topic

#1 Lister777

Lister777
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 07 March 2006 - 04:48 PM

Hi all
Was wondering if somone could point me in the correct direction for learning about adding a remember me check box to my login script.

I have had a look though some of the other tutorials and the php manual but to be honest not 100% sure on what i am looking for. Would guess that its done by storing a Cookie on the users system yes?

Any help would be great.

Many thanks
Lister777

#2 Steveo31

Steveo31
  • Members
  • PipPip
  • Member
  • 25 posts
  • LocationSan Jose, CA

Posted 07 March 2006 - 07:33 PM

Right. The gist of it would be to check to see if the cookie exists. If so, then the necessary info will be in there, like usernames or whatnot. If not, then set it:

<?php

setcookie('login_info', 'username', time()+60*60*24*30);

?>

i.e.

<?php

if(isset($_COOKIE['login_info'])){
    $_SESSION['username'] = $_COOKIE['login_info'];
}else{
    //show login form or something
}

?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users