0

我有两个登录面板——一个用户类型为单选按钮,一个用户名和密码,另一个只有用户名和密码。我已经写了下面的函数,但它对我不起作用。

function auth_check_user1($login, $password, $agent )
{

$userAndPassValid = ($f['login'] == $login && $f['password'] == $password);
$userTypeValid = true;
if ($agent != null)
{
    $userTypeValid ==  $agent;

     $query = 'SELECT * FROM ' . USERS_TABLE . ' WHERE login = "' . $login . '" AND 
         password ="' . $password . '"  AND user_category ="' . $agent . '"  LIMIT 1';
     $r = $db->query ($query);  

     if ($db->num_rows($r)==1)
      {
       $f = $db->fetch_array($r);


    if ($f['login'] == $login && $f['password'] == $password && $f['user_category'] == $agent)
     $logged = TRUE;
    else 
     $logged = FALSE;
   }
     else
     {
     $logged = FALSE;
     }

 return $logged;
 }
4

0 回答 0