Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function login($username, $password, $hash = true, $post = false) {
- if (!$hash) {
- $password = $this->hash($password);
- }
- $this->services->prepare("SELECT *
- FROM anope_ns_core
- WHERE display = :username
- LIMIT 1")
- ->bindValue('username', $username)
- ->execute();
- if ($this->services->num_rows() == 1 && $user = $this->services->fetch_assoc()) {
- if (substr(bin2hex($user['pass']), 0, 40) === $password) {
- $user['password'] = substr(bin2hex($user['pass']), 0, 40);
- $this->_loggedIn = true;
- foreach ($user as $key => $value) {
- $this->_information[$key] = $value;
- $_SESSION['user'][$key] = $value;
- }
- setcookie('FServices', $user['display'] . '|' . hash('sha512', $user['display'] . $user['password'] . $_SERVER['REMOTE_ADDR']), time() + 2592000, '/', '', '', 1);
- return true;
- } else {
- return false;
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement