Guest User

Untitled

a guest
Feb 6th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. require_once ("PasswordHash.php");
  2. // Хэшируем пароль
  3. $t_hasher = new PasswordHash(8, FALSE);
  4. $password_in_hash = $t_hasher->HashPassword($password);
  5. $now = time(); // Время регистрации
  6. $sql = "INSERT INTO users (username, email, password, ip, register_date, last_activity) VALUES (?, ?, ?, ?, ?, ?)";
  7. $result = $pdo->prepare($sql);
  8. $count = $result->execute(array($login, $email, $password_in_hash, $ip, $now, $now));
  9.  
  10. require_once ("PasswordHash.php");
  11. // Проверяем пароль и хэш
  12. $sql="SELECT * FROM users WHERE username =?";
  13. $sth = $pdo->prepare($sql);
  14. $sth->execute(array($login));
  15. $rows = $sth->fetch(PDO::FETCH_ASSOC);
  16. print_r($rows);
  17. $t_hasher = new PasswordHash(8, FALSE);
  18. $check_password = $t_hasher->CheckPassword($password, $rows['password']);
Add Comment
Please, Sign In to add comment