- 论坛徽章:
- 0
|

- // 用户登录验证
- function checkuser($username,$password)
- {
- $tables=$this ->tables;
- $tab_name=$this ->tab_name;
- $tab_pwd=$this ->tab_pwd;
- $username = trim($username);
- $userinfo = mysql_query("SELECT * FROM ".$tables." WHERE ".$tab_name."='".$username."' and ".$tab_pwd."='".$password."'");
- $r=@mysql_fetch_array($userinfo);
- if($r["members_id"]!="")
- {
- $this ->members_id=$r["members_id"];
- }
- echo "<BR>".$r[$tab_pwd];
- echo "==<BR>".$password;
- if($r[$tab_pwd]==$password)
- {
- return FALSE ;
- }
- else
- {
- return true;
- }
- }
- //**验证部份:
- // 登陆验证
- function login_ok($username,$password,$url="index.php")
- {
- echo $username."<BR>";
- echo md5($password);
- $username=trim($username);
- $password=trim($password);
- if (strlen($username) > 16)
- {
- $this ->sa_exit("字段长度才16,你想输入多长?","javascript:history.go(-1);");
- }
- if ($this ->checkuser($username, md5($password))==true)
- {
- $_SESSION['username'] = $username;
- $_SESSION['password'] = md5($password);
- $this ->cpheader();
- $this ->redirect("<b>登陆成功,请稍候......</b>","./$url");
- echo "</body>\n</html>";
- }
- else
- {
-
- $this ->loginpage($this ->gb_url);
- }
- }
复制代码
我输入正确的用户名和密码,,,为什么却老是验证不了???
[ 本帖最后由 china520 于 2005-12-26 15:46 编辑 ] |
|