0

Hi guys, always a big thanks for your input. Really appreciate as always.

Ok my issue today is with the password_hash function which randomly generate a salt before encryption.

I am creating a user registration form...i need to protect the password before it is saved to the database when user registerss.

I have already visited the PHP manual here

But since i am a newbie in PHP i have no idea how to change my code to apply this function.

I am going to attach it here below. Please have a look and let me know how to proceed...Thanks.

<?php require_once('Connections/bankusers.php'); ?>

<?php

// table name
$tbl_name=temp_users_db;

// Random confirmation code
$confirm_code=md5(uniqid(rand()));

// values sent from form
$FirstName=$_POST['FirstName'];
$LastName=$_POST['LastName'];
$Email=$_POST['Email'];
$UserName=$_POST['UserName'];
$Password=$_POST['Password'];


// Insert data into database
$sql="INSERT INTO $tbl_name(confirm_code, FirstName,LastName,Email,UserName,Password)VALUES('$confirm_code','$FirstName','$LastName','$Email','$UserName', '$Password')";
mysql_select_db($database_bankusers, $bankusers);
$result=mysql_query($sql);
2
Contributors
2
Replies
16
Views
3 Years
Discussion Span
Last Post by diafol
0

I think i solved my own problem lol...as usual.All i did was add this :

$unhashedPassword="Password";
$Password= password_hash($unhashedPassword, PASSWORD_DEFAULT);
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.