Hi, I'm trying to add encryption to a signup for a college assignment, but find that after adding the sha1 and salt encryption the code does not work.
The code worked before adding the encryption.
Since adding the encryption I've also adding the corresponding fields for username and password into the sql database and double checked, and triple checked all the php, html form and MySQL tables and fields, but don't see any thing wrong.
Can anybody else see any immediate problems with the code snippet below?
If so, can you please let me know?
session_start();
$salt = 'The sky is blue and all the trees are green';
$data = array_map('mysql_escape_string', $_POST);
$password = sha1($data['password'].$salt);
$query = "
INSERT INTO customers (
first_name,
last_name,
address,
mobile,
email,
username,
password
) VALUES (
'{$data['first_name']}',
'{$data['last_name']}',
'{$data['address']}',
'{$data['mobile']}',
'{$data['email']}'
'{$data['username']}',
'$password'
)
";
if(mysql_query($query)) {
echo 'Your login details have been saved.';
} else {
echo 'Your login details have not been saved.<br>';
echo 'Please try again later.';
}
Thanks.