Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function loginUser() {
- include "conn.php";
- $req = $conn->prepare("SELECT * FROM users WHERE username=:username AND password=:password");
- $req->execute(array(
- 'username'=>$this->getUsername(),
- 'password'=>$this->getPassword()
- ));
- if ($req->rowCount() == 0) {
- header("Location: /chat/index.php?error=1");
- return false;
- } else {
- while ($data=$req->fetch()) {
- $this->setID($data['id']);
- $this->setUsername($data['username']);
- $this->setPassword($data['password']);
- header("Location: /chat/chat.php");
- return true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement