Hi,
I'm new to the forum so I hope I'm in the right place.
I'm trying to develop a secure login & member system for a club website but am having difficulty in getting my head around salts and nonces for my registration & logon.
Here's what I do to reg:
$salt = "aB1cD2eF3G";
$salt .= $login;
$password = $_POST['password'];
$pass = md5($salt.$password);
//Create INSERT query
$qry = "INSERT INTO members(firstname, lastname, login, passwd) VALUES('$fname','$lname','$login','$pass')";
I know the salt is static & want to have it random; I think that's the idea of a nonce - but would I have to create a separate table for these nonces?
anyway; on my logon page I have this
$salt = "aB1cD2eF3G";
$salt .= $login;
$pass = md5 ( $salt . $password );
//Create query
$qry = "SELECT * FROM members WHERE login='$login' AND passwd='$pass'";
$result = mysql_query ( $qry );
//Check whether the query was successful or not
if ($result) {
if (mysql_num_rows ( $result ) == 1) {
if (condition) {
}
//Login Successful
session_regenerate_id ();
which works but i'm concerned with the problem above.
Finally, I just ahve this bit for nonce & timestamp:
// Security Checks
if (($timeStamp != $_SESSION ['TIME'])) {
$errmsg_arr [] = 'timeStamp amended: Security Hijack';
$errflag = true;
}
if (($nonce != $_SESSION ['RAND'])) {
$errmsg_arr [] = 'nonce missing: Security Hijack';
$errflag = true;
}
I get the RAND & TIME from hidden field.
I guess I'm just looking for advice.
Thanks,
SB