그래서 나는 PHP 인증 스크립트를 가지고 있으며 모든 것이 잘 작동합니다. 그러나 나는 프로그래밍 된 방식에 대해 확신이 없다. (나는 어떤 것들을 하드 코딩했다.) 스택이 이것을 살펴보고 잠재적 인 문제점을 지적 할 수 있기를 바랬다. PHP 로그인 BCrypt 인증
<?php
require_once 'Bcrypt.php';
class Mysql {
private $conn;
function __construct() {
$this->conn = new PDO('mysql:host=***;dbname=***;charset=UTF-8','***','***') or
die('There was a problem connecting to the database.');
}
function verify_Username_and_Pass($un, $pwd) {
ini_set('display_errors', 'On');
error_reporting(E_ALL | E_STRICT);
$query = "SELECT *
FROM Conference
WHERE Username = :un";
$stmt = $this->conn->prepare($query);
$stmt->bindParam(':un', $un);
//$stmt->bindParam(':pwd', $pwd);
$stmt->execute();
$row = $stmt->fetchAll();
$hash = $row[0]["Password"];
$is_correct = Bcrypt::check($pwd, $hash);
if ($is_correct) {
// User exist
$firstName = $row[0]["First Name"];
$_SESSION["FirstName"] = $firstName;
return true;
$stmt->close();
}
else {
// User doesn't exist
return false;
$stmt->close();
}
}
}
?>
그래서 어떻게 보는가 : 여기
스크립트입니까?
http://codereview.stackexchange.com/에서이 질문을 시도해야합니다. – Tchoupi