I just installed xampp, so i can test my website offline. Now i get numerous Undefined index or Undefined variable errors, which i know how to fix. Now logging in works online but with xampp it doesn’t work. The code isn’t wrong. I imported the database online to offline. I’ve pin pointed what is wrong but don’t know how to solve it.
here is the code where i test if the login details are correct.
$Blowfish_Pre = '$2a$05$';
$Blowfish_End = '$';
$hashed_password = crypt($password, $Blowfish_Pre . $salt . $Blowfish_End);
//check to see if they match
if ($username==$dbusername&&$hashed_password==$dbpassword){
Offline the echoed $hashed_password for the account is $2a$05$CEDaiUETMOTuZ1tzSX1dW.1rmbYfiu1Hf6jnZyJ5DouQOIHEPwXiW
Online the echoed $hashed_password for the account is
$2J7rPSsTYb1Q
I’ve determined crypt is working differently online then it is offline? Why is this and how can i solve it?
crypt()uses different hash algorithm depending on what the system provides. Starting with PHP 5.3 it “contains its own implementation and will use that if the system lacks of support for one or more of the algorithms.”Your offline version does use blowfish as you can see at the start
$2a$. Your online version does use some fallback.See: http://php.net/manual/en/function.crypt.php