mdvignesh Posted August 30, 2011 Share Posted August 30, 2011 when user login to his account, I want to expire session after 5 minutes Quote Link to comment https://forums.phpfreaks.com/topic/246036-expire-session/ Share on other sites More sharing options...
voip03 Posted August 30, 2011 Share Posted August 30, 2011 have you written a code? Quote Link to comment https://forums.phpfreaks.com/topic/246036-expire-session/#findComment-1263562 Share on other sites More sharing options...
mdvignesh Posted August 30, 2011 Author Share Posted August 30, 2011 ya <?php session_start(); ob_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Signin</title> </head> <?php include("data.php"); $user_err=''; $pass_err=''; if(isset($_POST['submit'])) { $user=$_POST['user']; $passwd=$_POST['pass']; $err=0; if($user=="") { $user_err="enter username"; $err=1; } if($passwd=="") { $pass_err="enter password"; $err=1; } if($err==0) { $check=mysql_query("select username from register where username='$user'")or die(mysql_error()); $check2=mysql_num_rows($check); if($check2==0) { $uer="User does not exist,enter correct username"; } else { $check1=mysql_query("select password from register where username='$user' and password='$passwd'")or die(mysql_error()); $check2=mysql_num_rows($check1); if($check2==0) { $per="Password mismatch,enter correct password"; } else { $_SESSION['user']=$user; $_SESSION['password']=$passwd; header("location:msg.php"); } } } mysql_close($cn); } ?> <body> <br /><br /> <form method="post" action="loginpage.php"> <table bgcolor="#6699FF" width="500" height="300" align="center"> <tr><td align="center"> <strong>Sign in with your account</strong><br /><br /><br /> USERNAME:<input type="text" name="user" value="" /> <br /><br /> PASSWORD:<input type="password" name="pass" value=""/> <br/><br/> <input type="submit" value="login" name="submit" /> </td></tr> </table> </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/246036-expire-session/#findComment-1263565 Share on other sites More sharing options...
voip03 Posted August 30, 2011 Share Posted August 30, 2011 If you google it ; you will get a lot of answer. http://stackoverflow.com/questions/520237/how-do-i-expire-a-php-session-after-30-minutes Quote Link to comment https://forums.phpfreaks.com/topic/246036-expire-session/#findComment-1263568 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.