Member
Member
jphilbert   2013-04-15, 03:19
#1

I am trying to figure out why some Zenphoto installs fail on this object when not set on security "MD5" and not others installs ..
Looking for some insight (I can login just fine on zenphoto but fails on others things from a plugin..


TEST CODE
$user = 'admin';
$password = 'password ';
function newAdministrator($name, $valid=1) {
$user = new Zenphoto_Administrator($name, $valid);
return $user;
}

function getAnAdmin($criteria) {
$selector = array();
foreach ($criteria as $match=>$value) {
if (is_numeric($value)) {
$selector[] = $match.$value;
} else {
$selector[] = $match.db_quote($value);
}
}
$sql = 'SELECT * FROM '.prefix('administrators').' WHERE '.implode(' AND ',$selector).' LIMIT 1';
$admin = query_single_row($sql,false);
if ($admin) {
return newAdministrator($admin['user'], $admin['valid']);
} else {
return NULL;
}
}

$hash = $_zp_authority->passwordHash($user, $password);
$userobj = $_zp_authority->getAnAdmin(array('user=' => $user, 'pass=' => $hash, 'valid=' => 1));
echo 'Current User Object: '.$userobj.'';
$hashcheck = getAnAdmin(array('user=' => $user, 'valid=' => 1));
echo ("check hash: ".$userobj->get('passhash')).'';
$hash_type = getOption('strong_hash');
echo ("Hashtype: " .$hash_type).'';

Fatal error: Call to a member function get() on a non-object in /public_html/philbertphotos.com/signature/themes/ZenSignature/image.php on line 47

Member
Member
jphilbert   2013-04-15, 04:40
#2

For now I fixed the issue by using the function "getAnAdmin" I found someone using for ZenLdap and it fixes the problem even if it may not be the best way. This should correct aa lot of login issues that myself and others were having.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.