"Remember Me" or "Keep Me login" like Facebook

You can make a Remember Me check box using simple cookie function.

Create a Cookie to store your Username and Password, this can be done as below :

Check the username & password and validate user if it is valid set a cookie for him and pass him inside site.

$check = $_POST[‘setcookie’]; // Checks if the remember me check box was ticked , if not checked variable is null. 

// Check to see if the ‘setcookie’ box was ticked to remember the user
setcookie(“cookemail”, $email, $time + 5000); // Sets the cookie username
setcookie(“cookpassword”, $password, $time + 5000); // Sets the cookie password

 Now let him go inside.

Use below code on your page where your log in panel exist.:

***New Code for cookie***

// If the cookie ‘cook’ is set, do the following;
$email = $_COOKIE[‘cookemail’];
//echo “Email :”.$email;
// Select the username from the cookie
$password = $_COOKIE[‘cookpassword’];
//echo “Password :”.$password;
// Select the password from the cookie
$query = “SELECT email,password FROM tnt_members WHERE email = ‘$username’ AND password = ‘$password'”;
$result = mysql_query($query);
// If the login information is correct do the following;
$_SESSION[‘loggedin’] = 1;
// Set the session ‘loggedin’ to 1 and forward the user to the admin page
***New Code for cookie***

Say something : I accept all the "Humer&Critic"

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s