<?php
session_start();
error_reporting(E_ERROR);
$zh=$_POST['zh'];
$password=$_POST['password'];
$user=$_POST['user'];
if(!isset($user)) {
echo "<script> Alert('请选择用户类型');</script>";
echo "<script>history.go(-1);</script>";
}
$conn=mysqli_connect("localhost","8admin","8admin")또는 die('连接数据库失败');
$db=mysqli_select_db($conn,"8_com");
$sql1 ="SELECT*FROM 관리자 WHERE admin_id ='$zh' AND 비밀번호='$password' ";
$sql2="teach_id ='$zh' 및 비밀번호='$password' ";
교사로부터 * 선택 $sql3="select * stuno ='$zh' 및 비밀번호='$password'인 학생에서 ";
mysqli_query($conn,"set names utf8");
switch($user){
사례 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>户或密码错误'); </script>";
echo "<script>history.go(-1);</script>";
}
break;
사례 2:$result=mysqli_query($sql2, $콘);
$result=mysqli_query($sql2,$conn)또는 die('查询不到');
$row = mysqli_fetch_array($result);
$count=$row[0];
ㅋㅋㅋ$_SESSION['teacher_id']= $row['teach_id'];
echo "<script type='text/javascript'>"."location.href='".$url."'"."</script>";
ㅋㅋㅋ echo "<script>history.go(-1);</ script>"; } break; 사례 3:$result=mysqli_query($sql3,$conn); $result=mysqli_query($sql3,$conn)또는 die('查询不到'); $row = mysqli_fetch_array($result); $count=$row[0]; if($count!=""){ $url="index_stu.php"; $_SESSION[ 'stu_name']=$row['name']; $_SESSION['stu_id']=$row['stuno']; echo "<script type='text/javascript'>"." location.href='".$url."'"."</script>"; } else { echo "<script>或密码错误');</ script>"; echo "<script>history.go(-1);</script>"; } break; 기본값: 휴식;}mysqli_close($conn);
?>
백엔드 중단점 인쇄로 데이터를 얻을 수 있는지 여부