Guest User

Untitled

a guest
Apr 11th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. <?php
  2.  
  3. $username = $_POST['username'];
  4. $password = $_POST['username'];
  5.  
  6. if ($username&&$password)
  7. {
  8. // Connect To DB
  9. $connect = mysql_connect("localhost","root","wizpa") or die("Couldn't Connect!");
  10. mysql_select_db("phplogin") or die ("Couldn't Find DB");
  11.  
  12. $query = mysql_query("SELECT * FROM users WHERE username='$username'");
  13.  
  14. $numrows = mysql_num_rows($query);
  15.  
  16. if ($numrows!=0)
  17. {
  18.  
  19.     while ($row = mysql_fetch_assoc($query));
  20.     {
  21.         $dbusername = $row["username"];
  22.         $dbpassword = $row["password"];
  23.     }
  24.    
  25.     if ($username==$dbusername&&$password==$dbpassword)
  26.     {
  27.         echo "You're In!";
  28.     }
  29.     else
  30.         echo "Wrong Information!";
  31. }
  32. else
  33.     die ("That user Doesn't Exist!");
  34.    
  35.  
  36.  
  37. }
  38. // If not entered User and/or Pass
  39. else
  40.     die("Please Enter User and Password!");
  41.  
  42. ?>
Add Comment
Please, Sign In to add comment