日期:2014-05-17 浏览次数:20502 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtm11/DTD/xhtml1-transitional.dtd"> <html> <head> <title>医院门诊系统</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </head> <body> <?php $user = $_POST['user']; $passwd = $_POST['password']; if ((!isset($user)) || (!isset($passwd))) { ?> <p>请输入用户名或密码</p> <form method="post" action="Login.php"> <table id="atable"> <tr> <td>用户名:</td><td><input type="text" name="user" /></td> </tr> <tr> <td>密码:</td><td><input type="password" name="password" /></td> </tr> </table> <input type="submit" value="登陆" style="width:100px;height:20px" /> </form> <?php } else { $mysql = mysqli_connect("127.0.0.1","clinicadmin","clinicadmin"); if (!$mysql) { echo"无法连接服务器,登陆失败。"; exit; } $selected=mysqli_select_db($mysql, "clinic"); if (!$selected) { echo"连接服务器失败,登陆无效。"; exit; } $query = "select count(*) from user where account='".$user."' and password='".$passwd."'"; $result = mysqli_query($mysql, $query); if (!$result) { echo"无法登陆!"; exit; } $row=mysqli_fetch_row($result); $count=$row[0]; if ($count=1) { echo"<h2>欢迎使用医院挂号门诊系统!</h2>"; } else { echo"<p>用户名或密码错误!</p>"; } } ?> </body> </html>