I have a HTML registration form for users to register for a site that sends information from the form to a mysql database for user log in verification. I have an input box that allows the user to enter in a varchar password which will then be sent to the site, my problem is tat it is not secure as once the password is entered it sends to the database and anyone can see it. I am looking to hash a variable if possible.
$Name = $_POST['Name'];
$Age = $_POST['Age'];
$Location = $_POST['Location'];
$Goal = $_POST['Goal'];
$User = $_POST['user'];
$Pass = $_POST['pass'];
$sql = "INSERT INTO Clients (Name, Age, Location, Goal, Pass, User)
VALUES ('$Name', '$Age', '$Location', '$Goal', '$Pass', '$User')";
if ($conn->query($sql) === TRUE) {
echo "Thanks for registering!! You can now attempt to log in";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}$conn->close();
HTML Form:
<form class="form-horizontal" name="form1" method="POST"
action="register.php">
<h3> Enter Name: </h3>
<input type="text" name ="Name"/>
<h3> Enter Age:</h3>
<input type="text" name="Age" />
<h3> Enter Location: </h3>
<input type="text" name="Location" />
<h3> Goal </h3>
<input type="text" name="Goal" />
<h3> Create Username : </h3>
<input type="text" name="user" />
<h3> Create password: </h3>
<input type ="password" name="pass" />
<input type="submit" value="Register" />
</form>
It works fine I need to know how to hide the passwords from view in the database. Any help would be much appreciated.