2013-12-08 49 views
0
<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); 
?> 

我試着添加一個會話超時我的登錄頁面。但即時通訊上怎麼辦it.Here不確定是我的PHP登錄和我html.Does人有一個簡單的解決方案我的問題。我研究過網頁,但看起來都很複雜。我是否需要在管理員使用的每個頁面中添加會話超時時間,或者我可以在此登錄頁面中添加會話超時時間。添加會話超時

回答