Guest User

Untitled

a guest
Jul 15th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php
  2.  
  3. if ($_POST) {
  4.  
  5. // Clean the data
  6. $username = mysql_real_escape_string($_POST["username"]);
  7. $password = mysql_real_escape_string($_POST["password"]);
  8.  
  9. // Get login information
  10. $query = "SELECT id, password FROM users WHERE username = '{$username}' LIMIT 1";
  11. $result = mysql_query($query);
  12.  
  13. // Extract data from results
  14. $data = mysql_fetch_object($result);
  15.  
  16. // If the provided password matches the password in our database, do login.
  17. if ($data->password == $password) do_login();
  18.  
  19. }
  20.  
  21. ?>
Add Comment
Please, Sign In to add comment