普通用户能登录,管理员就不行,也不报错,直接跳转的是空白页面,这段代码逻辑有错吗,求指教,实在找不到哪儿错了
<?php
session_start();
require("connection/conn.php");
$sql="select * from house_user where username='$username' and password='$password'";
$res=mysql_query($sql)or die(mysql_error());
$data=mysql_fetch_array($res)or die(mysql_error());
//获取用户类型
$currentUserType=mysql_result($res,0,'user_type') or die(mysql_error());
echo "<script>javascript:alert('账号记录数'+$currentUserType);</script>";
if(!empty($data))
{
//判断管理员
if($currentUserType==0){
$_SESSION["user_name"]=$username;
echo"<script>alert('登录成功');location.href='/admin/manage.php';</script>";
exit;
}
//判断普通用户
if($currentUserType==1){
$_SESSION["userlogin"]="ok";
$_SESSION["loginname"]=$username;
echo "<script>alert('登录成 功');location.href='login.php';</script>";
exit;
}
}
else
{
echo "<script>alert('用户名或密码错误');history.back();</script>";
exit;
}
?>