Adding session time out

<form name="form2" method="post" action="adminloginphp.php">

  <tr align="center">
    <td height="26" colspan="2">Login Page<br />
<b><font color="#FF0000"> <?php //echo $log; ?></font></b>
    </td>
  </tr>
  <tr>
    <td>Staff ID</td>
    <td><input name="staff_id" type="text" /></td>
  </tr>
  <tr>
    <td><label for="textfield">Password</label></td>
    <td><input type="password" name="staff_password" id="textfield" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="button" id="button" value="Login" /></td>
  </tr>
</form>
    >Above is my html and below is my php.

<?php
$con = mysql_connect("localhost","root");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("medical", $con);
if(isset($_POST["button"]))
{
$result = mysql_query("SELECT * FROM staff
WHERE staff_id='$_POST[staff_id]' and staff_password='$_POST[staff_password]'");
if(mysql_num_rows($result)==1)
{
$log =  "Login failed";
}
else
{
            header("Location: http://localhost/AB%20Medical%202/adminhome.php");       //redirect them to the main page whatever your login in page is if they enter wrong   username and password
}
}
mysql_close($con);
?>

Im trying to add a session time out to my login page .But im unsure on how to do it.Here is my php login and my html.Does anyone have a simple solution to my problem.I have researched the web but all seem very complex.Plus do i need to add the session timeout in every page the admin uses or can i just have in this login page.

Answers


You can configure it on you php.ini file configuration with:

session.cookie_lifetime = X;

http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime


Need Your Help

change image size through URL

php html image

Once again, here I am with a simple issue that I cannot solve because the search terms I use apparently don't match the ones that have been used before. What I want to create is just a tiny piece of

Problem with fullscreen OpenGL on the Mac

cocoa osx opengl fullscreen

Now I am porting some OpenGL tutorials from win/glut to cocoa/mac os x. In the windowed mode everything works, but when context switches to fullscreen, screen may be empty (only clear colour)! For

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.