今日看了一些好贴:
1:关于session的问题集锦解决方案(http://www.phpchina.cn/viewarticle.php?id=4968);
2:session的工作原理(http://www.phpchina.cn/viewarticle.php?id=4532);
我的贴子:
1:奇怪的编译错误,帮忙看看哦(http://www.phpx.com/viewarticle.php?id=117579)待解决中
//源文件
<?
session_start();//最好写在最前面(在有html输出之前)
Include("../include/conn.inc.php");
$username=htmlspecialchars($_POST["name"]);
$password=md5(htmlspecialchars($_POST["ps"]));
$exec="select * from guanli where zh='".$username."' ";
if($result=mysql_query($exec))
{
if($rs=mysql_fetch_array($result))
{
if($rs["zh"]==$username AND $rs["mm"]==$password);
{
$_SESSION['name']=$username;
$_SESSION['mm']=$password;
echo "<h>你已成功登陆青年网新闻管理系统</h>";
echo "<script>location.href='all.php';</script>";
}
else{
echo "<script>alert('帐号或密码错误!');location.href='index.php';</script>";
}
}
else{
echo "<script>alert('帐号或密码错误!');location.href='index.php';</script>";
}
}
else{
echo "<script>alert('数据库连接出错!');location.href='index.php';</script>";
}
?>