panos

\\一段管理员登陆验证程序,用户名和密码明明是正确,可验证就是错误

一段管理员登陆验证程序,用户名和密码明明是正确,可验证就是错误
作者: panos  发布日期: 2006-5-23    查看数: 21   出自: http://www.phpx.com
//checklogin.php
<?
Include("../include/conn.inc.php");
@session_start();
$username=htmlspecialchars($HTTP_POST_VARS["name"]);
$password=htmlspecialchars($HTTP_POST_VARS["ps"]);
//where zh='".$username."' and che='1'"
$exec="select * from guanli";
if($result=mysql_query($exec))
{
if($rs=mysql_fetch_array($result))
{
if($rs["zh"]==$username AND $rs["mm"]==md5($password))
{
$_SESSION=array();
$_SESSION['name']=$username;
$_SESSION['mm']=$password;
echo "<script>location.href='all.php';</script>";
}
else
{echo "<script>alert('帐号或密码错误!');top.location.href='index.php';</script>";
}
}
else
{
echo "<script>alert('帐号或密码错误!');top.location.href='index.php';</script>";
}
}
else
{
echo "<script>alert('数据库连接出错!');location.href='index.php';</script>";
}
?>
@session_write_close()
//end
以前好好的啊
我在数据库里的密码都是MD5加密的
用户名和密码都是正确的,怎么老提示'帐号或密码错误“
高手帮帮忙啊
【论坛浏览】  【我来说两句】 【打印】 【大】 【中】 【小】 【关闭】

 相关评论
作者: sadman 发布日期: 2006-5-23
建议:1/可以select * from guanli where zh='".$username."' and mm='".$password."'来进行查询可以提高程序执行效率
2/可以自己查一下问题的所在,在$exec赋值前print_r($_POST),看看提交的数据是否正确。
也可以echo $exec后在数据库管理工具中执行看看是否是数据库方面的问题。

posted on 2006-05-24 01:24 mr.panos 阅读(395) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

导航

统计

常用链接

留言簿(1)

随笔分类

随笔档案

中文百科全书

搜索

最新评论

阅读排行榜

评论排行榜