I just installed wamp, 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 wamp 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


Online the echoed $hashed_password for the account is


I've determined crypt is working differently online than it is offline? I am using the same php version both online and offline(php 5.2.17), Why is this and how can i solve it? I've been stuck on this all day. My website works perfectly online though.

Member Avatar


Now logging in works online but with wamp it doesn't work.

I actually still learning hashes on my own. It should work the same either online or offline. The hash does change.

Should this be empty?

$Blowfish_End = '';

I always refer back to this example to see how to create other hashes code:

function create_parameters($array){
$data = '';
$ret = array();
foreach ($array as $key => $value) {
$data .= $key . $value;
$ret[] = "$key=$value";
$hash = md5($data);
$ret[] = "hash=$hash";
return join ('&amp;', $ret);
echo '<a href="script.php?'. create_parameters(array('cause' => 'vars')).'">err </a>'; 

The Answer:

<a href='script.php?cause=vars&hash=8eee14fe10d3f612589cdef079c025f6'>err!</a>    

If I understand the manual right, the crypt function is based on the box running PHP, not PHP itself. If they are on different computers, you are likely to get different results.

Anyone know for sure?