PHP登录跳转
session_start();
include("config.php");//连接数据库
$username=$_POST['user'];
$word=$_POST['password'];
$userword=md5(trim($word));//MD5转换密码
$id=$_POST['user_id'];
if($id=="student")
{
$result_psword=mysql_query("select S_PS from STUDENT where S_ID='$username'");
/*while ($rows=mysql_fetch_array($result_psword)){}*/
if(!$result_psword)
{
echo "用户不存在,请先注册";
echo "<script>setTimeout(function(){window.location.href='../regist.php'}, 2000);</script>";
exit;
}
else if($result_psword==$userword)
{
$_SESSION['login']='学生';
echo "<script>window.location.href='../student/student.php';</script>";
}
}
登录后发现没有跳转,直接停在login.php页面里。
$username,$userword,$id都测试了有传进去值,我想就是
$result_psword=mysql_query("select S_PS from STUDENT where S_ID='$username'");
这句的问题了。
$reslt_psword我想测试里面的值都测试不出来,这个里面到底包含着什么东西?
($result_psword==$userword)这句话直接判断为什么会不行?
做毕设中,分不敢给多啊··留点以后用。
------解决方案--------------------
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|