Guest User

Untitled

a guest
Apr 19th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <?php
  2.  
  3. require_once 'includes/constants.php';
  4.  
  5. class Mysql {
  6. private $conn;
  7.  
  8. function __construct() {
  9. $this->conn = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or
  10. die('There was a problem connecting to the database.');
  11. }
  12.  
  13. function verify_Username_and_Pass($un, $pwd) {
  14.  
  15. $query = "SELECT username
  16. FROM users
  17. WHERE username = ? AND password = ?
  18. LIMIT 1";
  19.  
  20. if($stmt = $this->conn->prepare($query)) {
  21. $stmt->bind_param('ss', $un, $pwd);
  22. $stmt->execute();
  23. $stmt->bind_result($fetched_user_;
  24. if($stmt->fetch()) {
  25. $stmt->close();
  26. return true;
  27. }
  28. }
  29. return false;
  30. }
  31. }
Add Comment
Please, Sign In to add comment