登录表单处置惩罚 (引荐进修:PHP视频教程)
<?php session_start(); include "inc/conn.php"; $username=$_POST[user]; $password=$_POST[pwd]; $sql=mysql_query("select * from user where username='".$username."' and password='".$password."'"); if ($result = mysql_fetch_array($sql)){ $_SESSION[username]=$username; //其他页面经由过程推断是不是设置$_SESSION[username]来推断登录状况 ?> <scriptlanguage="javascript"> alert("登录胜利");window.location.href="file.php"; </script> <?php }else{ ?> <scriptlanguage="javascript"> alert("对不起,您输入的用户名或暗码不正确,请从新输入!");window.location.href="index.php"; </script> <?php } ?>
以上就是php推断是不是登录的细致内容,更多请关注ki4网别的相干文章!