所以我想在用户注册时收紧我的安全性,我知道如何使用MD5但不知道如何从那里转移到password_hash()我想知道我的脚本是否有人能够从我的代码中提供帮助以正确的格式使用它:
<?php
include 'connect.php';
$username = mysqli_real_escape_string($con, $_POST['username']);
$password = md5(mysqli_real_escape_string($con, $_POST['password']));
$first_name = mysqli_real_escape_string($con, $_POST['first_name']);
$last_name = mysqli_real_escape_string($con, $_POST['last_name']);
$email = mysqli_real_escape_string($con, $_POST['email']);
$sql="INSERT INTO users (username, password, first_name, last_name, email )
VALUES ('$username', '$password', '$first_name', '$last_name', '$email')";
if (!mysqli_query($con,$sql)) {
die('Error: ' . mysqli_error($con));
}
header ('Location: /register.php');
?>