php 登陆问题 数据库用的是phpmyadmin

w454638 2009-05-29 10:37:10
<?php
session_start();

require_once($_SERVER['DOCUMENT_ROOT'].'/base/DBaccess.sql.inc');
include_once('./systemInterface.tpl');
$username=$_POST['loginUserName'];
$userpossw=$_POST['loginPassword'];
$sqr="select * from user where username = "."'".$username."'"." and password = "."'".$userpossw."'";
$rst=mysql_query($sqr);
if($rst===false)
{
include_once($_SERVER['DOCUMENT_ROOT'].'/index.php');
}
else
{
include_once($_SERVER['DOCUMENT_ROOT'].'/modules/business/);
}
?>
上面是我的接收登陆信息的表单,数据库也正确连上了,但不管我在登陆界面输不输用户名和密码,都到能face.php页面,是怎么回事?还请高人指点。
...全文
63 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
十三月二十一 2009-05-30
  • 打赏
  • 举报
回复
if($rst===false)
改为
if($rst==false)
w454638 2009-05-30
  • 打赏
  • 举报
回复
可以了,谢谢大家。结贴去。
taozi40602748 2009-05-30
  • 打赏
  • 举报
回复
$sqr="select * from user where username ='".$username."' and password ='".$userpossw."'";
SQL语句改成这样试一下呢,判断直接写成if($rst),同意daguaio_O 说的只要执行了就返回true
lypkiller3 2009-05-29
  • 打赏
  • 举报
回复
fefwef wef
daguaio_O 2009-05-29
  • 打赏
  • 举报
回复
$rst=mysql_query($sqr);
if($rst===false)
这里改成:
$rst=mysql_query($sqr);
$num = mysql_num_rows($rst);
if($num==0)
试试

daguaio_O 2009-05-29
  • 打赏
  • 举报
回复
$sqr="select * from user where username = "."'".$username."'"." and password = "."'".$userpossw."'";
只要这语句能够顺利执行,mysql_query返回的就是true吧

21,891

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧