这是代码!当数据已经在数据库中时,PHP 没有从数据库中获取用户数据!帮帮我,我卡住了。当我在 login.php 中输入详细信息时,它会将我重定向到 login.php?invalid=1 并显示错误信息或会话已过期!尽管信息是一样的!
<?php
session_start();
include_once("include\config.php");
$login = $_POST["textfield1"];
$pwd = $_POST["textfield2"];
$recordset = mysql_query("select * from users");
while($record = mysql_fetch_array($recordset)){
if($login == $record["ulogin"] && $pwd == $record["upassword"]) {
$_SESSION["ulogin"] = $record["ulogin"];
$_SESSION["uid"] = $record["uid"];
if($record["utype"] == 1){
$_SESSION["utype"] = $record["utype"];
header("Location:admin.php?uid=".$record["uid"]);
exit;
}else{
header("Location:home.php");
exit;
}
}
}
header("Location:login.php?invalid=1");
?>