구현 혼란 여기 내가 가지고있는 코드입니다, 그러나 Bcrypt 사용하여 해시 암호에 올 때 나는 혼란 스러워요 : 로그인 버튼을 제출 클릭 여기 는 Bcrypt
<?php
session_start();
include_once('bcrypt.php');
$db_host = 'localhost';
$db_user = '';
$db_pass = '';
$db_name = 'credentials';
if (!isset($_POST['userName']))
{
echo 'You did not enter a valid username.';
exit;
}
if (!isset($_POST['pass']))
{
echo 'You did not enter a valid password.';
exit;
}
$con = new mysqli($db_host, $db_user, $db_pass, $db_name);
if ($con->connect_error)
{
die('Connect Error (' . $con->connect_errno . ') ' . $con->connect_error);
}
$sql = "SELECT userName, pass FROM `Members` WHERE userName = ?";
if (!$result = $con->prepare($sql))
{
die('Query failed: (' . $con->errno . ') ' . $con->error);
}
if (!$result->bind_param('s', $_POST['userName']))
{
die('Binding parameters failed: (' . $result->errno . ') ' . $result->error);
}
if (!$result->execute())
{
die('Execute failed: (' . $result->errno . ') ' . $result->error);
}
$result->store_result();
if ($result->num_rows == 0)
{
die('There is no such username in our database.');
}
$result->bind_result($db_username, $db_password);
$result->fetch();
$result->close();
$con->close();
$bcrypt = new Bcrypt(15);
if ($bcrypt->verify($pass, $db_password))
{
$_SESSION['userName'] = $db_username;
header('location:index.html');
exit;
}
else
{
echo 'Incorrect username or password.';
}
가 난 후지고있어 오류입니다 :
Warning: include_once(bcrypt.php): failed to open stream: No such file or
directory in C:\Users\Julian Buscema\Desktop\Subpost.me\htdocs\connectivity-
login.php on line 3
Warning: include_once(): Failed opening 'bcrypt.php' for inclusion
(include_path='.;C:\Users\Julian Buscema\Desktop\Subpost.me\php\PEAR') in
C:\Users\Julian Buscema\Desktop\Subpost.me\htdocs\connectivity-login.php on line 3
You did not enter a valid username.
나는 belcrypt.php가 빠졌지 만 Bcrypt로 일한 적이 없으므로 여기에서 어디로 가야할지 잘 모르겠습니다.
bcrypt가 PHP로 이미 구현되었습니다 –
@self 그래서 오류가 의미 할 수있는 것은 무엇입니까? 내가 게시 한 코드는 연결에 대한 login.php입니다. –