Remember Me! In Login Form!
Posted: Sat Jan 21, 2012 5:56 pm
I Want A Remember Me Feature In My Login Form.
Can You Tell Me The Script (for remember me feature) And Where To Place It In My Login Form Script?
This is my loginform.php
Can You Tell Me The Script (for remember me feature) And Where To Place It In My Login Form Script?
This is my loginform.php
<?php include_once 'config.php' ; require_once 'core.php' ; if (loggedin()) { header ('Location: access_denied.php') ; } else { if (isset($_POST['username'])&& isset($_POST['password'])) { $username = $_POST ['username'] ; $password = $_POST ['password'] ; $password_hash = md5($password) ; $rememberme = $_POST ['rememberme'] ; if (!empty($username)&& !empty($password)) { $query = "SELECT `id` FROM `users` WHERE `username`='$username' AND `password`='$password_hash'" ; if ($query_run = mysql_query ($query) ) { $query_num_rows = mysql_num_rows ($query_run) ; if ($query_num_rows==0) { echo '<head><link rel="stylesheet" type="text/css" href="css/php.css"></head><p class="align">Invalid username/password combination.</p>' ; } else if ($query_num_rows==1) { $user_id = mysql_result ($query_run, 0, 'id') ; $_SESSION ['user_id']=$user_id ; header ('Location: profile.php') ; } } } else { echo '<head><link rel="stylesheet" type="text/css" href="css/php.css"></head><p class="align">Please type in your username and password .</p>' ; } } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link rel="stylesheet" type="text/stylesheet" href="css/main.css"> <link rel="stylesheet" type="text/stylesheet" href="css/php.css"> </head> <body> <div id="whole_body"> <header id="main_header"> <div id="form_php"><form action="<?php echo $current_file ?>" method="POST"> <input type="text" placeholder="Username" name="username"><input type="password" placeholder="Password" name="password"> <input type="submit" name="login" value="Log in"><input type="checkbox" name="rememberme"> Remember Me<br><br> </form><a href="register.php">Not yet registered?</a></div> <p id="title">Budzzem</p> <header> <div id="space" > <div id="features"> <p id="title_ft">Features<span id="hoverme"> Hover Me !</span><br /><br /> <span id="numbers"> <span id="ft_one">1</span><span id="ft_two">2</span><span id="ft_three">3 </span></span> </p> </div> </div> <footer id="main_footer"> <p id="footer">©Buddzem' 2011</p> </footer> </div> </body> </html>