Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function login($user_name, $user_password) {
- $sql = "
- SELECT *
- FROM users
- LEFT JOIN `privileges`
- ON `privileges`.privileges_id = users.user_privileges
- WHERE user_name = :user AND user_ban = 0";
- $params = array(
- ':user' => array(
- 'param' => (string) $user_name,
- 'type' => 2
- )
- );
- $this->_databaseInstance->query($sql, $params, 2);
- if (empty($this->_databaseInstance->getCount())) {
- // 201 Несъществуващо име.
- $this->_errors[201] = 1;
- return FALSE;
- }
- $user_credentials = $this->_databaseInstance->getResult()[0];
- if (!password_verify($user_password, $user_credentials['user_password'])) {
- // 202 Грешна парола.
- $this->_errors[201] = 1;
- return FALSE;
- }
- unset($user_credentials['user_password']);
- return $user_credentials;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement