Maison >développement back-end >tutoriel php >登录界面弹出框有关问题
登录界面弹出框问题
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php //session_start();?><script language="JavaScript" type="text/javascript">function chk_login_input(form){ if(form.email.value=="") { alert("请输入邮箱"); form.email.focus(); return false; } if(form.password.value=="") { alert("请输入密码"); form.password.focus(); return false; } return true;}</script><style type="text/css"> td { border-right: 1px solid #C1DAD7; border-bottom: 1px dashed #C1DAD7; padding: 6px 6px 6px 6px; color: #4f6b72; font-family:"黑体";font-size:20px;} </style><div id="login" style="text-align:center;margin-top:80px;margin-left:150px;background-image:url(../images/login-bg.png);width:492px;height:395px;"> <form action="login2.php" method="post" name="login" onsubmit="return chk_login_input(this)"> <p> </p> <p> </p> <p> </p> <table style="margin:auto"> <tr> <td>Email:</td> <td><input type="text" name="email" size="20"></td> </tr> <tr></tr> <tr> <td>密码:</td> <td> <input type="password" name="password" size="20"> </td> </tr> <tr> <td><input type="image" name="submit" src="../images/login-icon.png" onclick="document.login.submit()"></td> </tr> </table> </form> </div><?phprequire 'connect_to_database.php';$email=$_POST["email"];$password=$_POST["password"];$dt=mysql_query("select * from userinfo where email='".$email."' and password='".$password."'");if($dt == true ) //访问数据库成功{ $row = mysql_fetch_row($dt); if($row == false)//是否从数据库里提出到了东西 { echo '<script type="text/javascript"> alert("邮箱或密码错误,请重新输入"); location.href("login2.php");'; } else if($row == true) { if($row[6]=='no') { echo '<script type="text/javascript"> alert("账户未激活,请到您的邮箱激活账户,账号需管理员审核后才可使用"); location.href("login2.php"); </script>'; } else { $_SESSION['email']=$email; $_SESSION['password']=$password; echo '<script type="text/javascript"> alert("登录成功"); location.href("index.php"); </script>'; } }}?>