Forum Moderators: coopster
I have a login script that I created for my family site. How do I make a 'keep me signed in' feature for my login script? I need something secure and I have available an mySQL database.
I seen it everywhere, forums, membership sites.
Im just not smart enough to figure it out though.
All I know is I can use a PHP session ID and MySQL database. Can you guys help please?
The cookie has a random number in it, which is entered into the db along with any other info they enter, like their name.
Every page checks for the cookie. If it's there it queries the db for their name etc and they get 'welcome barney!'
If it's not there you can invite them to register/log in.
basic run down:
to set a cookie:
setcookie("CookieName","CookieInformation");
to read a cookie
$_COOKIE['CookieName'];
to to write a cookie and then write it to a page...
setcookie("mine","this is a message");
echo $_COOKIE['mine'];
this will write
this is a message
HOPE THIS HELPS