Advertisement
Guest User

Untitled

a guest
Dec 31st, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. public function loginUser() {
  2. include "conn.php";
  3. $req = $conn->prepare("SELECT * FROM users WHERE username=:username AND password=:password");
  4. $req->execute(array(
  5. 'username'=>$this->getUsername(),
  6. 'password'=>$this->getPassword()
  7. ));
  8. if ($req->rowCount() == 0) {
  9. header("Location: /chat/index.php?error=1");
  10. return false;
  11. } else {
  12. while ($data=$req->fetch()) {
  13. $this->setID($data['id']);
  14. $this->setUsername($data['username']);
  15. $this->setPassword($data['password']);
  16.  
  17. header("Location: /chat/chat.php");
  18. return true;
  19. }
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement