<?phpsession_start();if($_SESSION['yzm']==$_POST['yzm']){$yzm="yes";}else{$yzm="no";}include('../install/conn.php');$mima=md5(md5($_POST['password']));$sql="select * from admins where wno='".$_POST['wno']."' and wps='".$mima."'";$conn=mysqli_connect($servername,$username,$password,$database);if(!$conn){die("连接失败:".mysqli_connect_error());exit();}$str=mysqli_query($conn,$sql);$num=mysqli_num_rows($str);$row=mysqli_fetch_object($str);if($num==0){$yh="no";}else{$yh='yes';$_SESSION['username']=$row->wname;$_SESSION['wno']=$row->wno;// $a=$row->usno;}$arr=array('yonghu'=>$yh,'yzm'=>$yzm,'sql'=>$_SESSION['wno']);echojson_encode($arr);?>
<?phpsession_start();include('../install/conn.php');$conn=mysqli_connect($servername,$username,$password,$database);$mima=md5(md5($_POST['pass']));$sql1="select * from admins where wno=".$_SESSION['wno'];$str=mysqli_query($conn,$sql1);$row=mysqli_fetch_object($str);$w_ps=$row->wps;$sql4="select * from users where usno=".$_POST['usno'];$str4=mysqli_query($conn,$sql4);$row4=mysqli_fetch_object($str4);$usno=$row4->usno;if($w_ps!=$mima){$pw=0;}else{$pw=1;if($usno==$_POST['usno']){$c=0;}else{$c=1;$sql="insert into `users` (`usno`,`usname`, `usps`, `usem`,`usnum`,`ussex`) values ('".$_POST['usno']."','".$_POST['username']."','".$mima."', '".$_POST['email']."', '".$_POST['mobile']."', '".$_POST['sex']."');";$str=mysqli_query($conn,$sql);if($str){$code=1;}else{$code=0;};}}$arr=array('code'=>$code,'sql'=>$sql,'pw'=>$pw,'c'=>$c);echojson_encode($arr);?>
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
36
37
添加图书
<?phpsession_start();include('../install/conn.php');$conn=mysqli_connect($servername,$username,$password,$database);$mima=md5(md5($_POST['pass']));//检验图书$sql4="select * from books where bno=".$_POST['bno'];$str4=mysqli_query($conn,$sql4);$row4=mysqli_fetch_object($str4);$b_no=$row4->bno;//检验管理员密码$sql8="select * from admins where wno=".$_SESSION['wno'];$str=mysqli_query($conn,$sql8);$row=mysqli_fetch_object($str);$w_ps=$row->wps;if($w_ps!=$mima){$pw=0;}else{if($b_no==$_POST['bno']){$c=0;}else{$c=1;$sql="insert into `books` (`bno`,`bname`, `writer`, `press`) values ('".$_POST['bno']."','".$_POST['bname']."','".$_POST['writer']."','".$_POST['press']."');";$str1=mysqli_query($conn,$sql);$now=date('Y-m-d H:i:s');$sql2="insert into `massage` (`bno`, `bstatus`,`wno`,`mtime`) values ('".$_POST['bno']."','在馆','".$_SESSION['wno']."','".$now."');";$str2=mysqli_query($conn,$sql2);$sql3="insert into `belong` (`bno`,`cno`) values ('".$_POST['bno']."','".$_POST['cno']."');";$str3=mysqli_query($conn,$sql3);}if($str1==trueand$str2==trueand$str3==true){$code=1;}else{$code=0;}$pw=1;}$arr=array('code'=>$code,'c'=>$c,'pw'=>$pw,'sql'=>[$sql3,$sql2,$sql],'str'=>[$str1,$str2,$str3]);echojson_encode($arr);?>