I can't validate this two variables ($logintxt, $passwdtxt)

<?
$logintxt = $HTTP_POST_VARS['logintxt'];
$passwdtxt= $HTTP_POST_VARS['passwdtxt'];

if (!$logintxt || !$passwdtxt)
{
 include('login.htm');
}
else
{
 $ligacao=mysql_connect("localhost","","");
 if (!$ligacao)
 {
  echo "
  <html>
  <title>ERROR!!</title>
  <body>Problemas na ligação á base de dados!</body>
  ";
 }
 else
 {
  $pass=md5($passwdtxt);
  $sql="SELECT login,passwd FROM users WHERE (login='$logintxt') &&
(passwd='$pass')";
  $result=mysql_db_query("mysite",$sql) or die (mysql_error());
  if ($result)
  {
   $reg=mysql_fetch_array($result);
   if ($pass==$reg["passwd"] && $logintxt==$reg["login"])
   {
    echo "
    <html>
    <title>Xaram!!</title>
    <body>User logged in</body>
    ";
   }
   else
   {
    echo "
    <html>
    <title>ERROR!!</title>
    <body>User não existente ou inválido</body>
    ";
   }

  }
  else
  {
   echo "
   <html>
   <title>ERROR!!</title>
   <body>No result</body>
   ";
  }


 }
 mysql_close();
}
?>

it keeps telling me "User não existente ou inválido" i guess that the
problem is in the line code "if ($pass==$reg["passwd"] &&
$logintxt==$reg["login"])" but i can't figure it out!! what i'm doing wrong?

Thanks for the help...




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to