define('SERVER_URL', "http://www.mxchange.org");
// This current patch level
-define('CURR_SVN_REVISION', "330");
+define('CURR_SVN_REVISION', "331");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
foreach ($INC_POOL as $inc) {
require_once($inc);
} // END - foreach
- }
+ } // END - if
// Register extension
$result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_extensions (ext_name, ext_lang_file, ext_active, ext_version) VALUES ('%s', '%s', '%s', '%s')",
ADMIN_SOLVE_TASK($id);
// In normal mode return a true on success
- $ret = true; unset($SQLs);
+ $ret = true;
+
+ // Remove SQLs
+ unset($SQLs);
} else {
// Rewrite SQL command to keep { and } inside
foreach ($SQLs as $key => $sql) {
// Check cache
if ((!empty($cacheArray['extensions']['ext_active'][$ext_name])) && (!$ignore_cache)) {
// Load from cache
- //* DEBUG: */ echo "CACHE!<br />\n";
+ //* DEBUG: */ echo "CACHE! ext_name={$ext_name}<br />\n";
$active = $cacheArray['extensions']['ext_active'][$ext_name];
// Count cache hits
if (isset($_CONFIG['cache_hits'])) $_CONFIG['cache_hits']++;
} elseif (($ext_name == "cache") || (GET_EXT_VERSION("cache") == "")) {
- //* DEBUG: */ echo "DB!<br />\n";
+ //* DEBUG: */ echo "DB! ext_name={$ext_name}<br />\n";
// Load from database
$result = SQL_QUERY_ESC("SELECT ext_active FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
array($ext_name), __FILE__, __LINE__);
$SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_stats ADD is_stats ENUM('Y', 'N') NOT NULL DEFAULT 'N'";
// Update notes (these will be set as task text!)
- $UPDATE_NOTES = "Bonus-{!POINTS!} für: Mailbestellung, Referral-Werbung (bei Best. der EMail-Adresse) und wenn 100% Klickrate jeder Mailbuchung erreicht wurde.<br>Template <u>admin_config_bonus_pro.tpl</u> ist überflüssig geworden. Bitte löschen Sie dies!<br>Eingestellte Bonus-{!POINTS!} für Rank 2 war um eins verschoben.";
+ $UPDATE_NOTES = "Bonus-{!POINTS!} für: Mailbestellung, Referral-Werbung (bei Best. der EMail-Adresse) und wenn 100% Klickrate jeder Mailbuchung erreicht wurde.<br />Template <u>admin_config_bonus_pro.tpl</u> ist überflüssig geworden. Bitte löschen Sie dies!<br />Eingestellte Bonus-{!POINTS!} für Rank 2 war um eins verschoben.";
break;
case "0.4.5": // SQL queries for v0.4.5
$SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD doubler_sent_all ENUM('Y', 'N') NOT NULL DEFAULT 'Y'";
// Update notes (these will be set as task text!)
- $UPDATE_NOTES = "Gebührenabzug wird beim Einzahlen abgezogen (wurde von Auszahlung abgezogen) und maximal bei Auszahlung zu kontrollierende Accounts einstellbar.<br>Template <u>admin_config_doubler_pro.tpl</u> ist überflüssig geworden. Bitte löschen Sie dies!";
+ $UPDATE_NOTES = "Gebührenabzug wird beim Einzahlen abgezogen (wurde von Auszahlung abgezogen) und maximal bei Auszahlung zu kontrollierende Accounts einstellbar.<br />Template <u>admin_config_doubler_pro.tpl</u> ist überflüssig geworden. Bitte löschen Sie dies!";
break;
case "0.0.7": // SQL queries for v0.0.7
$SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES('setup', 'config_mediadata', 'Mediendaten', 'Stellen Sie allgemeine Einstellungen zu den Mediendaten ein.', 10)";
// Update notes (these will be set as task text!)
- $UPDATE_NOTES = "Start des ".MT_WORD2." und Anzahl Anmeldungen aufgenommen. (Task #13)<br>
+ $UPDATE_NOTES = "Start des ".MT_WORD2." und Anzahl Anmeldungen aufgenommen. (Task #13)<br />
Bitte stellen Sie diesen derzeit manuell unter <A href=\"".URL."/modules.php?module=admin&what=config_mediadata\">Einstellungen-Medidata</A> selber einstellen.";
break;
print("<pre>");
debug_print_backtrace();
die("</pre>URL={$URL}");
- */
+ /**/
@header ("Location: ".str_replace("&", "&", $URL));
} else {
// Output error message
// Generate SHA1 sum from modula of number and the prime number
$sha1 = sha1(($a % _PRIME).$server.":".$keys.":".$data.":".date("d-m-Y (l-F-T)", time()).":".$a);
- //* DEBUG: */ echo "SHA1=".$sha1." (".strlen($sha1).")<br>";
+ //* DEBUG: */ echo "SHA1=".$sha1." (".strlen($sha1).")<br />";
$sha1 = scrambleString($sha1);
- //* DEBUG: */ echo "Scrambled=".$sha1." (".strlen($sha1).")<br>";
+ //* DEBUG: */ echo "Scrambled=".$sha1." (".strlen($sha1).")<br />";
//* DEBUG: */ $sha1b = descrambleString($sha1);
- //* DEBUG: */ echo "Descrambled=".$sha1b." (".strlen($sha1b).")<br>";
+ //* DEBUG: */ echo "Descrambled=".$sha1b." (".strlen($sha1b).")<br />";
// Generate the password salt string
$salt = substr($sha1, 0, $_CONFIG['salt_length']);
}
$mod = substr(round($mod), 0, 4);
$mod = str_repeat('0', 4-strlen($mod)).$mod;
- //* DEBUG: */ echo "*".$start."=".$mod."*<br>";
+ //* DEBUG: */ echo "*".$start."=".$mod."*<br />";
$start += 4;
$newHash .= $mod;
} // END - for
- //* DEBUG: */ print($passHash."<br>".$newHash." (".strlen($newHash).")");
+ //* DEBUG: */ print($passHash."<br />".$newHash." (".strlen($newHash).")");
$ret = generateHash($newHash, $_CONFIG['master_salt']);
//* DEBUG: */ print($ret."<br />\n");
} else {
return session_register($var);
} elseif (!empty($value)) {
// Update session
+ //* DEBUG: */ echo "UPDATE:".$var."=".$value."<br />\n";
$_SESSION[$var] = $value;
- } else {
- // Something bad happens!
- return false; // Hope this doesn't make so much trouble???
+ return true;
}
- // Return always true if the session variable is already set.
- // Keept me busy for a longer while...
+ // Ignored (but valid)
//* DEBUG: */ echo "IGNORED:".$var."=".$value."<br />\n";
return true;
}
// Check wether a boolean constant is set
// Taken from user comments in PHP documentation for function constant()
-function isBooleanConstantAndTrue($constname) { // : Boolean
+function isBooleanConstantAndTrue($constName) { // : Boolean
+ global $constCache;
+
+ // Failed by default
$res = false;
- if (defined($constname)) $res = (constant($constname) === true);
- return($res);
+
+ // In cache?
+ if (isset($constCache[$constName])) {
+ // Use cache
+ $res = $constCache[$constName];
+ } else {
+ // Check constant
+ if (defined($constName)) $res = (constant($constName) === true);
+
+ // Set cache
+ $constCache[$constName] = $res;
+ }
+
+ // Return value
+ return $res;
}
// Check wether a session variable is set
function isSessionVariableSet($var) {
+ //* DEBUG: */ echo __FUNCTION__.":var={$var}<br />\n";
return (isset($_SESSION[$var]));
}
// Returns wether the value of the session variable or NULL if not set
// Return float
return $float;
}
+// Handle menu-depending failed logins and return the rendered content
+function HANDLE_LOGIN_FAILTURES ($accessLevel) {
+ // Default output is empty ;-)
+ $OUT = "";
+
+ // Is the session data set?
+ if ((isSessionVariableSet('mxchange_'.$accessLevel.'_failtures')) && (isSessionVariableSet('mxchange_'.$accessLevel.'_last_fail'))) {
+ // Ignore zero values
+ if (get_session('mxchange_'.$accessLevel.'_failtures') > 0) {
+ // Non-guest has login failtures found, get both data and prepare it for template
+ //* DEBUG: */ echo __FUNCTION__.":accessLevel={$accessLevel}<br />\n";
+ $content = array(
+ 'login_failtures' => get_session('mxchange_'.$accessLevel.'_failtures'),
+ 'last_failture' => MAKE_DATETIME(get_session('mxchange_'.$accessLevel.'_last_fail'), "2")
+ );
+
+ // Load template
+ $OUT = LOAD_TEMPLATE("login_failtures", true, $content);
+ } // END - if
+
+ // Reset session data
+ set_session('mxchange_'.$accessLevel.'_failtures', "");
+ set_session('mxchange_'.$accessLevel.'_last_fail', "");
+ } // END - if
+
+ // Return rendered content
+ return $OUT;
+}
+// Rebuild cache
+function REBUILD_CACHE ($cache, $inc="") {
+ global $cacheInstance;
+
+ // Shall I remove the cache file?
+ if ((EXT_IS_ACTIVE("cache")) && (is_object($cacheInstance))) {
+ // Rebuild cache
+ if ($cacheInstance->cache_file("admins", true)) {
+ // Destroy it
+ $cacheInstance->cache_destroy();
+
+ // Include file given?
+ if (!empty($inc)) {
+ // And rebuild it from scratch
+ require_once(PATH."inc/loader/load_cache-".$inc.".php");
+ } // END - if
+ } // END - if
+ } // END - if
+}
//
//////////////////////////////////////////////////
// //
//* DEBUG: */ unlink($file);
//* DEBUG: */ $test = hexdec(get_session('u_hash')) / hexdec($secretKey);
//* DEBUG: */ $test = generateHash(str_replace('.', "", $test));
- //* DEBUG: */ die("Secret-Key: ".$secretKey."<br>Cookie: ".get_session('u_hash')."<br>Test: ".$test);
+ //* DEBUG: */ die("Secret-Key: ".$secretKey."<br />Cookie: ".get_session('u_hash')."<br />Test: ".$test);
// Write $file_hash to database
UPDATE_CONFIG("file_hash", $file_hash);
define('SPONSOR_REGISTRATION_FAILED', "Anmeldung ist fehlgeschlagen!");
define('SPONSOR_REGISTRATION_COMPLETED', "Anmeldung war erfolgreich! Es ist eine Mail zu Ihnen unterwegs, die weitere Anweisungen enthält, um die Anmeldung abzuschliessen.");
define('SPONSOR_UNKOWN_STATUS_1', "Bei der Anmeldung wurde ein unbekannter Rückgabewert <U>");
-define('SPONSOR_UNKOWN_STATUS_2', "</U> erkannt. Bitte melden Sie dies dem Betreiber dieses ".MT_WORD2."!<BR>Vielen Dank.");
+define('SPONSOR_UNKOWN_STATUS_2', "</U> erkannt. Bitte melden Sie dies dem Betreiber dieses ".MT_WORD2."!<br />Vielen Dank.");
define('SPONSOR_EMAIL_404_1', "Bei der Anmeldung ist uns ein Fehler unterlaufen: Ihr Sponsor-Account mit der EMail-Adresse <U>");
define('SPONSOR_EMAIL_404_2', "</U> wurde nicht gefunden!");
define('SPONSOR_ACCOUNT_404', "Sponsorenaccount nicht gefunden oder Link ist ungütig. Oder haben Sie bereits den Bestätigungslink angeklickt?");
// Free memory
SQL_FREERESULT($result_admins);
+
+ // Reload the cache
+ require(__FILE__);
}
// Close file
// Free memory
SQL_FREERESULT($result);
+
+ // Reload the cache
+ require(__FILE__);
}
// Close file
// Free memory
SQL_FREERESULT($result);
+
+ // Reload the cache
+ require(__FILE__);
}
// Close file
// Free memory
SQL_FREERESULT($result);
+
+ // Reload the cache
+ require(__FILE__);
}
// Close file
// Free memory
SQL_FREERESULT($result);
+
+ // Reload the cache
+ require(__FILE__);
}
// Close file
$cacheInstance->cache_close();
-// Next cached table is the referral system (admins_acls)...
-if (GET_EXT_VERSION("admins") >= "0.3") {
- // Check for cache file
- if ($cacheInstance->cache_file("admins_acls", true) == true) {
- // Load referral system from cache
- global $cacheArray;
- $cacheArray['admin_acls'] = $cacheInstance->cache_load();
-
- // Valid cache file
- $CNT = 0;
- foreach ($cacheArray['admin_acls'] as $k => $array) {
- $CNT += count($array);
- }
-
- // When there is a period (.) in the result this test will fail and so the cache file is
- // damaged/corrupted
- if (count($cacheArray['admin_acls']) > 0) {
- $TEST = "failed";
- if (count($cacheArray['admin_acls']) > 0 ) $TEST = ($CNT / (count($cacheArray['admin_acls'])));
- if ($TEST != bigintval($TEST)) {
- // Cache file is corrupted!
- $cacheInstance->cache_destroy();
- unset($cacheArray['admin_acls']);
- }
- }
- } elseif (($_CONFIG['cache_acls'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
- // Create cache file here
- $cacheInstance->cache_init("ADMINS_ACLS");
-
- // Load all modules and their data
- $result = SQL_QUERY("SELECT id, admin_id, action_menu, what_menu, access_mode FROM "._MYSQL_PREFIX."_admins_acls ORDER BY admin_id, action_menu, what_menu", __FILE__, __LINE__);
- while ($DATA = SQL_FETCHARRAY($result)) {
- // Add row to cache file
- $cacheInstance->add_row($DATA);
- }
-
- // Free memory
- SQL_FREERESULT($result);
- }
-
- // Close file
- $cacheInstance->cache_close();
-}
-
//
?>
// Free memory
SQL_FREERESULT($result);
+
+ // Reload the cache
+ require(__FILE__);
}
// Close file
}
}
-if (isBooleanConstantAndTrue('admin_registered'))
-{
+if (isBooleanConstantAndTrue('admin_registered')) {
// Check config.php and inc directory for right access rights
if (is_INCWritable("config")) ADD_FATAL(FATAL_CONFIG_WRITABLE);
if (is_INCWritable("dummy")) ADD_FATAL(FATAL_INC_WRITABLE);
// Add description as navigation point
ADD_DESCR("admin", basename(__FILE__));
-OUTPUT_HTML("</FONT><br /><br />");
if (!empty($_POST['no'])) {
// Do not logout now
function CHECK_ADMIN_LOGIN ($admin_login, $password)
{
global $cacheArray, $_CONFIG, $cacheInstance;
- $ret = "404"; $pass = "";
+
+ // Init variables
+ $ret = "404";
+ $data = array();
+
+ // Is the cache valid?
if (!empty($cacheArray['admins']['aid'][$admin_login])) {
// Get password from cache
- $pass = $cacheArray['admins']['password'][$admin_login];
+ $data['password'] = $cacheArray['admins']['password'][$admin_login];
$ret = "pass";
$_CONFIG['cache_hits']++;
- } else {
+
+ // Include more admins data?
+ if (GET_EXT_VERSION("admins") >= "0.7.0") {
+ // Load them here
+ $data['login_failtures'] = $cacheArray['admins']['login_failtures'][$admin_login];
+ $data['last_failture'] = $cacheArray['admins']['last_failture'][$admin_login];
+ } // END - if
+ } elseif (GET_EXT_VERSION("cache") == "") {
$ADD = "";
if (GET_EXT_VERSION("admins") >= "0.7.0") {
// Load them here
}
//* DEBUG: */ echo "*".$data['password']."/".md5($password)."/".$ret."<br />";
- if ((strlen($data['password']) == 32) && ($data['password'] == md5($password))) {
+ if ((isset($data['password'])) && (strlen($data['password']) == 32) && ($data['password'] == md5($password))) {
// Generate new hash
$data['password'] = generateHash($password);
} elseif ((GET_EXT_VERSION("sql_patches") < "0.3.6") || (GET_EXT_VERSION("sql_patches") == "")) {
// Old hashing way
return $ret;
+ } elseif (!isset($data['password'])) {
+ // Password not found, so no valid login!
+ return $ret;
}
// Generate salt of password
// Check if password is same
//* DEBUG: */ echo "*".$ret.",".$data['password'].",".$password.",".$salt."*<br >\n";
- if (($ret == "pass") && ($data['password'] == generateHash($password, $salt)) && (!empty($salt))) {
- // Change the passord hash here
+ if (($ret == "pass") && ($data['password'] == generateHash($password, $salt)) && (!empty($salt))) {
+ // Re-hash the plain passord with new random salt
$data['password'] = generateHash($password);
// Do we have 0.7.0 of admins or later?
// Remmeber login failtures if available
if (GET_EXT_VERSION("admins") >= "0.7.0") {
// Store it in session
- set_session("mxchange_admin_failtures", $data['login_failtures']);
- ses_session("mxchange_admin_last_fail", $data['last_failture']);
+ set_session('mxchange_admin_failtures', $data['login_failtures']);
+ set_session('mxchange_admin_last_fail', $data['last_failture']);
} // END - if
// Update password
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET password='%s' WHERE login='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET password='%s',login_failtures=0,last_failture='0000-00-00 00:00:00' WHERE login='%s' LIMIT 1",
array($data['password'], $admin_login), __FILE__, __LINE__);
- // Shall I remove the cache file?
- if ((EXT_IS_ACTIVE("cache")) && ($cacheInstance != false)) {
- if ($cacheInstance->cache_file("admins", true)) $cacheInstance->cache_destroy();
- } // END - if
+ // Rebuild cache
+ REBUILD_CACHE("admins", "admin");
// Login has failed by default... ;-)
$ret = "failed";
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") && ((GET_EXT_VERSION("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");
+ } // END - if
+
// Now set all session variables and return the result
return (
(
) && (
set_session("admin_last", time())
) && (
- set_session("admin_to", $_POST['timeout'])
+ set_session("admin_to", bigintval($_POST['timeout']))
)
);
}
$pass = $cacheArray['admins']['password'][$admin_login];
$ret = "pass";
$_CONFIG['cache_hits']++;
- } else {
+ } elseif (GET_EXT_VERSION("cache") == "") {
// Get password from DB
$result = SQL_QUERY_ESC("SELECT password FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1",
array($admin_login), __FILE__, __LINE__);
// Simply run generated SQL string
$result = SQL_QUERY($SQL, __FILE__, __LINE__);
- // Is the config table updated and the cache extension installed?
- if ((GET_EXT_VERSION("cache") >= "0.1.2") && ($tableName == "_config")) {
- // Remove it here...
- if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy();
- unset($cacheArray);
- } // END - if
+ // Rebuild cache
+ REBUILD_CACHE("config", "config");
// Settings saved
LOAD_TEMPLATE("admin_settings_saved", false, "<STRONG class=\"admin_done\">".SETTINGS_SAVED."</STRONG>");
$content = "<SPAN class=\"admin_done\">".SETTINGS_SAVED."</SPAN>";
// Destroy config cache file here...
- if (GET_EXT_VERSION("cache") >= "0.1.2")
- {
- if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy();
- unset($cacheArray);
- }
+ REBUILD_CACHE("config", "config");
}
else
{
if ($cacheInstance->cache_file("config" , true)) $cacheInstance->cache_destroy();
if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy();
if ($cacheInstance->cache_file("mod_reg" , true)) $cacheInstance->cache_destroy();
- }
+ } // END - if
} elseif (GET_EXT_VERSION($ext_name) != "") {
// Motify the admin that we have a problem here...
LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_REG_FAILED_ALREADY);
}
// Add description as navigation point
ADD_DESCR("admin", basename(__FILE__));
-OUTPUT_HTML("</FONT><br /><br />");
//
?>
}
// Add description as navigation point
ADD_DESCR("admin", basename(__FILE__));
-OUTPUT_HTML("</FONT><br /><br />");
//
?>
if (!empty($MSG)) {
// Output message
LOAD_TEMPLATE("admin_settings_saved", false, $MSG);
- OUTPUT_HTML("<BR>");
+ OUTPUT_HTML("<br />");
}
}
// Output message
LOAD_TEMPLATE("admin_settings_saved", false, $MSG);
- OUTPUT_HTML("<BR>");
+ OUTPUT_HTML("<br />");
} elseif ((isset($_POST['edit'])) || (isset($_POST['del']))) {
// Load all data
$OUT = ""; $SW = 2;
}
// Add seperator
- OUTPUT_HTML("<BR>");
+ OUTPUT_HTML("<br />");
}
// Begin listing of all pending sponsor accounts
// Add description as navigation point
ADD_DESCR("admin", basename(__FILE__));
-OUTPUT_HTML("</FONT><br /><br />");
// Count guests, members and admins
$result_guests = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_online WHERE is_admin='N' AND is_member='N'", __FILE__, __LINE__);
// Remmeber login failtures if available
if (GET_EXT_VERSION("sql_patches") >= "0.4.7") {
// Store it in session
- set_session("mxchange_member_failtures", $data['login_failtures']);
- ses_session("mxchange_member_last_fail", $data['last_failture']);
+ set_session('mxchange_member_failtures', $data['login_failtures']);
+ set_session('mxchange_member_last_fail', $data['last_failture']);
} // END - if
// Bonus is not given by default ;-)
$probe_nickname = false; $uid = false; $hash = "";
unset($login); unset($online);
-if ((!empty($GLOBALS['userid'])) && (isSessionVariableSet('u_hash')))
-{
+if ((!empty($GLOBALS['userid'])) && (isSessionVariableSet('u_hash'))) {
// Already logged in?
$uid = $GLOBALS['userid'];
} elseif ((!empty($_POST['id'])) && (!empty($_POST['password'])) && (isset($_POST['ok']))) {
// Set userid and crypt password when login data was submitted
- $probe_nickname = ((EXT_IS_ACTIVE("nickname")) && (("".round($_POST['id'])."") != $_POST['id']));
- if ($probe_nickname)
- {
+ $probe_nickname = ((EXT_IS_ACTIVE("nickname")) && (("".bigintval($_POST['id'])."") != $_POST['id']));
+ if ($probe_nickname === true) {
// Nickname entered
$uid = SQL_ESCAPE($_POST['id']);
} else {
if (IS_MEMBER()) {
// Login immidiately...
$URL = URL."/modules.php?module=login";
+} elseif ((isset($_POST['ok'])) && ("".$uid."" != "".$_POST['id']."")) {
+ // Invalid input (no nickname extension installed but nickname entered)
+ $ERROR = CODE_EXTENSION_PROBLEM;
} elseif (isset($_POST['ok'])) {
// Add last_login if available
$LAST = "";
// Check login data
$password = "";
- if ($probe_nickname) {
+ if ($probe_nickname === true) {
// Nickname entered
$result = SQL_QUERY_ESC("SELECT userid, password, last_online".$LAST." FROM "._MYSQL_PREFIX."_user_data WHERE nickname='%s' AND status='CONFIRMED' LIMIT 1",
array($uid), __FILE__, __LINE__);
list($uid2, $password, $online, $login) = SQL_FETCHROW($result);
- if (!empty($uid2)) $uid = $uid2;
+ if (!empty($uid2)) $uid = bigintval($uid2);
} else {
// Direct userid entered
$result = SQL_QUERY_ESC("SELECT userid, password, last_online".$LAST." FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s AND status='CONFIRMED' LIMIT 1",
- array(bigintval($uid), $hash), __FILE__, __LINE__);
+ array($uid, $hash), __FILE__, __LINE__);
list($dmy, $password, $online, $login) = SQL_FETCHROW($result);
}
+
+ // Is there an entry?
if (SQL_NUMROWS($result) == 1) {
- // Valid data found so let's load the last login data
- if (isset($_POST['ok'])) {
- // By default the hash is empty
- $hash = "";
-
- // Check for old MD5 passwords
- if ((strlen($password) == 32) && (md5($_POST['password']) == $password)) {
- // Just set the hash to the password from DB... :)
- $hash = $password;
- } else {
- // Encrypt hash for comparsion
- $hash = generateHash($_POST['password'], substr($password, 0, -40));
- }
+ // By default the hash is empty
+ $hash = "";
- if ($hash == $password) {
- // New hashed password found so let's generate a new one
- $hash = generateHash($_POST['password']);
+ // Check for old MD5 passwords
+ if ((strlen($password) == 32) && (md5($_POST['password']) == $password)) {
+ // Just set the hash to the password from DB... :)
+ $hash = $password;
+ } else {
+ // Encrypt hash for comparsion
+ $hash = generateHash($_POST['password'], substr($password, 0, -40));
+ }
- // ... and update database
- $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET password='%s' WHERE userid=%s AND status='CONFIRMED' LIMIT 1",
- array($hash, $uid), __FILE__, __LINE__);
+ if ($hash == $password) {
+ // New hashed password found so let's generate a new one
+ $hash = generateHash($_POST['password']);
- // No login bonus by default
- $BONUS = false;
+ // ... and update database
+ $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET password='%s' WHERE userid=%s AND status='CONFIRMED' LIMIT 1",
+ array($hash, $uid), __FILE__, __LINE__);
- // Probe for last online timemark
- $probe = time() - $online;
- if (!empty($login)) $probe = time() - $login;
- if ((GET_EXT_VERSION("bonus") >= "0.2.2") && ($probe >= $_CONFIG['login_timeout'])) {
- // Add login bonus to user's account
- $ADD = ", login_bonus=login_bonus+'".$_CONFIG['login_bonus']."'";
- $BONUS = true;
+ // No login bonus by default
+ $BONUS = false;
- // Subtract login bonus from userid's account or jackpot
- if ((GET_EXT_VERSION("bonus") >= "0.3.5") && ($_CONFIG['bonus_mode'] != "ADD")) BONUS_POINTS_HANDLER('login_bonus');
- }
+ // Probe for last online timemark
+ $probe = time() - $online;
+ if (!empty($login)) $probe = time() - $login;
+ if ((GET_EXT_VERSION("bonus") >= "0.2.2") && ($probe >= $_CONFIG['login_timeout'])) {
+ // Add login bonus to user's account
+ $ADD = ", login_bonus=login_bonus+'".$_CONFIG['login_bonus']."'";
+ $BONUS = true;
+ // Subtract login bonus from userid's account or jackpot
+ if ((GET_EXT_VERSION("bonus") >= "0.3.5") && ($_CONFIG['bonus_mode'] != "ADD")) BONUS_POINTS_HANDLER('login_bonus');
+ } // END - if
- // Secure lifetime from input form
- $l = bigintval($_POST['lifetime']);
- $life = "-1";
- if ($l > 0) {
- // Calculate lifetime of cookies
- $life = time() + $l;
- // Calculate new hash with the secret key and master salt together
- $hash = generatePassString($hash);
+ // Secure lifetime from input form
+ $l = bigintval($_POST['lifetime']);
+ $life = "-1";
+ if ($l > 0) {
+ // Calculate lifetime of cookies
+ $life = time() + $l;
- // Update cookies
- $login = (set_session("userid" , $uid , $life, COOKIE_PATH)
- && set_session("u_hash" , $hash, $life, COOKIE_PATH)
- && set_session("lifetime", $l , $life, COOKIE_PATH));
+ // Calculate new hash with the secret key and master salt together
+ $hash = generatePassString($hash);
- // Update global array
- $GLOBALS['userid'] = bigintval($uid);
- } else {
- // Check for login data
- $login = IS_MEMBER();
- }
+ // Update cookies
+ $login = (set_session("userid" , $uid , $life, COOKIE_PATH)
+ && set_session("u_hash" , $hash, $life, COOKIE_PATH)
+ && set_session("lifetime", $l , $life, COOKIE_PATH));
+
+ // Update global array
+ $GLOBALS['userid'] = $uid;
+ } else {
+ // Check for login data
+ $login = IS_MEMBER();
+ }
- if ($login) {
- // Update database records
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET total_logins=total_logins+1".$ADD." WHERE userid=%s LIMIT 1",
- array(bigintval($uid)), __FILE__, __LINE__);
- if (SQL_AFFECTEDROWS() == 1) {
- // Procedure to checking for login data
- if (($BONUS) && (EXT_IS_ACTIVE("bonus"))) {
- // Bonus added (just displaying!)
- $URL = URL."/modules.php?module=chk_login&mode=bonus";
- } else {
- // Bonus not added
- $URL = URL."/modules.php?module=chk_login&mode=login";
- }
+ if ($login) {
+ // Update database records
+ $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET total_logins=total_logins+1".$ADD." WHERE userid=%s LIMIT 1",
+ array($uid), __FILE__, __LINE__);
+ if (SQL_AFFECTEDROWS() == 1) {
+ // Procedure to checking for login data
+ if (($BONUS) && (EXT_IS_ACTIVE("bonus"))) {
+ // Bonus added (just displaying!)
+ $URL = URL."/modules.php?module=chk_login&mode=bonus";
} else {
- // Cannot update counter!
- $URL = URL."/modules.php?module=".$GLOBALS['module']."&what=login&login=".CODE_CNTR_FAILED;
+ // Bonus not added
+ $URL = URL."/modules.php?module=chk_login&mode=login";
}
} else {
- // Cookies not setable!
- $URL = URL."/modules.php?module=".$GLOBALS['module']."&what=login&login=".CODE_NO_COOKIES;
+ // Cannot update counter!
+ $URL = URL."/modules.php?module=".$GLOBALS['module']."&what=login&login=".CODE_CNTR_FAILED;
}
} else {
- // Wrong password!
- $ERROR = CODE_WRONG_PASS;
+ // Cookies not setable!
+ $URL = URL."/modules.php?module=".$GLOBALS['module']."&what=login&login=".CODE_NO_COOKIES;
}
} else {
- // Fatal error!
- $ERROR = CODE_LOGIN_FAILED;
+ // Update failture counter
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET login_failtures=login_failtures+1,last_failture=NOW() WHERE userid=%s LIMIT 1",
+ array($uid), __FILE__, __LINE__);
+
+ // Wrong password!
+ $ERROR = CODE_WRONG_PASS;
}
} else {
// Other account status?
$result = SQL_QUERY_ESC("SELECT status FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
- array(bigintval($uid)), __FILE__, __LINE__);
+ array($uid), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1)
{
// Load status
$ERROR = CODE_UNKNOWN_STATUS;
break;
}
- }
- else
- {
+ } else {
// ID not found!
$ERROR = CODE_WRONG_ID;
}
// Construct URL
$URL = URL."/modules.php?module=".$GLOBALS['module']."&what=login&login=".$ERROR;
}
-}
- elseif ((!empty($_POST['new_pass'])) && (isset($uid)))
-{
+} elseif ((!empty($_POST['new_pass'])) && (isset($uid))) {
// Compile email when found in address (only secure chars!)
if (!empty($_POST['email'])) $_POST['email'] = str_replace("{DOT}", '.', $_POST['email']);
// Probe userid/nickname
$probe_nickname = ((EXT_IS_ACTIVE("nickname")) && (("".round($_POST['id'])."") != $_POST['id']));
- if ($probe_nickname)
- {
+ if ($probe_nickname) {
// Nickname entered
$result = SQL_QUERY_ESC("SELECT userid, status FROM "._MYSQL_PREFIX."_user_data WHERE nickname='%s' OR email='%s' LIMIT 1",
array(addslashes($uid), $_POST['email']), __FILE__, __LINE__);
- }
- else
- {
+ } else {
// Direct userid entered
$result = SQL_QUERY_ESC("SELECT userid, status FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s OR email='%s' LIMIT 1",
- array(bigintval($uid), $_POST['email']), __FILE__, __LINE__);
+ array($uid, $_POST['email']), __FILE__, __LINE__);
}
- if (SQL_NUMROWS($result) == 1)
- {
+
+ // Any entry found?
+ if (SQL_NUMROWS($result) == 1) {
// This data is valid, so we create a new pass... :-)
list($uid, $status) = SQL_FETCHROW($result);
- if ($status == "CONFIRMED")
- {
+ if ($status == "CONFIRMED") {
// Ooppps, this was missing! ;-) We should update the database...
$NEW_PASS = GEN_PASS();
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET password='%s' WHERE userid=%s LIMIT 1",
- array(generateHash($NEW_PASS), bigintval($uid)), __FILE__, __LINE__);
+ array(generateHash($NEW_PASS), $uid), __FILE__, __LINE__);
// Prepare data and message for email
- $msg = LOAD_EMAIL_TEMPLATE("new-pass", array('new_pass' => $NEW_PASS), bigintval($uid));
+ $msg = LOAD_EMAIL_TEMPLATE("new-pass", array('new_pass' => $NEW_PASS), $uid);
// ... and send it away
- SEND_EMAIL(bigintval($uid), GUEST_NEW_PASSWORD, $msg);
+ SEND_EMAIL($uid, GUEST_NEW_PASSWORD, $msg);
// Output note to user
LOAD_TEMPLATE("admin_settings_saved", false, GUEST_NEW_PASSWORD_SEND);
- }
- else
- {
+ } else {
// Account is locked or unconfirmed
- switch ($status)
- {
+ switch ($status) {
case "LOCKED" : $MSG = CODE_ID_LOCKED; break;
case "UNCONFIRMED": $MSG = CODE_ID_UNCONFIRMED; break;
}
// Load URL
LOAD_URL("modules.php?module=".$GLOBALS['module']."&what=login&login=".$MSG);
}
- }
- else
- {
+ } else {
// ID or email is wrong
LOAD_TEMPLATE("admin_settings_saved", false, "<SPAN class=\"guest_failed\">".GUEST_WRONG_ID_EMAIL."</SPAN>");
}
}
- else
-{
- // Login problems?
- if (!empty($_GET['login']))
- {
- // Ok, which one now?
- $MSG = "<TR>
+
+// Login problems?
+if (!empty($_GET['login'])) {
+ // Use code from URL
+ $ERROR = SQL_ESCAPE($_GET['login']);
+} // END - if
+
+// Login problems?
+if (!empty($ERROR)) {
+ // Ok, which one now?
+ $MSG = "<TR>
<TD width=\"10\"> </TD>
<TD colspan=\"7\" align=\"center\">
<STRONG><SPAN class=\"guest_failed\">";
- switch ($_GET['login'])
- {
+
+ switch ($ERROR) {
case CODE_WRONG_PASS:
$MSG .= LOGIN_WRONG_PASS;
break;
$MSG .= LOGIN_NO_COOKIES;
break;
+ case CODE_EXTENSION_PROBLEM:
+ if (IS_ADMIN()) {
+ $MSG .= sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "nickname");
+ } else {
+ $MSG .= LOGIN_WRONG_ID;
+ }
+ break;
+
default:
$MSG .= LOGIN_WRONG_ID;
break;
<TD width=\"10\"> </TD>
</TR>\n";
define('LOGIN_FAILURE_MSG', $MSG);
- }
- else
- {
- // No problems, no output
- define('LOGIN_FAILURE_MSG', "");
- }
- // Display login form with resend-password form
- if (EXT_IS_ACTIVE("nickname"))
- {
- LOAD_TEMPLATE("guest_nickname_login");
- }
- else
- {
- LOAD_TEMPLATE("guest_login");
- }
+} else {
+ // No problems, no output
+ define('LOGIN_FAILURE_MSG', "");
+}
+
+// Display login form with resend-password form
+if (EXT_IS_ACTIVE("nickname")) {
+ LOAD_TEMPLATE("guest_nickname_login");
+} else {
+ LOAD_TEMPLATE("guest_login");
}
// Was an URL constructed?
if (!empty($URL)) {
// URL was constructed
- if (!empty($FATAL[0]))
- {
+ if (!empty($FATAL[0])) {
// Fatal errors!
require_once(PATH."inc/fatal_errors.php");
} else {
// Load URL
LOAD_URL($URL);
}
-}
+} // END - if
//
?>
{
// Cookie setup failed!
LOAD_TEMPLATE("admin_settings_saved", false, SPONSPOR_COOKIE_SETUP_FAILED);
- OUTPUT_HTML("<BR>");
+ OUTPUT_HTML("<br />");
// Login formular and other links
LOAD_TEMPLATE("guest_sponsor_login");
$eval = "\$content = SPONSOR_LOGIN_FAILED_".strtoupper($status).";";
eval($eval);
LOAD_TEMPLATE("admin_settings_saved", false, $content);
- OUTPUT_HTML("<BR>");
+ OUTPUT_HTML("<br />");
// Login formular and other links
LOAD_TEMPLATE("guest_sponsor_login");
{
// Account missing or wrong pass! We shall not find this out for the "hacker folks"...
LOAD_TEMPLATE("admin_settings_saved", false, SPONSOR_LOGIN_FAILED_404_WRONG_PASS);
- OUTPUT_HTML("<BR>");
+ OUTPUT_HTML("<br />");
// Login formular and other links
LOAD_TEMPLATE("guest_sponsor_login");
{
$OUT .= "<TR>
<TD class=\"bottom2 switch_sw".$SW."\" height=\"50\" style=\"padding-left: 2px; padding-right: 2px\">
- <INPUT type=\"radio\" name=\"pay_type\" class=\"guest_normal\" value=\"".bigintval($id)."\"> ".$name."<BR>
+ <INPUT type=\"radio\" name=\"pay_type\" class=\"guest_normal\" value=\"".bigintval($id)."\"> ".$name."<br />
<DIV align=\"right\">(".$min." ".$curr." = ".TRANSLATE_COMMA($rate * $min)." ".POINTS.")</DIV>
</TD>
</TR>\n";
// Errors found
$OUT = "<P align=\"center\">
- <STRONG><FONT class=\"guest_failed\">".SPONSOR_REGISTER_SOMETHING_MISSING.":</FONT></STRONG><BR>
+ <STRONG><FONT class=\"guest_failed\">".SPONSOR_REGISTER_SOMETHING_MISSING.":</FONT></STRONG><br />
</P>
<OL>\n";
foreach ($FORM_ERRORS as $error)
{
$OUT .= "<LI>".$error."</LI>\n";
}
- $OUT .= "</OL><BR>\n";
+ $OUT .= "</OL><br />\n";
define('__SPONSOR_FORM_ERRORS', $OUT);
define('__SPONSOR_REFID', $_POST['refid']);
}
// Add description as navigation point
ADD_DESCR("member", basename(__FILE__));
-OUTPUT_HTML("</FONT><br />");
// Autopurge installed?
$LAST = "%s"; $ONLINE = "";
// Add description as navigation point
ADD_DESCR("member", basename(__FILE__));
-OUTPUT_HTML("</FONT><br />");
if (GET_EXT_VERSION("bonus") >= "0.6.9")
{
// Add description as navigation point
ADD_DESCR ("member", basename(__FILE__));
-OUTPUT_HTML("</FONT><br />");
// Export data for template
define('_LAST_ONLINE_VALUE', MAKE_DATETIME($LAST['online']));
} // END - if
// Destroy cache here
- if (GET_EXT_VERSION("cache") >= "0.1.2") {
- if ($cacheInstance->cache_file("mod_reg", true)) $cacheInstance->cache_destroy();
- unset($cacheArray['modules']);
- } // END - if
+ REBUILD_CACHE("mod_reg", "modreg");
// And reload data
$ret = CHECK_MODULE($mod_chk);
$prefix .= " -> ";
- if (ereg(".php", $search)) {
- $search = substr($search, 0, strpos($search, ".php"));
- }
+ // We need to remove .php and the end
+ if (substr($search, -4, 4) == ".php") {
+ // Remove the .php
+ $search = substr($search, 0, -4);
+ } // END - i
+ // Get the title from menu
$result = SQL_QUERY_ESC("SELECT title FROM "._MYSQL_PREFIX."_%s_menu WHERE %s='%s' ".$AND." LIMIT 1",
array($ACC_LVL, $type, $search), __FILE__, __LINE__);
} elseif (((GET_EXT_VERSION("sql_patches") >= "0.2.3") && ($_CONFIG['youre_here'] == "Y")) || ((IS_ADMIN()) && ($MOD_CHECK == "admin"))) {
// Output HTML code
$OUT = $prefix."<STRONG><A class=\"you_are_here\" href=\"".URL."/modules.php?module=".$MOD_CHECK."&".$type."=".$search.$LINK_ADD."\">".$ret."</A></STRONG>\n";
+
+ // Can we close the you-are-here navigation?
//* DEBUG: */ echo __LINE__."*".$type."/".$GLOBALS['what']."*<br />\n";
- if (($type == "what") || (($type == "action") && (!isset($_GET['what'])) && ($GLOBALS['what'] != "welcome"))) {
+ //* DEBUG: */ die("<pre>".print_r($_CONFIG, true)."</pre>");
+ if (($type == "what") || (($type == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview") || (($GLOBALS['what'] == $_CONFIG['index_home']) && ($ACC_LVL == "guest"))))) {
//* DEBUG: */ echo __LINE__."+".$type."+<br />\n";
$OUT .= "</DIV><br />\n";
$DEPTH="0";
// Handle failed logins here if not in guest
- if (($type != "guest") && (GET_EXT_VERSION("sql_patches") >= "0.4.7")) {
+ //* DEBUG: */ echo __FUNCTION__.":type={$type},action={$GLOBALS['action']},what={$GLOBALS['what']},lvl={$ACC_LVL}<br />\n";
+ if ((($type == "what") || ($type == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview") || ($GLOBALS['what'] == $_CONFIG['index_home']))) && ($ACC_LVL != "guest") && ((GET_EXT_VERSION("sql_patches") >= "0.4.7") || (GET_EXT_VERSION("admins") >= "0.7.0"))) {
// Handle failture
- $OUT .= HANDLE_LOGIN_FAILTURES($type);
+ $OUT .= HANDLE_LOGIN_FAILTURES($ACC_LVL);
} // END - if
} // END - if
}
}
// Return result of comparision
- //* DEBUG: */ if (!$ret) echo __LINE__."OK!<br>";
+ //* DEBUG: */ if (!$ret) echo __LINE__."OK!<br />";
return $ret;
}
//
if ((!empty($mod)) && (empty($LAST['module']))) { $LAST['module'] = $mod; $LAST['online'] = $onl; }
// So did we now have valid data and an unlocked user?
- //* DEBUG: */ echo $valPass."<br>".get_session('u_hash')."<br>";
+ //* DEBUG: */ echo $valPass."<br />".get_session('u_hash')."<br />";
if (($status == "CONFIRMED") && ($valPass == get_session('u_hash'))) {
// Account is confirmed and all cookie data is valid so he is definely logged in! :-)
$ret = true;
} else {
// Maybe got locked etc.
- //* DEBUG: */ echo __LINE__."!!!<br>";
+ //* DEBUG: */ echo __LINE__."!!!<br />";
destroy_user_session();
// Remove array elements to prevent errors
}
} else {
// Cookie data is invalid!
- //* DEBUG: */ echo __LINE__."***<br>";
+ //* DEBUG: */ echo __LINE__."***<br />";
// Remove array elements to prevent errors
unset($GLOBALS['userid']);
else
{
// Cookie data is invalid!
- //* DEBUG: */ echo __LINE__."///<br>";
+ //* DEBUG: */ echo __LINE__."///<br />";
destroy_user_session();
// Remove array elements to prevent errors
}
//
function UPDATE_LOGIN_DATA ($UPDATE=true) {
- global $LAST;
+ global $LAST, $_CONFIG;
if (!is_array($LAST)) $LAST = array();
// Are the required cookies set?
// This will be displayed on welcome page! :-)
if (empty($LAST['module'])) {
$LAST['module'] = $mod; $LAST['online'] = $onl;
- }
+ } // END - if
+
+ // "what" not set?
if (empty($GLOBALS['what'])) {
+ // Fix it to default
$GLOBALS['what'] = "welcome";
- }
+ if (!empty($_CONFIG['index_home'])) $GLOBALS['what'] = $_CONFIG['index_home'];
+ } // END - if
// Update last module / online time
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET last_module='%s', last_online=UNIX_TIMESTAMP() WHERE userid=%s LIMIT 1",
return $ret;
}
//
-function GET_MOD_DESCR($MODE, $wht)
+function GET_MOD_DESCR($MODE, $wht, $column="what")
{
- if (empty($wht)) $wht = "welcome";
+ // Fix empty "what"
+ if (empty($wht)) {
+ $wht = "welcome";
+ if (!empty($_CONFIG['index_home'])) $wht = $_CONFIG['index_home'];
+ } // END - if
+
+ // Default is not found
$ret = "??? (".$wht.")";
- $result = SQL_QUERY_ESC("SELECT title FROM "._MYSQL_PREFIX."_%s_menu WHERE what='%s' LIMIT 1", array($MODE, $wht), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+
+ // Look for title
+ $result = SQL_QUERY_ESC("SELECT title FROM "._MYSQL_PREFIX."_%s_menu WHERE %s='%s' LIMIT 1",
+ array($MODE, $column, $wht), __FILE__, __LINE__);
+
+ // Is there an entry?
+ if (SQL_NUMROWS($result) == 1) {
+ // Fetch the title
list($ret) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- }
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
return $ret;
}
//
// Get action value from mode (admin/guest/member) and what-value
function GET_ACTION ($MODE, &$wht)
{
- global $ret; $ret = "";
- //* DEBUG: */ echo __LINE__."=".$MODE."/".$wht."/".$GLOBALS['action']."=<br>";
- if ((empty($wht)) && ($MODE != "admin"))
- {
+ global $ret, $_CONFIG;
+ // DEPRECATED: Init status
+ $ret = "";
+
+ //* DEBUG: */ echo __LINE__."=".$MODE."/".$wht."/".$GLOBALS['action']."=<br />";
+ if ((empty($wht)) && ($MODE != "admin")) {
$wht = "welcome";
- }
- if ($MODE == "admin")
- {
+ if (!empty($_CONFIG['index_home'])) $wht = $_CONFIG['index_home'];
+ } // END - if
+
+ if ($MODE == "admin") {
// Action value for admin area
- if (!empty($GLOBALS['action']))
- {
+ if (!empty($GLOBALS['action'])) {
// Get it directly from URL
return $GLOBALS['action'];
- }
- elseif (($wht == "overview") || (empty($GLOBALS['what'])))
- {
+ } elseif (($wht == "overview") || (empty($GLOBALS['what']))) {
// Default value for admin area
$ret = "login";
}
- }
- elseif (!empty($GLOBALS['action']))
- {
- // Fix welcome value
- if (empty($wht)) $wht = "welcome";
+ } elseif (!empty($GLOBALS['action'])) {
+ // Get it directly from URL
return $GLOBALS['action'];
- }
- else
- {
+ } else {
// Everything else will be touched after checking the module has a menu assigned
}
//* DEBUG: */ echo __LINE__."*".$ret."*<br />\n";
// Load from database
$result = SQL_QUERY_ESC("SELECT action FROM "._MYSQL_PREFIX."_%s_menu WHERE what='%s' LIMIT 1",
array($MODE, $wht), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ if (SQL_NUMROWS($result) == 1) {
// Load action value and pray that this one is the right you want... ;-)
list($ret) = SQL_FETCHROW($result);
}
}
// Gets the matching what name from module
function GET_WHAT($MOD_CHECK) {
+ global $_CONFIG;
+
$wht = "";
//* DEBUG: */ echo __LINE__."!".$MOD_CHECK."!<br />\n";
switch ($MOD_CHECK)
case "login":
case "index":
$wht = "welcome";
+ if (($MOD_CHECK == "index") && (!empty($_CONFIG['index_home']))) $wht = $_CONFIG['index_home'];
break;
default:
$affectedRows = SQL_AFFECTEDROWS();
//* DEBUG: */ echo __FUNCTION__.":entries={$entries},affectedRows={$affectedRows}<br />\n";
- // Destroy cache?
- if ((GET_EXT_VERSION("cache") >= "0.1.2") && ($affectedRows == 1)) {
- global $cacheInstance, $_CONFIG, $CSS;
- if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy();
-
- // Rebuid the cache
- require(PATH."inc/loader/load_cache-config.php");
- } // END - if
+ // Rebuild cache
+ REBUILD_CACHE("config", "config");
}
// Creates a new task for updated extension
function CREATE_EXTENSION_UPDATE_TASK ($admin_id, $subject, $notes) {
// Free memory
SQL_FREERESULT($result);
}
-// Handle menu-depending failed logins and return the rendered content
-function HANDLE_LOGIN_FAILTURES ($menuType) {
- // Default output is empty ;-)
- $OUT = "";
-
- // Guest menus doesn't have login failtures so is the session data set?
- if (($menuType != "guest") && (isSessionVariableSet('mxchange_'.$menuType.'_failtures')) && (isSessionVariableSet('mxchange_'.$menuType.'_last_fail'))) {
- // Non-guest has login failtures found, get both data and prepare it for template
- $content = array(
- 'login_failtures' => get_session('mxchange_'.$menuType.'_failtures'),
- 'last_failture' => MAKE_DATETIME(get_session('mxchange_'.$menuType.'_last_fail'), "2")
- );
-
- // Load template
- $OUT = LOAD_TEMPLATE("login_failture", true, $content);
-
- // Reset session data
- set_session('mxchange_'.$menuType.'_failtures', "");
- set_session('mxchange_'.$menuType.'_last_fail', "");
- } // END - if
-
- // Return rendered content
- return $OUT;
-}
//
?>
.show_timings_data {
font-weight : bold;
}
+
+.login_failture_header {
+ background-color : #EEEEFF;
+ font-weight : bold;
+}
+
+.login_failtures {
+ width : 400px;
+}
.show_timings_column {
z-index : 10;
top : 3px;
- background-color : #EEFFEE;
+ background-color : #EEFFEE;
position : relative;
margin : 0px;
width : 150px;
display : block;
- border : solid 1px;
- border-color : #009900;
+ border : solid 1px;
+ border-color : #009900;
}
.show_timings_data {
font-weight : bold;
}
+
+.login_failture_header {
+ background-color : #ddeedd;
+ font-weight : bold;
+}
+
+.login_failtures {
+ width : 400px;
+}
.show_timings_data {
font-weight : bold;
}
+
+.login_failture_header {
+ background-color : #DDDDAA;
+ font-weight : bold;
+}
+
+.login_failtures {
+ width : 400px;
+}