免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1023 | 回复: 1
打印 上一主题 下一主题

[其它]求助,令人头痛的问题。。。好奇怪噢! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-12-26 15:45 |只看该作者 |倒序浏览



  1. // 用户登录验证

  2. function checkuser($username,$password)
  3.         {
  4.         $tables=$this ->tables;
  5.         $tab_name=$this ->tab_name;
  6.         $tab_pwd=$this ->tab_pwd;

  7.         $username = trim($username);
  8.         $userinfo = mysql_query("SELECT * FROM ".$tables." WHERE ".$tab_name."='".$username."' and ".$tab_pwd."='".$password."'");
  9.         $r=@mysql_fetch_array($userinfo);
  10.         if($r["members_id"]!="")
  11.                 {
  12.                         $this ->members_id=$r["members_id"];
  13.                 }

  14.                 echo "<BR>".$r[$tab_pwd];
  15.                 echo "==<BR>".$password;

  16.                 if($r[$tab_pwd]==$password)
  17.                 {
  18.                         return FALSE ;
  19.                 }
  20.                 else
  21.                 {
  22.                 return true;
  23.                 }
  24. }

  25. //**验证部份:

  26. // 登陆验证

  27.         function login_ok($username,$password,$url="index.php")
  28.         {
  29.                 echo $username."<BR>";
  30.                 echo md5($password);
  31.         $username=trim($username);
  32.         $password=trim($password);
  33.         if (strlen($username) > 16)
  34.                 {
  35.                 $this ->sa_exit("字段长度才16,你想输入多长?","javascript:history.go(-1);");
  36.                 }
  37.         if ($this ->checkuser($username, md5($password))==true)
  38.                 {
  39.                 $_SESSION['username'] = $username;
  40.         $_SESSION['password'] = md5($password);
  41.                 $this ->cpheader();
  42.         $this ->redirect("<b>登陆成功,请稍候......</b>","./$url");
  43.                 echo "</body>\n</html>";
  44.                 }
  45.                 else
  46.                         {
  47.                
  48.                 $this ->loginpage($this ->gb_url);
  49.                 }
  50.         }
复制代码


我输入正确的用户名和密码,,,为什么却老是验证不了???

[ 本帖最后由 china520 于 2005-12-26 15:46 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2005-12-26 16:46 |只看该作者
问题已解决....
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP