Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require_once ("PasswordHash.php");
- // Хэшируем пароль
- $t_hasher = new PasswordHash(8, FALSE);
- $password_in_hash = $t_hasher->HashPassword($password);
- $now = time(); // Время регистрации
- $sql = "INSERT INTO users (username, email, password, ip, register_date, last_activity) VALUES (?, ?, ?, ?, ?, ?)";
- $result = $pdo->prepare($sql);
- $count = $result->execute(array($login, $email, $password_in_hash, $ip, $now, $now));
- require_once ("PasswordHash.php");
- // Проверяем пароль и хэш
- $sql="SELECT * FROM users WHERE username =?";
- $sth = $pdo->prepare($sql);
- $sth->execute(array($login));
- $rows = $sth->fetch(PDO::FETCH_ASSOC);
- print_r($rows);
- $t_hasher = new PasswordHash(8, FALSE);
- $check_password = $t_hasher->CheckPassword($password, $rows['password']);
Add Comment
Please, Sign In to add comment