Advertisement
Guest User

Untitled

a guest
Jan 1st, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. if(!class_exists('DB')) {
  2. class DB {
  3. public function __construct() {
  4. $mysqli = new mysqli(__HOST__, __USER__, __DB__, __PW__);
  5. if($mysqli->connect_errno) {
  6. die('%s', $mysqli->connect_error);
  7. }
  8. $this->connection = $mysqli;
  9. }
  10. public function login($username, $password) {
  11. $password = strtoupper(hash('whirlpool', $password));
  12. $query = mysqli->query("SELECT username, password FROM users WHERE username=$Username AND password=$Password");
  13. if(mysqli->num_rows($this->connection, $query) == 1) {
  14. //cleared to go!
  15. $this->connection->close //always close your connections!
  16. } else {
  17. echo "Account not found or invalid credentials."
  18. $this->connection->close //always close your connections!
  19. }
  20.  
  21.  
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement