Page 1 of 1

Fatal Error - unable to redeclare password_hashin line 143

Posted: Thu Mar 20, 2014 6:20 am
by mirnasim
Started getting the below error since the upgrade of PH version:
Fatal error - unable to redeclare password_hash in includes/functions_login.php on line 143
Here is the code below:

140 function password_hash ($password, $salt)
141 {
142 return md5(md5($password) . $salt);
143 }
144
145 function login_spoofer ($username, $admin_username, $admin_password)
146 {
147 global $db;
148 (array) $login_output = NULL;
149
150 $login_query = $db->query("SELECT * FROM " . DB_PREFIX . "admins WHERE
username='" . $admin_username . "' AND password='" . md5($admin_password) . "' AND level='1' LIMIT 0,1");

$is_login = $db->num_rows($login_query);

$login_output['admin_exists'] = false;
if ($is_login)
{
$login_output = login_user($username, '', '', true);
$login_output['admin_exists'] = true;
}

return $login_output;
}

Could you please advise how this can be fixed and the passwords are still checked and validated. The simpler the better as I am very new to this.

Re: Fatal Error - unable to redeclare password_hashin line 1

Posted: Thu Mar 20, 2014 8:48 am
by Celauran
password_hash is a core function as of PHP 5.5. You'll need to rename your function or, better, make use of the built in.