登录表单处理(推荐学习: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判断是否登录的详细内容,更多请关注Gxl网其它相关文章!
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did58565