<?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页面,是怎么回事?还请高人指点。

解决方案 »

  1.   

    $sqr="select * from user where username = "."'".$username."'"." and password = "."'".$userpossw."'"; 
    只要这语句能够顺利执行,mysql_query返回的就是true吧
      

  2.   

    $rst=mysql_query($sqr);
    if($rst===false) 
    这里改成:
    $rst=mysql_query($sqr);
    $num = mysql_num_rows($rst);
    if($num==0)
    试试 
      

  3.   

    if($rst===false) 
    改为
    if($rst==false) 
      

  4.   

    $sqr="select * from user where username ='".$username."' and password ='".$userpossw."'"; 
    SQL语句改成这样试一下呢,判断直接写成if($rst),同意daguaio_O 说的只要执行了就返回true