Advertisement
Guest User

Untitled

a guest
Sep 14th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. <?php
  2.  
  3. $user_username = "haironfire907";
  4. $user_password = "dicks";
  5.  
  6. error_reporting(E_ALL);
  7. ini_set('display_errors', '1');
  8.  
  9. $dsn = "pgsql:host=db.doc.ic.ac.uk;port=5432;dbname=g1027121_u";
  10. $user = "g1027121_u";
  11. $password = "sUyzTDIKq4";
  12.  
  13. $link = new PDO($dsn,$user,$password);
  14.  
  15. $stmt = $link -> prepare ("SELECT username, password FROM users WHERE username = '${user_username}';");
  16. $stmt -> execute();
  17.  
  18. if ($stmt -> rowCount() < 1) {
  19.     echo "You are not in the database.";
  20. } else {
  21.     $row = $stmt -> fetch();
  22.     if ($row['password'] == $user_password) {
  23.         echo "OK.";
  24.     } else {
  25.         echo "Wrong password!";
  26.     }
  27. }
  28.  
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement