- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
$find_email = $this->db_users->prepare("SELECT * FROM `users` WHERE `email` = :email");
$find_email->execute(array(':email' => $user['email']));
$row = $find_email->fetch(PDO::FETCH_ASSOC);
if($row['id']) {
$hash_passw = crypt($user['password'], $row['sault']);
$auth = $this->db_users->prepare("SELECT * FROM `users` WHERE `email` = :email AND `password` = :hash_passw");
$auth->execute(array(':email' => $user['email'],
':hash_passw' => $hash_passw));
$_row = $auth->fetch(PDO::FETCH_ASSOC);
if($_row) {
$auth_token = '$3a$'.sha1(date(dmY).time().$user['email']).'$';
$auth = $this->db_users->prepare("UPDATE `users` SET `auth_token`=:auth_token, WHERE `email` = :email");
$auth->execute(array(':auth_token' => $auth_token,
':email' => $user['email']));
$domain = $_SERVER['HTTP_HOST'];
setcookie('authToken', $value, time()+3600, '', $domain, 1);
setcookie('hash', $value, time()+3600, '', $domain, 1);
return true;
Комментарии (0) RSS
Добавить комментарий