Jump to content

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


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.

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.