Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.
php and sha1
- login form
- if (CheckLogin($nickname, $password) == "true"){$_SESSION['LoggedIn'] = "true";} else {$_SESSION['LoggedIn'] = "false";}
- function checklogin
- function memberinfo
- password put into databse
I'm making a login form, and running into some problems checking the encrypted password from the login form to the password that is stored in the database. The pages being affected are bellow.
login form
$nickname = $_REQUEST['nickname']; $password = $_REQUEST['password'];
if (CheckLogin($nickname, $password) == "true"){ $_SESSION['LoggedIn'] = "true"; } else { $_SESSION['LoggedIn'] = "false"; }
function checklogin
function CheckLogin($nickname, $password){
$salt = MemberInfo("Salt", "WHERE Nickname = '$nickname'");
$pass = sha1($salt.$password);
$sql = mysql_query("SELECT * FROM member WHERE Nickname = '$nickname' AND Password = '$pass'");
if ($sql === true){
return "true";
} else {
return "false";
}
}
function memberinfo
works fine, pulls correct information
password put into databse
$password = sha1($salt.$adminConfig['password']);
$adminConfig['password'] and $password (on page 1) are the same value
The problem is that $pass (from checkLogin function) and $password (from the password inserted into the database) are not the same.
Any ideas what would be causing this?