I have built a site which hashes passwords for new users. The site worked and the passwords hashed. Xampp crashed and I had to reinstall and I now get a syntax error when I try to register a new user. I have not changed the code, the error is:
Parse error: syntax error, unexpected ':', expecting ')' in C:\Users\chris\OneDrive\Desktop\XAMPP\htdocs\irnMind\register-process.php on line 67
Line 67 is - $hash = password_hash($pwd, algo: PASSWORD_BCRYPT);
$checkUser ="SELECT * FROM users WHERE username = '$user'";
$result = $conn->query($checkUser);
if($result->num_rows > 0){
header('Location: register.php?error=usernametaken');
}else{
$hash = password_hash($pwd, algo: PASSWORD_BCRYPT);
$sql = "INSERT INTO users (username, firstname, lastname, email, mobile,
age, maingoal, likes, dislike, available,
pwd, profilepicture )
VALUES ('$user', '$first', '$last', '$email', '$mobile',
'$age', '$goal', '$fav', '$dislike', '$available',
'$hash', '$target_file')";
if ($conn->query($sql) === TRUE) {
echo '<div>';
echo '<p>' . "Your account has been registered. Please click Login to proceed to your account. Thank you." . '</p>';
echo '</div>';
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
$conn->close();
?>