我有一个注册页面,允许用户输入其中一个密码的信息,因此必须对其进行加密或散列,因此使用 Bcrypt 并且它可以在寄存器上工作
但是当涉及到登录时,我不知道在哪里以及如何使用它
,任何人都可以帮助我吗?
注册.php:
require_once('Bcrypt.php');
$bcrypt = new Bcrypt(15);
$hash = $bcrypt->hash('$pass1');
//********Insert all the members's input to the database**************//
$query = mysql_query("INSERT INTO members
(user_name, first_name, last_name,
governorate, district, village,
birth_date, email_address,
specialization, password, registered_date)
VALUES
('$username', '$firstname', '$lastname',
'$governorate', '$district', '$village',
'$bdate', '$email', '$specialization',
' $hash', now())")
or die("could not insert data");
登录.php
require_once('Bcrypt.php');
$bcrypt = new Bcrypt(15);
$hash = $bcrypt->hash('$pass');
$isGood = $bcrypt->verify('$pass', $hash);
$sql=mysql_query("SELECT user_id, email_address,
first_name, user_name
FROM members
WHERE email_address='$email'AND password= '$hash'
LIMIT 1") or die("error in members table");
$login_check = mysql_num_rows($sql);