<?php
session_start();
error_reporting(E_ERROR);
$zh=$_POST['zh'];
$password=$_POST['パスワード'];
$user=$_POST['ユーザー'] ;
if(!isset($user)){
echo "<script>alert('请选择用户类型');</script>";
echo "<script>history.go(-1);</script>";
}
$conn=mysqli_connect("localhost","8admin"," 8admin")or die('连接データベース库失败');
$db=mysqli_select_db($conn,"8_com");
$sql1="SELECT*FROM admin WHERE admin_id =' $zh' AND パスワード='$password' ";
$sql2="* 教師から選択 ここで、teach_id ='$zh' およびパスワード='$password' ";
$sql3 ="select * from students where stuno ='$zh' およびpassword='$password' ";
mysqli_query($conn,"set names utf8");
switch($user ){
case 1:$result=mysqli_query($conn,$sql)or die('查询不到');
$row = mysqli_fetch_array($conn,$result);
$count=$row[0];
if($count!=""){
$url="index_admin.php";
$_SESSION['admin_name']=$row['name'];
$_SESSION['admin_id']= $row['admin_id'];
echo "<script type='text/javascript'>"."location.href='".$url."'"."</script> ;";
}
else {
echo "<script>alert('账户または密码错误');</script>";
echo "<script>history.go(-1);</script>";
}
Break;
case 2:$result =mysqli_query($sql2,$conn);
$result=mysqli_query($sql2,$conn)or die('查询不到');
$row = mysqli_fetch_array($result);
$count=$row[0];
if($count!=""){
$url="index_Teacher.php";
$_SESSION['Teacher_name']=$row['name'];
$_SESSION['Teacher_id']=$row['teach_id'];
echo "<script type='text/javascript'>"."location.href=' ".$url."'"."</script>";
}
else {
echo "