|
|
@ -42,51 +42,7 @@ class admin_auth { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function validateAccount($id) { |
|
|
|
function validateAccount($id) { |
|
|
|
/* can only do this after upgrade, which means |
|
|
|
/* can only do this after upgrade, which means |
|
|
|
* that the first login will always fail |
|
|
|
|
|
|
|
$query |
|
|
|
|
|
|
|
= ' select id, disabled,password,privileges' |
|
|
|
|
|
|
|
. ' from %s' |
|
|
|
|
|
|
|
. ' where id = ?'; |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$query |
|
|
|
|
|
|
|
= ' select id, disabled,password' |
|
|
|
|
|
|
|
. ' from %s' |
|
|
|
|
|
|
|
. ' where id = ?'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$query = sprintf($query, $GLOBALS['tables']['admin']); |
|
|
|
|
|
|
|
$req = Sql_Query_Params($query, array($id)); |
|
|
|
|
|
|
|
$data = Sql_Fetch_Row($req); |
|
|
|
|
|
|
|
if (!$data[0]) { |
|
|
|
|
|
|
|
return array(0,s("No such account")); |
|
|
|
|
|
|
|
} elseif ($data[1]) { |
|
|
|
|
|
|
|
return array(0,s("your account has been disabled")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## do this seperately from above, to avoid lock out when the DB hasn't been upgraded. |
|
|
|
|
|
|
|
## so, ignore the error |
|
|
|
|
|
|
|
$query |
|
|
|
|
|
|
|
= ' select privileges' |
|
|
|
|
|
|
|
. ' from %s' |
|
|
|
|
|
|
|
. ' where id = ?'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$query = sprintf($query, $GLOBALS['tables']['admin']); |
|
|
|
|
|
|
|
$req = Sql_Query_Params($query, array($id),1); |
|
|
|
|
|
|
|
if ($req) { |
|
|
|
|
|
|
|
$data = Sql_Fetch_Row($req); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$data = array(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($data[0])) { |
|
|
|
|
|
|
|
$_SESSION['privileges'] = unserialize($data[0]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return array(1,"OK"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function validateAccount($id) { |
|
|
|
|
|
|
|
/* can only do this after upgrade, which means |
|
|
|
|
|
|
|
* that the first login will always fail |
|
|
|
* that the first login will always fail |
|
|
|
$query |
|
|
|
$query |
|
|
|
= ' select id, disabled,password,privileges' |
|
|
|
= ' select id, disabled,password,privileges' |
|
|
|