<body background="tu/6.png"><p> <?PHPerror_reporting("E_ALL^E_NOTICE^E_WARNING");include("conn.php"); ?></p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><div > <table width="323" height="154" border="0" align="center" background="tu/2.jpg"> <form action="" method="post" > <tr> <h3 align="center"> 管理员登录页面</h3> </tr> <tr> <td> 用户名: <input type="text" name="username" /></td> </tr> <tr> <td>密码: <input type="password" name="password" /></td> </tr> <tr> <td> 用户类型: <select id="utype"> <option value="adm">管理员</option> <option value="stu">学生</option> </select> </td> </tr> <td align="center"> <input type="submit" value="登陆" name="login" /> </td> <?php echo "<tr> <td colspan='3'> <a href='login-student.php'>转入学生登录界面</a></td> </tr> ";?> </form> </table> <?php if(isset($_POST["login"])){ setcookie("a",$_POST["username"],time()+3600); $n=$_POST["username"]; $sql="select * from admin where id='$n'"; $sql="select * from student1 where sno='$n'"; $result=mysql_query($sql,$link); $query=mysql_fetch_array($result); if (($query['id']==$_POST['username'])&& ($query['pass']==$_POST['password']) && ($_POST['username']!=null) && ($_POST['password']!=null) &&($_POST['utype']=="adm") ) { header("location:admin_index.php"); }if (($query['sno']==$_POST['username'])&& ($query['pass']==$_POST['password']) && ($_POST['username']!=null) && ($_POST['password']!=null) &&($_POST['utype']=="stu") ) { header("location:student_index.php"); } else{ echo "<script> alert('用户名或密码不正确,请重新输入!');</script>"; } } ?>
添加回答
举报
0/150
提交
取消