Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function userLogin($data)
- {
- $username = mysqli_real_escape_string($this->db->link, $data['username']);
- $password = mysqli_real_escape_string($this->db->link, $data['password']);
- if (empty($username) or empty($password)) {
- $msg = "Fields must not be empty!";
- return $msg;
- }
- $query = "SELECT * FROM tbl_users WHERE username='$username'";
- $result = $this->db->select($query);
- if ($result != false) {
- $value = $result->fetch_assoc();
- if ($this->passwordVerify($password, $value['password'])) {
- Session::set('userlogin', true);
- Session::set('userId', $value['id']);
- Session::set('userName', $value['username']);
- header('Location: index.php');
- } else {
- $msg = "Username or password not matched!";
- return $msg;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement