if ($luna_config['o_maintenance'] && $luna_user['g_id'] > FORUM_ADMIN && !defined('FORUM_TURN_OFF_MAINT')) { maintenance_message(); } // Load cached bans if (file_exists(FORUM_CACHE_DIR . 'cache_bans.php')) { include FORUM_CACHE_DIR . 'cache_bans.php'; } if (!defined('FORUM_BANS_LOADED')) { if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) { require FORUM_ROOT . 'include/cache.php'; } generate_bans_cache(); require FORUM_CACHE_DIR . 'cache_bans.php'; } // Check if current user is banned check_bans(); // Update online list update_users_online(); // Check to see if we logged in without a cookie being set if ($luna_user['is_guest'] && isset($_GET['login'])) { message(__('You appear to have logged in successfully, however a cookie has not been set. Please check your settings and if applicable, enable cookies for this website.', 'luna')); } // The maximum size of a comment, in bytes, since the field is now MEDIUMTEXT this allows ~16MB but lets cap at 1MB... if (!defined('FORUM_MAX_POSTSIZE')) { define('FORUM_MAX_POSTSIZE', 1048576); } if (!defined('FORUM_SEARCH_MIN_WORD')) { define('FORUM_SEARCH_MIN_WORD', 3); } if (!defined('FORUM_SEARCH_MAX_WORD')) { define('FORUM_SEARCH_MAX_WORD', 20);
ob_start('ob_gzhandler'); } else { ob_start(); } } // Check/update/set cookie and fetch user info $pun_user = array(); check_cookie($pun_user); // Attempt to load the common language file @(include PUN_ROOT . 'lang/' . $pun_user['language'] . '/common.php'); if (!isset($lang_common)) { exit('There is no valid language pack \'' . pun_htmlspecialchars($pun_user['language']) . '\' installed. Please reinstall a language of that name.'); } // Check if we are to display a maintenance message if ($pun_config['o_maintenance'] && $pun_user['g_id'] > PUN_ADMIN && !defined('PUN_TURN_OFF_MAINT')) { maintenance_message(); } // Load cached bans @(include PUN_ROOT . 'cache/cache_bans.php'); if (!defined('PUN_BANS_LOADED')) { require_once PUN_ROOT . 'include/cache.php'; generate_bans_cache(); require PUN_ROOT . 'cache/cache_bans.php'; } // Check if current user is banned if (!isset($show_ban_message)) { $show_ban_message = true; } check_bans($show_ban_message); // Update online list update_users_online();
function userlogin() { global $INSTALLER09, $mc1, $CURBLOCK, $mood, $whereis, $CURUSER; unset($GLOBALS["CURUSER"]); $dt = TIME_NOW; $ip = getip(); $nip = ip2long($ip); $ipf = $_SERVER['REMOTE_ADDR']; if (isset($CURUSER)) { return; } if (!$INSTALLER09['site_online'] || !get_mycookie('uid') || !get_mycookie('pass') || !get_mycookie('hashv')) { return; } $id = (int) get_mycookie('uid'); if (!$id or strlen(get_mycookie('pass')) != 32 or get_mycookie('hashv') != hashit($id, get_mycookie('pass'))) { return; } // let's cache $CURUSER - pdq - *Updated* if (($row = $mc1->get_value('MyUser_' . $id)) === false) { // $row not found $user_fields_ar_int = array('id', 'added', 'last_login', 'last_access', 'curr_ann_last_check', 'curr_ann_id', 'stylesheet', 'class', 'override_class', 'language', 'av_w', 'av_h', 'country', 'warned', 'torrentsperpage', 'topicsperpage', 'postsperpage', 'reputation', 'dst_in_use', 'auto_correct_dst', 'chatpost', 'smile_until', 'vip_until', 'freeslots', 'free_switch', 'reputation', 'invites', 'invitedby', 'uploadpos', 'forumpost', 'downloadpos', 'immunity', 'leechwarn', 'last_browse', 'sig_w', 'sig_h', 'forum_access', 'hit_and_run_total', 'donoruntil', 'donated', 'vipclass_before', 'passhint', 'avatarpos', 'sendpmpos', 'invitedate', 'anonymous_until', 'pirate', 'king', 'ssluse', 'paranoia', 'parked_until', 'bjwins', 'bjlosses', 'irctotal', 'last_access_numb', 'onlinetime', 'hits', 'comments', 'categorie_icon', 'perms', 'mood', 'pms_per_page', 'watched_user', 'game_access', 'opt1', 'opt2', 'can_leech', 'wait_time', 'torrents_limit', 'peers_limit', 'torrent_pass_version'); $user_fields_ar_float = array('time_offset', 'total_donated'); $user_fields_ar_str = array('username', 'passhash', 'secret', 'torrent_pass', 'email', 'status', 'editsecret', 'privacy', 'info', 'acceptpms', 'ip', 'avatar', 'title', 'notifs', 'enabled', 'donor', 'deletepms', 'savepms', 'show_shout', 'show_staffshout', 'shoutboxbg', 'vip_added', 'invite_rights', 'anonymous', 'disable_reason', 'clear_new_tag_manually', 'signatures', 'signature', 'highspeed', 'hnrwarn', 'parked', 'hintanswer', 'support', 'supportfor', 'invitees', 'invite_on', 'subscription_pm', 'gender', 'viewscloud', 'tenpercent', 'avatars', 'offavatar', 'hidecur', 'signature_post', 'forum_post', 'avatar_rights', 'offensive_avatar', 'view_offensive_avatar', 'google_talk', 'msn', 'aim', 'yahoo', 'website', 'icq', 'show_email', 'gotgift', 'hash1', 'suspended', 'warn_reason', 'onirc', 'birthday', 'got_blocks', 'pm_on_delete', 'commentpm', 'split', 'browser', 'got_moods', 'show_pm_avatar', 'watched_user_reason', 'staff_notes', 'where_is', 'forum_sort', 'browse_icons'); $user_fields = implode(', ', array_merge($user_fields_ar_int, $user_fields_ar_float, $user_fields_ar_str)); $res = sql_query("SELECT " . $user_fields . " " . "FROM users " . "WHERE id = " . sqlesc($id) . " " . "AND enabled='yes' " . "AND status = 'confirmed'") or sqlerr(__FILE__, __LINE__); if (mysqli_num_rows($res) == 0) { $salty = md5("Th15T3xtis5add3dto66uddy6he@water..." . $row['username'] . ""); header("Location: {$INSTALLER09['baseurl']}/logout.php?hash_please={$salty}"); //die; return; } $row = mysqli_fetch_assoc($res); foreach ($user_fields_ar_int as $i) { $row[$i] = (int) $row[$i]; } foreach ($user_fields_ar_float as $i) { $row[$i] = (double) $row[$i]; } foreach ($user_fields_ar_str as $i) { $row[$i] = $row[$i]; } $mc1->cache_value('MyUser_' . $id, $row, $INSTALLER09['expires']['curuser']); unset($res); } //== if (get_mycookie('pass') !== md5($row["passhash"] . $_SERVER["REMOTE_ADDR"])) { $salty = md5("Th15T3xtis5add3dto66uddy6he@water..." . $row['username'] . ""); header("Location: {$INSTALLER09['baseurl']}/logout.php?hash_please={$salty}"); //die; return; } // bans by djGrrr <3 pdq if (!isset($row['perms']) || !($row['perms'] & bt_options::PERMS_BYPASS_BAN)) { $banned = false; if (check_bans($ip, $reason)) { $banned = true; } else { if ($ip != $ipf) { if (check_bans($ipf, $reason)) { $banned = true; } } } if ($banned) { header('Content-Type: text/html; charset=utf-8'); echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <title>Forbidden</title> </head><body> <h1>403 Forbidden</h1>Unauthorized IP address! <p>Reason: <strong>' . htmlsafechars($reason) . '</strong></p> </body></html>'; die; } } // Allowed staff if ($row["class"] >= UC_STAFF) { $allowed_ID = $INSTALLER09['allowed_staff']['id']; if (!in_array((int) $row["id"], $allowed_ID, true)) { $msg = "Fake Account Detected: Username: "******"username"]) . " - UserID: " . (int) $row["id"] . " - UserIP : " . getip(); // Demote and disable sql_query("UPDATE users SET enabled = 'no', class = 0 WHERE id =" . sqlesc($row["id"])) or sqlerr(__FILE__, __LINE__); $mc1->begin_transaction('MyUser_' . $row['id']); $mc1->update_row(false, array('enabled' => 'no', 'class' => 0)); $mc1->commit_transaction($INSTALLER09['expires']['curuser']); $mc1->begin_transaction('user' . $row['id']); $mc1->update_row(false, array('enabled' => 'no', 'class' => 0)); $mc1->commit_transaction($INSTALLER09['expires']['user_cache']); write_log($msg); $salty = md5("Th15T3xtis5add3dto66uddy6he@water..." . $row['username'] . ""); header("Location: {$INSTALLER09['baseurl']}/logout.php?hash_please={$salty}"); die; } } // user stats - *Updated* $What_Cache = XBT_TRACKER == true ? 'userstats_xbt_' : 'userstats_'; if (($stats = $mc1->get_value($What_Cache . $id)) === false) { $What_Expire = XBT_TRACKER == true ? $INSTALLER09['expires']['u_stats_xbt'] : $INSTALLER09['expires']['u_stats']; $stats_fields_ar_int = array('uploaded', 'downloaded'); $stats_fields_ar_float = array('seedbonus'); $stats_fields_ar_str = array('modcomment', 'bonuscomment'); $stats_fields = implode(', ', array_merge($stats_fields_ar_int, $stats_fields_ar_float, $stats_fields_ar_str)); $s = sql_query("SELECT " . $stats_fields . " FROM users WHERE id=" . sqlesc($id)) or sqlerr(__FILE__, __LINE__); $stats = mysqli_fetch_assoc($s); foreach ($stats_fields_ar_int as $i) { $stats[$i] = (int) $stats[$i]; } foreach ($stats_fields_ar_float as $i) { $stats[$i] = (double) $stats[$i]; } foreach ($stats_fields_ar_str as $i) { $stats[$i] = $stats[$i]; } $mc1->cache_value($What_Cache . $id, $stats, $What_Expire); } $row['seedbonus'] = $stats['seedbonus']; $row['uploaded'] = $stats['uploaded']; $row['downloaded'] = $stats['downloaded']; //== if (($ustatus = $mc1->get_value('userstatus_' . $id)) === false) { $sql2 = sql_query('SELECT * FROM ustatus WHERE userid = ' . sqlesc($id)); if (mysqli_num_rows($sql2)) { $ustatus = mysqli_fetch_assoc($sql2); } else { $ustatus = array('last_status' => '', 'last_update' => 0, 'archive' => ''); } $mc1->add_value('userstatus_' . $id, $ustatus, $INSTALLER09['expires']['u_status']); // 30 days } $row['last_status'] = $ustatus['last_status']; $row['last_update'] = $ustatus['last_update']; $row['archive'] = $ustatus['archive']; //== if ($row['ssluse'] > 1 && !isset($_SERVER['HTTPS']) && !defined('NO_FORCE_SSL')) { $INSTALLER09['baseurl'] = str_replace('http', 'https', $INSTALLER09['baseurl']); header('Location: ' . $INSTALLER09['baseurl'] . $_SERVER['REQUEST_URI']); exit; } // bitwise curuser bloks by pdq $blocks_key = 'blocks::' . $row['id']; if (($CURBLOCK = $mc1->get_value($blocks_key)) === false) { $c_sql = sql_query('SELECT * FROM user_blocks WHERE userid = ' . sqlesc($row['id'])) or sqlerr(__FILE__, __LINE__); if (mysqli_num_rows($c_sql) == 0) { sql_query('INSERT INTO user_blocks(userid) VALUES(' . sqlesc($row['id']) . ')'); header('Location: index.php'); die; } $CURBLOCK = mysqli_fetch_assoc($c_sql); $CURBLOCK['index_page'] = (int) $CURBLOCK['index_page']; $CURBLOCK['global_stdhead'] = (int) $CURBLOCK['global_stdhead']; $CURBLOCK['userdetails_page'] = (int) $CURBLOCK['userdetails_page']; $mc1->cache_value($blocks_key, $CURBLOCK, 0); } //== where is by putyn $where_is['username'] = htmlsafechars($row['username']); $whereis_array = array('index' => '%s is viewing the <a href="%s">home page</a>', 'browse' => '%s is viewing the <a href="%s">torrents page</a>', 'requests' => '%s is viewing the <a href="%s">requests page</a>', 'upload' => '%s is viewing the <a href="%s">upload page</a>', 'casino' => '%s is viewing the <a href="%s">casino page</a>', 'blackjack' => '%s is viewing the <a href="%s">blackjack page</a>', 'bet' => '%s is viewing the <a href="%s">bet page</a>', 'forums' => '%s is viewing the <a href="%s">forums page</a>', 'chat' => '%s is viewing the <a href="%s">irc page</a>', 'topten' => '%s is viewing the <a href="%s">statistics page</a>', 'faq' => '%s is viewing the <a href="%s">faq page</a>', 'rules' => '%s is viewing the <a href="%s">rules page</a>', 'staff' => '%s is viewing the <a href="%s">staff page</a>', 'announcement' => '%s is viewing the <a href="%s">announcements page</a>', 'usercp' => '%s is viewing the <a href="%s">usercp page</a>', 'offers' => '%s is viewing the <a href="%s">offers page</a>', 'pm_system' => '%s is viewing the <a href="%s">mailbox page</a>', 'userdetails' => '%s is viewing the <a href="%s">personal profile page</a>', 'details' => '%s is viewing the <a href="%s">torrents details page</a>', 'unknown' => '%s location is unknown'); if (preg_match('/\\/(.*?)\\.php/is', $_SERVER['REQUEST_URI'], $whereis_temp)) { if (isset($whereis_array[$whereis_temp[1]])) { $whereis = sprintf($whereis_array[$whereis_temp[1]], $where_is['username'], htmlsafechars($_SERVER['REQUEST_URI'])); } else { $whereis = sprintf($whereis_array['unknown'], $where_is['username']); } } else { $whereis = sprintf($whereis_array['unknown'], $where_is['username']); } //== online time pdq, original code by superman $userupdate0 = 'onlinetime = onlinetime + 0'; $new_time = TIME_NOW - $row['last_access_numb']; $update_time = 0; if ($new_time < 300) { $userupdate0 = "onlinetime = onlinetime + " . $new_time; $update_time = $new_time; } $userupdate1 = "last_access_numb = " . TIME_NOW; //end online-time $update_time = $row['onlinetime'] + $update_time; //ip=".sqlesc($ip).", OR $row['ip'] !== $ip OR $row['ip'] == '', 'ip' => $ip, if ($row['last_access'] != '0' and $row['last_access'] < TIME_NOW - 180) { sql_query("UPDATE users SET where_is =" . sqlesc($whereis) . ", last_access=" . TIME_NOW . ", {$userupdate0}, {$userupdate1} WHERE id=" . sqlesc($row['id'])); $mc1->begin_transaction('MyUser_' . $row['id']); $mc1->update_row(false, array('last_access' => TIME_NOW, 'onlinetime' => $update_time, 'last_access_numb' => TIME_NOW, 'where_is' => $whereis)); $mc1->commit_transaction($INSTALLER09['expires']['curuser']); $mc1->begin_transaction('user' . $row['id']); $mc1->update_row(false, array('last_access' => TIME_NOW, 'onlinetime' => $update_time, 'last_access_numb' => TIME_NOW, 'where_is' => $whereis)); $mc1->commit_transaction($INSTALLER09['expires']['user_cache']); } //== if ($row['override_class'] < $row['class']) { $row['class'] = $row['override_class']; } // Override class and save in GLOBAL array below. $GLOBALS["CURUSER"] = $row; get_template(); $mood = create_moods(); }
function userlogin() { global $INSTALLER09, $mc1, $CURBLOCK, $mood, $whereis; unset($GLOBALS["CURUSER"]); $dt = TIME_NOW; $ip = getip(); $nip = ip2long($ip); $ipf = $_SERVER['REMOTE_ADDR']; if (isset($CURUSER)) { return; } if (!$INSTALLER09['site_online'] || !get_mycookie('uid') || !get_mycookie('pass') || !get_mycookie('hashv')) { return; } $id = 0 + get_mycookie('uid'); if (!$id or strlen(get_mycookie('pass')) != 32 or get_mycookie('hashv') != hashit($id, get_mycookie('pass'))) { return; } // let's cache $CURUSER - pdq if (($row = $mc1->get_value('MyUser_' . $id)) === false) { // $row not found $user_fields = 'id, username, passhash, secret, passkey, email, status, added, ' . 'last_login, last_access, curr_ann_last_check, curr_ann_id, editsecret, privacy, stylesheet, ' . 'info, acceptpms, ip, class, override_class, language, avatar, av_w, av_h, ' . 'title, country, notifs, enabled, donor, warned, torrentsperpage, topicsperpage, ' . 'postsperpage, deletepms, savepms, reputation, time_offset, dst_in_use, auto_correct_dst, ' . 'show_shout, show_staffshout, shoutboxbg, chatpost, smile_until, vip_added, vip_until, ' . 'freeslots, free_switch, invites, invitedby, invite_rights, anonymous, uploadpos, forumpost, ' . 'downloadpos, immunity, leechwarn, disable_reason, clear_new_tag_manually, last_browse, sig_w, ' . 'sig_h, signatures, signature, forum_access, highspeed, hnrwarn, hit_and_run_total, donoruntil, ' . 'donated, total_donated, vipclass_before, parked, passhint, hintanswer, avatarpos, support, ' . 'supportfor, sendpmpos, invitedate, invitees, invite_on, subscription_pm, gender, anonymous_until, ' . 'viewscloud, tenpercent, avatars, offavatar, pirate, king, hidecur, ssluse, signature_post, forum_post, ' . 'avatar_rights, offensive_avatar, view_offensive_avatar, paranoia, google_talk, msn, aim, yahoo, website, ' . 'icq, show_email, parked_until, gotgift, hash1, suspended, bjwins, bjlosses, warn_reason, onirc, irctotal, ' . 'birthday, got_blocks, last_access_numb, onlinetime, pm_on_delete, commentpm, split, browser, hits, ' . 'comments, categorie_icon, reputation, perms, mood, got_moods, pms_per_page, show_pm_avatar, watched_user, game_access, browse_icons'; $res = sql_query("SELECT " . $user_fields . " " . "FROM users " . "WHERE id = " . sqlesc($id) . " " . "AND enabled='yes' " . "AND status = 'confirmed'") or sqlerr(__FILE__, __LINE__); if (mysqli_num_rows($res) == 0) { logoutcookie(); return; } $row = mysqli_fetch_assoc($res); // Do all ints and floats $row['id'] = (int) $row['id']; $row['added'] = (int) $row['added']; $row['last_login'] = (int) $row['last_login']; $row['last_access'] = (int) $row['last_access']; $row['curr_ann_last_check'] = (int) $row['curr_ann_last_check']; $row['curr_ann_id'] = (int) $row['curr_ann_id']; $row['stylesheet'] = (int) $row['stylesheet']; $row['class'] = (int) $row['class']; $row['override_class'] = (int) $row['override_class']; $row['av_w'] = (int) $row['av_w']; $row['av_h'] = (int) $row['av_h']; $row['country'] = (int) $row['country']; $row['warned'] = (int) $row['warned']; $row['torrentsperpage'] = (int) $row['torrentsperpage']; $row['topicsperpage'] = (int) $row['topicsperpage']; $row['postsperpage'] = (int) $row['postsperpage']; $row['reputation'] = (int) $row['reputation']; $row['time_offset'] = (double) $row['time_offset']; $row['dst_in_use'] = (int) $row['dst_in_use']; $row['auto_correct_dst'] = (int) $row['auto_correct_dst']; $row['chatpost'] = (int) $row['chatpost']; $row['smile_until'] = (int) $row['smile_until']; $row['vip_until'] = (int) $row['vip_until']; $row['freeslots'] = (int) $row['freeslots']; $row['free_switch'] = (int) $row['free_switch']; $row['invites'] = (int) $row['invites']; $row['invitedby'] = (int) $row['invitedby']; $row['anonymous'] = $row['anonymous']; $row['uploadpos'] = (int) $row['uploadpos']; $row['forumpost'] = (int) $row['forumpost']; $row['downloadpos'] = (int) $row['downloadpos']; $row['immunity'] = (int) $row['immunity']; $row['leechwarn'] = (int) $row['leechwarn']; $row['last_browse'] = (int) $row['last_browse']; $row['sig_w'] = (int) $row['sig_w']; $row['sig_h'] = (int) $row['sig_h']; $row['forum_access'] = (int) $row['forum_access']; $row['hit_and_run_total'] = (int) $row['hit_and_run_total']; $row['donoruntil'] = (int) $row['donoruntil']; $row['donated'] = (int) $row['donated']; $row['total_donated'] = (double) $row['total_donated']; $row['vipclass_before'] = (int) $row['vipclass_before']; $row['passhint'] = (int) $row['passhint']; $row['avatarpos'] = (int) $row['avatarpos']; $row['language'] = (int) $row['language']; $row['sendpmpos'] = (int) $row['sendpmpos']; $row['invitedate'] = (int) $row['invitedate']; $row['anonymous_until'] = (int) $row['anonymous_until']; $row['pirate'] = (int) $row['pirate']; $row['king'] = (int) $row['king']; $row['ssluse'] = (int) $row['ssluse']; $row['paranoia'] = (int) $row['paranoia']; $row['parked_until'] = (int) $row['parked_until']; $row['bjwins'] = (int) $row['bjwins']; $row['bjlosses'] = (int) $row['bjlosses']; $row['irctotal'] = (int) $row['irctotal']; $row['last_access_numb'] = (int) $row['last_access_numb']; $row['onlinetime'] = (int) $row['onlinetime']; $row['categorie_icon'] = (int) $row['categorie_icon']; $row['perms'] = (int) $row['perms']; $row['mood'] = (int) $row['mood']; $row['watched_user'] = (int) $row['watched_user']; $row['pms_per_page'] = (int) $row['pms_per_page']; $row['game_access'] = (int) $row['game_access']; $row['rep'] = get_reputation($row); $mc1->cache_value('MyUser_' . $id, $row, $INSTALLER09['expires']['curuser']); unset($res); } //== if (get_mycookie('pass') !== md5($row["passhash"] . $_SERVER["REMOTE_ADDR"])) { logoutcookie(); return; } // bans by djGrrr <3 pdq if (!isset($row['perms']) || !($row['perms'] & bt_options::PERMS_BYPASS_BAN)) { $banned = false; if (check_bans($ip, $reason)) { $banned = true; } else { if ($ip != $ipf) { if (check_bans($ipf, $reason)) { $banned = true; } } } if ($banned) { header('Content-Type: text/html; charset=utf-8'); echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <title>Forbidden</title> </head><body> <h1>403 Forbidden</h1>Unauthorized IP address! <p>Reason: <strong>' . htmlsafechars($reason) . '</strong></p> </body></html>'; die; } } // Allowed staff if ($row["class"] >= UC_STAFF) { $allowed_ID = $INSTALLER09['allowed_staff']['id']; if (!in_array((int) $row["id"], $allowed_ID, true)) { $msg = "Fake Account Detected: Username: "******"username"]) . " - UserID: " . (int) $row["id"] . " - UserIP : " . getip(); // Demote and disable sql_query("UPDATE users SET enabled = 'no', class = 0 WHERE id =" . sqlesc($row["id"])) or sqlerr(__FILE__, __LINE__); $mc1->begin_transaction('MyUser_' . $row['id']); $mc1->update_row(false, array('enabled' => 'no', 'class' => 0)); $mc1->commit_transaction($INSTALLER09['expires']['curuser']); $mc1->begin_transaction('user' . $row['id']); $mc1->update_row(false, array('enabled' => 'no', 'class' => 0)); $mc1->commit_transaction($INSTALLER09['expires']['user_cache']); write_log($msg); logoutcookie(); } } // user stats if (($stats = $mc1->get_value('userstats_' . $id)) === false) { $sql = sql_query('SELECT uploaded, downloaded, seedbonus FROM users WHERE id = ' . sqlesc($id)) or sqlerr(__FILE__, __LINE__); $stats = mysqli_fetch_assoc($sql); $stats['seedbonus'] = (double) $stats['seedbonus']; $stats['uploaded'] = (double) $stats['uploaded']; $stats['downloaded'] = (double) $stats['downloaded']; $ratio = $stats['downloaded'] > 0 ? $stats['uploaded'] / $stats['downloaded'] : 0; $stats['ratio'] = number_format($ratio, 2); $mc1->cache_value('userstats_' . $id, $stats, $INSTALLER09['expires']['u_stats']); // 5 mins } $row['seedbonus'] = $stats['seedbonus']; $row['uploaded'] = $stats['uploaded']; $row['downloaded'] = $stats['downloaded']; $row['ratio'] = $stats['ratio']; //== if (($ustatus = $mc1->get_value('userstatus_' . $id)) === false) { $sql2 = sql_query('SELECT * FROM ustatus WHERE userid = ' . sqlesc($id)); if (mysqli_num_rows($sql2)) { $ustatus = mysqli_fetch_assoc($sql2); } else { $ustatus = array('last_status' => '', 'last_update' => 0, 'archive' => ''); } $mc1->add_value('userstatus_' . $id, $ustatus, $INSTALLER09['expires']['u_status']); // 30 days } $row['last_status'] = $ustatus['last_status']; $row['last_update'] = $ustatus['last_update']; $row['archive'] = $ustatus['archive']; //== if ($row['ssluse'] > 1 && !isset($_SERVER['HTTPS']) && !defined('NO_FORCE_SSL')) { $INSTALLER09['baseurl'] = str_replace('http', 'https', $INSTALLER09['baseurl']); header('Location: ' . $INSTALLER09['baseurl'] . $_SERVER['REQUEST_URI']); exit; } // bitwise curuser bloks by pdq $blocks_key = 'blocks::' . $row['id']; if (($CURBLOCK = $mc1->get_value($blocks_key)) === false) { $c_sql = sql_query('SELECT * FROM user_blocks WHERE userid = ' . sqlesc($row['id'])) or sqlerr(__FILE__, __LINE__); if (mysqli_num_rows($c_sql) == 0) { sql_query('INSERT INTO user_blocks(userid) VALUES(' . sqlesc($row['id']) . ')'); header('Location: index.php'); die; } $CURBLOCK = mysqli_fetch_assoc($c_sql); $CURBLOCK['index_page'] = (int) $CURBLOCK['index_page']; $CURBLOCK['global_stdhead'] = (int) $CURBLOCK['global_stdhead']; $CURBLOCK['userdetails_page'] = (int) $CURBLOCK['userdetails_page']; $mc1->cache_value($blocks_key, $CURBLOCK, 0); } //== online time pdq, original code by superman $userupdate0 = 'onlinetime = onlinetime + 0'; $new_time = TIME_NOW - $row['last_access_numb']; $update_time = 0; if ($new_time < 300) { $userupdate0 = "onlinetime = onlinetime + " . $new_time; $update_time = $new_time; } $userupdate1 = "last_access_numb = " . TIME_NOW; //end online-time $update_time = $row['onlinetime'] + $update_time; if ($row['last_access'] != '0' and $row['last_access'] < TIME_NOW - 180) { sql_query("UPDATE users SET last_access=" . TIME_NOW . ", {$userupdate0}, {$userupdate1} WHERE id=" . sqlesc($row['id'])); $mc1->begin_transaction('MyUser_' . $row['id']); $mc1->update_row(false, array('last_access' => TIME_NOW, 'onlinetime' => $update_time, 'last_access_numb' => TIME_NOW)); $mc1->commit_transaction($INSTALLER09['expires']['curuser']); $mc1->begin_transaction('user' . $row['id']); $mc1->update_row(false, array('last_access' => TIME_NOW, 'onlinetime' => $update_time, 'last_access_numb' => TIME_NOW)); $mc1->commit_transaction($INSTALLER09['expires']['user_cache']); } //== if ($row['override_class'] < $row['class']) { $row['class'] = $row['override_class']; } // Override class and save in GLOBAL array below. $GLOBALS["CURUSER"] = $row; get_template(); $mood = create_moods(); }