Guest User

Untitled

a guest
Oct 24th, 2017
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. <?php
  2.  
  3. $username = $_post['username'];
  4. $password = $_post['password'];
  5.  
  6. if( empty( $username ) === false && empty( $password ) === false ) {
  7.  
  8.  
  9.     $connect = mysql_connect("localhost","root","") or die("Couldn't connect");
  10.     mysql_select_db("hub") or die("Couldn't find database");
  11.  
  12.  
  13.     $query = mysql_query( "SELECT * FROM users WHERE username = '".mysql_real_escape_string( $username )."'" );
  14.  
  15.     $numrow = mysql_num_rows($query);
  16.    
  17.     if ($numrow!=0) {
  18.  
  19.         while ($row = mysql_fetch_assoc($query))
  20.         {
  21.             $dbusername = $row['username'];
  22.             $dbpassword = $row['password'];
  23.         }
  24.    
  25.     // check to see if they match!
  26.     if ($username==$dbusername&&$password==$dbpassword)
  27.     {
  28.      echo "Your In!";
  29.     }
  30.    
  31.  
  32.     else
  33.         echo "Incorrect Password";
  34.        
  35. }
  36. else
  37.     die("That users doesn't exist!");
  38.        
  39.  }
  40.  
  41.  
  42.  
  43. ?>
Add Comment
Please, Sign In to add comment