-
- // Rebuild cache
- REBUILD_CACHE("admins", "admin");
-
- // Login has failed by default... ;-)
- $ret = "failed";
-
- // Password matches so login here
- if (LOGIN_ADMIN($admin_login, $data['password'])) {
- // All done now
- $ret = "done";
- } // END - if
- } elseif ((empty($salt)) && ($ret == "pass")) {
- // Something bad went wrong
- $ret = "failed";
- } elseif ($ret == "done") {
- // Try to login here if we have the old hashing way (sql_patches not installed?)
- if (!LOGIN_ADMIN($admin_login, $data['password'])) {
- // Something went wrong
- $ret = "failed";
- } // END - if
- }
-
- // Count login failture if admins extension version is 0.7.0+
- if (($ret == "pass") && (GET_EXT_VERSION("admins") >= "0.7.0")) {
- // Update counter
- SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET login_failtures=login_failtures+1,last_failture=NOW() WHERE login='%s' LIMIT 1",
- array($admin_login), __FILE__, __LINE__);
-
- // Rebuild cache
- REBUILD_CACHE("admins", "admin");
- } // END - if
-
- // Return the result
- //* DEBUG: */ die("RETURN=".$ret);
- return $ret;
-}
-
-// Try to login the admin by setting some session/cookie variables
-function LOGIN_ADMIN ($adminLogin, $passHash) {
- global $cacheInstance;
-
- // Reset failture counter on matching admins version
- if ((GET_EXT_VERSION("admins") >= "0.7.0") && ((EXT_VERSION_IS_OLDER("sql_patches", "0.3.6")) || (GET_EXT_VERSION("sql_patches") == ""))) {
- // Reset counter on out-dated sql_patches version
- SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET login_failtures=0,last_failture='0000-00-00 00:00:00' WHERE login='%s' LIMIT 1",
- array($adminLogin), __FILE__, __LINE__);
-
- // Rebuild cache
- REBUILD_CACHE("admins", "admin");