if ($LoggedUser['DisableWiki']) { unset($LoggedUser['Permissions']['site_edit_wiki']); } // IP changed if ($LoggedUser['IP'] != $_SERVER['REMOTE_ADDR'] && !check_perms('site_disable_ip_history')) { if (Tools::site_ban_ip($_SERVER['REMOTE_ADDR'])) { error('Your IP address has been banned.'); } $CurIP = db_string($LoggedUser['IP']); $NewIP = db_string($_SERVER['REMOTE_ADDR']); $DB->query("\n\t\t\tUPDATE users_history_ips\n\t\t\tSET EndTime = '" . sqltime() . "'\n\t\t\tWHERE EndTime IS NULL\n\t\t\t\tAND UserID = '{$LoggedUser['ID']}'\n\t\t\t\tAND IP = '{$CurIP}'"); $DB->query("\n\t\t\tINSERT IGNORE INTO users_history_ips\n\t\t\t\t(UserID, IP, StartTime)\n\t\t\tVALUES\n\t\t\t\t('{$LoggedUser['ID']}', '{$NewIP}', '" . sqltime() . "')"); $ipcc = Tools::geoip($NewIP); $DB->query("\n\t\t\tUPDATE users_main\n\t\t\tSET IP = '{$NewIP}', ipcc = '{$ipcc}'\n\t\t\tWHERE ID = '{$LoggedUser['ID']}'"); $Cache->begin_transaction('user_info_heavy_' . $LoggedUser['ID']); $Cache->update_row(false, array('IP' => $_SERVER['REMOTE_ADDR'])); $Cache->commit_transaction(0); } // Get stylesheets $Stylesheets = $Cache->get_value('stylesheets'); if (!is_array($Stylesheets)) { $DB->query(' SELECT ID, LOWER(REPLACE(Name, " ", "_")) AS Name, Name AS ProperName FROM stylesheets'); $Stylesheets = $DB->to_array('ID', MYSQLI_BOTH); $Cache->cache_value('stylesheets', $Stylesheets, 0); } //A9 TODO: Clean up this messy solution
$Cache->insert_front($SessionID, array('SessionID' => $SessionID, 'Browser' => $Browser, 'OperatingSystem' => $OperatingSystem, 'IP' => $_SERVER['REMOTE_ADDR'], 'LastUpdate' => sqltime())); $Cache->commit_transaction(0); } // IP changed if ($LoggedUser['IP'] != $_SERVER['REMOTE_ADDR'] && !check_perms('site_disable_ip_history')) { if (site_ban_ip($_SERVER['REMOTE_ADDR'])) { error('Your IP has been banned.'); } $CurIP = db_string($LoggedUser['IP']); $NewIP = db_string($_SERVER['REMOTE_ADDR']); $DB->query("UPDATE users_history_ips SET\n\t\t\t\tEndTime='" . sqltime() . "'\n\t\t\t\tWHERE EndTime IS NULL\n\t\t\t\tAND UserID='{$LoggedUser['ID']}'\n\t\t\t\tAND IP='{$CurIP}'"); $DB->query("INSERT IGNORE INTO users_history_ips\n\t\t\t\t(UserID, IP, StartTime) VALUES\n\t\t\t\t('{$LoggedUser['ID']}', '{$NewIP}', '" . sqltime() . "')"); $ipcc = geoip($NewIP); $DB->query("UPDATE users_main SET IP='{$NewIP}', ipcc='" . $ipcc . "' WHERE ID='{$LoggedUser['ID']}'"); $Cache->begin_transaction('user_info_heavy_' . $LoggedUser['ID']); $Cache->update_row(false, array('IP' => $_SERVER['REMOTE_ADDR'])); $Cache->commit_transaction(0); // ASN/Country changed? $Attributes = get_asn($_SERVER['REMOTE_ADDR']); $ASN = $Attributes['asnum']; $Country = $Attributes['country']; $CIDR = $Attributes['cidr']; if (!empty($ASN) && $LoggedUser['ASN'] != $ASN) { $CurASN = db_string($LoggedUser['ASN']); $NewASN = db_string($ASN); /* if (!empty($CurASN) && !empty($NewASN)) { send_irc("privmsg #watched :!mod ASN change? $CurASN -> $NewASN | http://musiceye.tv/user.php?id=$LoggedUser[ID] (".$LoggedUser['Username'].")"); }*/ $DB->query("UPDATE users_history_asns SET\n\t\t\t\t\t\t\t\tEndTime='" . sqltime() . "'\n\t\t\t\t\t\t\t\tWHERE EndTime IS NULL\n\t\t\t\t\t\t\t\tAND UserID='{$LoggedUser['ID']}'\n\t\t\t\t\t\t\t\tAND ASN='{$CurASN}'"); $DB->query("INSERT IGNORE INTO users_history_asns\n\t\t\t\t\t\t\t\t(UserID, ASN, StartTime) VALUES\n\t\t\t\t\t\t\t\t('{$LoggedUser['ID']}', '{$NewASN}', '" . sqltime() . "')"); $DB->query("UPDATE users_main SET ASN='{$NewASN}' WHERE ID='{$LoggedUser['ID']}'");