Jump to content

how can i add the remember me feature to login form??


yami007

Recommended Posts

i simply can do it with cookies, but i dont how to link it with the remember me checkbox, :(

well, this is how i learnt to do it only with cookies

<?php
$found_one_user = mysql_fetch_array($user);
$_SESSION['user_id'] = $found_user['id'];
$_SESSION['username'] = $found_user['username'];
?>

 

That is not really with cookies.

 

You need to use the setcookie function if that checkbox is checked. Then you need to modify your authenticate function to validate cookies if they are set and sessions is not and then set them to the session so you just always access session.

 

Although session is stored in a cookie, it gets wiped on a browser close. Cookies stay alive until a user logs out and you destroy them or they clear their browser's cookies out manually.

 

Hope that helps.

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.