home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 February / PCpro_2005_02.ISO / files / opensource / A_Note_4.2.1 / setup.exe / {app} / Server Documents / validateuser.php < prev   
Encoding:
PHP Script  |  2003-07-25  |  561 b   |  21 lines

  1. <?php
  2. // See if the user exists and that the password is right
  3.     $query="SELECT * FROM users WHERE user='$user'";
  4.     $reply = mysql_query ($query);
  5.     $num_result = mysql_num_rows ($reply);
  6.  
  7. // Did we find a user
  8.     if ($num_result == 0)    {
  9.         echo $xmlstart ."<info info=\"no user\"/>";
  10.         exit;
  11.     }
  12.  
  13. // Check if the user and password is valid
  14.     $pass = mysql_result ($reply, 0, "password");
  15.     $userid = mysql_result ($reply, 0, "id");
  16.  
  17.     if ($pass != $password)    {
  18.         echo $xmlstart ."<info info=\"username exists but wrong password\"/>";
  19.            exit;
  20.     }
  21. ?>