我设法反映了登录表单的用户。然而,现在当新用户登录时,先前的用户个人资料(例如姓名)仍然反映在表格上。这就是我到目前为止所拥有的。我错过了什么?
$result2 = mysqli_query($con, "SELECT admin_no FROM student_details;");
$row2 = mysqli_fetch_assoc($result2);
?>
<p>
<table border="1">
<tr>
<td width="410" align="center">Student Personal Data</td>
</tr>
<tr>
</td>
</tr>
<tr>
<td>Admission Number</td>
<td><input name= "name" type="text" disabled="disabled" value="<?php echo $row2['admin_no'] ?>"
size="40" readonly>
</td>
</tr>
这是我的退出页面的样子:
<?php
session_start();
session_unset();
session_destroy();
header('Location:login.php');
?>
我的登录页面:
<?
$adminName = $_POST['txtName'];
$adminPassword = $_POST['txtPassword'];
$conn = dbConnect();
if (!$conn)
die("Couldn't connect to MySQL");
$query = "select * from ohrm_user where user_name='$adminName' and user_password= '$adminPassword'";
$result = mysql_query($query, $conn);
$row = mysql_fetch_array($result);
if(mysql_num_rows($result) > 0 && $row['user_role_id'] == 1)
{
echo $_SESSION['user_name'] = $adminName;
echo $_SESSION['user_password'] = $adminPassword;
}
dbDisconnect($conn);
答案 0 :(得分:0)