function radioinfo($radio) { global $langs, $INSTALLER09, $mc1, $CURUSER; $xml = $html = $history = ''; if ($hand = @fsockopen($radio['host'], $radio['port'], $errno, $errstr, 30)) { fputs($hand, "GET /admin.cgi?pass="******"&mode=viewxml HTTP/1.1\nUser-Agent:Mozilla/5.0 " . "(Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6\n\n"); while (!feof($hand)) { $xml .= fgets($hand, 1024); } preg_match_all('/\\<(SERVERTITLE|SERVERURL|SONGTITLE|STREAMSTATUS|BITRATE|CURRENTLISTENERS|PEAKLISTENERS)\\>(.*?)<\\/\\1\\>/iU', $xml, $tempdata, PREG_SET_ORDER); foreach ($tempdata as $t2) { $data[$t2[1]] = isset($langs[$t2[1]]) ? sprintf($langs[$t2[1]], $t2[2]) : $t2[2]; } unset($tempdata); preg_match_all('/\\<SONG>(.*?)<\\/SONG\\>/', $xml, $temph); unset($temph[0][0], $temph[1]); $history = array(); foreach ($temph[0] as $temph2) { preg_match_all('/\\<(TITLE|PLAYEDAT)>(.*?)<\\/\\1\\>/i', $temph2, $temph3, PREG_PATTERN_ORDER); $history[] = '<b> ' . $temph3[2][1] . '</b> <sub>(' . get_date(time(), 'DATE', $temph3[2][0]) . ')</sub>'; } if ($data['STREAMSTATUS'] == 0) { return 'Sorry ' . $CURUSER['username'] . '... : Server ' . $radio['host'] . ' is online but there is no stream'; } else { unset($data['STREAMSTATUS']); $md5_current_song = md5($data['SONGTITLE']); $current_song = $mc1->get('current_radio_song'); if ($current_song === false || $current_song != $md5_current_song) { autoshout(str_replace(array('<', '>'), array('[', ']'), $data['SONGTITLE'] . ' playing on ' . strtolower($data['SERVERTITLE']) . ' - ' . strtolower($data['SERVERURL']))); $mc1->cache_value('current_radio_song', $md5_current_song, 0); } $html = '<fieldset> <legend>' . $INSTALLER09['site_name'] . ' radio</legend><ul>'; foreach ($data as $d) { $html .= '<li><b>' . $d . '</b></li>'; } $html .= '<li>Playlist history: ' . (count($history) > 0 ? join(', ', $history) : 'No playlist history'); $html .= '</li></ul></fieldset>'; return $html; } } else { $html .= '<fieldset><legend>' . $INSTALLER09['site_name'] . ' radio</legend> <font size="3" color="red"><img src="' . $INSTALLER09['pic_base_url'] . 'off1.gif" alt="Off" title="Off" border="0" /><br /> <b>Sorry ' . $CURUSER['username'] . ' Radio is currently Offline</b></font></fieldset><br />'; } return $html; }
$descrmain = isset($_POST['body']) ? $_POST['body'] : ''; if (!$descrmain) { stderr("{$lang['error_error']}", "{$lang['error_descr']}"); } $pic = ''; if (!empty($_POST['picture'])) { if (!preg_match('/^https?:\\/\\/([a-zA-Z0-9\\-\\_]+\\.)+([a-zA-Z]{1,5}[^\\.])(\\/[^<>]+)+\\.(jpg|jpeg|gif|png|tif|tiff|bmp)$/i', $_POST['picture'])) { stderr("{$lang['error_error']}", "{$lang['error_image']}"); } $picture = $_POST['picture']; // $picture2 = trim(urldecode($_POST['picture'])); // $headers = get_headers($picture2); // if (strpos($headers[0], '200') === false) // $picture = $INSTALLER09['baseurl'].'/pic/notfound.png'; $pic = "[img]" . $picture . "[/img]\n"; } $descr = "{$pic}"; $descr .= "{$descrmain}"; $request2 = sqlesc($request); $descr = sqlesc($descr); sql_query("INSERT INTO requests (hits, userid, cat, request, descr, added) VALUES(1,{$CURUSER['id']}, {$cat}, {$request2}, {$descr}, " . TIME_NOW . ")") or sqlerr(__FILE__, __LINE__); $id = mysql_insert_id(); sql_query("INSERT INTO voted_requests VALUES(0, {$id}, {$CURUSER['id']})") or sqlerr(); if ($INSTALLER09['karma'] && isset($CURUSER['seedbonus'])) { sql_query("UPDATE users SET seedbonus = seedbonus-" . $INSTALLER09['req_cost_bonus'] . " WHERE id = {$CURUSER['id']}") or sqlerr(__FILE__, __LINE__); } write_log("Request (" . $request . ") was added to the Request section by {$CURUSER['username']}"); /** Shout announce **/ $message = " [b][color=blue]New request[/color][/b] [url={$INSTALLER09['baseurl']}/viewrequests.php?id={$id}&req_details] " . $request . "[/url] "; autoshout($message); header("Refresh: 0; url=viewrequests.php?id={$id}&req_details");
$msg = $CURUSER['username'] . " Donated " . $donation . " karma point" . ($donation > 1 ? 's' : '') . " into the half download contribution pot and has activated half download for 3 days " . $donation . "/" . $points . ''; autoshout($msg); header("Refresh: 0; url={$INSTALLER09['baseurl']}/mybonus.php?halfdown_success=1&norefund={$norefund}"); die; } else { // add to the pool $sql = "UPDATE bonus SET pointspool = pointspool + '{$donation}' WHERE id = '13' LIMIT 1"; sql_query($sql) or sqlerr(__FILE__, __LINE__); $bonuscomment = get_date(time(), 'DATE', 1) . " - " . $points . " Points contributed for halfdownload.\n " . $bonuscomment; sql_query("UPDATE users SET seedbonus = " . sqlesc($seedbonus) . ", bonuscomment = " . sqlesc($bonuscomment) . " WHERE id = " . sqlesc($userid) . "") or sqlerr(__FILE__, __LINE__); $mc1->delete_value('MyUser_' . $CURUSER['id']); $mc1->delete_value('user' . $CURUSER['id']); write_bonus_log($CURUSER["id"], $donation, $type = "halfdownload"); $Remaining = $points - $donation; $msg = $CURUSER['username'] . " Donated " . $donation . " karma point" . ($donation > 1 ? 's' : '') . " into the half download contribution pot ! * Only [b]" . $Remaining . "[/b] more karma point" . ($Remaining > 1 ? 's' : '') . " to go! * [color=green][b]Half download contribution:[/b][/color] [url={$INSTALLER09['baseurl']}/mybonus.php]" . $donation . "/" . $points . '[/url]'; autoshout($msg); header("Refresh: 0; url={$INSTALLER09['baseurl']}/mybonus.php?halfdown_success=2"); die; } die; break; case 'ratio': //=== trade for one torrent 1:1 ratio $torrent_number = 0 + $_POST['torrent_id']; $res_snatched = sql_query("SELECT s.uploaded, s.downloaded, t.name FROM snatched AS s LEFT JOIN torrents AS t ON t.id = s.torrentid WHERE s.userid = '{$userid}' AND torrentid = " . sqlesc($torrent_number) . " LIMIT 1") or sqlerr(__FILE__, __LINE__); $arr_snatched = mysql_fetch_assoc($res_snatched); if ($arr_snatched['name'] == '') { stderr("Error", "No torrent with that ID!<br />Back to your <a class='altlink' href='{$INSTALLER09['baseurl']}/mybonus.php'>Karma Bonus Point</a> page."); } if ($arr_snatched['uploaded'] >= $arr_snatched['downloaded']) { stderr("Error", "Your ratio on that torrent is fine, you must have selected the wrong torrent ID.<br />Back to your <a class='altlink' href='{$INSTALLER09['baseurl']}/mybonus.php'>Karma Bonus Point</a> page.");
function dos2slowcleanup() { global $SITENAME, $DEFAULTBASEURL, $torrent_dir, $s2autoslowclean_interval, $READPOST_EXPIRY, $CACHE, $queries, $query_stat, $torrent_dir, $tdeadtime, $delaccounts, $oldtorrents, $slotduration, $max_dead_torrent_time, $max_dead_topic_time, $max_dead_user_time, $ad_ratio, $ap_time, $ap_limit, $ap_ratio, $torrent_ttl; set_time_limit(1200); $result = mysql_query("show processlist") or sqlerr(__FILE__, __LINE__); while ($row = mysql_fetch_array($result)) { if ($row["Time"] > 100 || $row["Command"] == "Sleep") { $sql = "kill " . $row["Id"] . ""; mysql_query($sql) or sqlerr(__FILE__, __LINE__); } } ignore_user_abort(1); // == updated remove expired warnings $res = sql_query("SELECT id FROM users WHERE warned='yes' AND warneduntil < NOW() AND warneduntil <> '0000-00-00 00:00:00'") or sqlerr(__FILE__, __LINE__); $msgs_buffer = $users_buffer = array(); if (mysql_num_rows($res) > 0) { $msg = "Your warning has been removed. Please keep in your best behaviour from now on.\n"; while ($arr = mysql_fetch_assoc($res)) { $modcomment = sqlesc(gmdate("Y-m-d H:i") . " - Warning Automatically Removed By System\n"); $msgs_buffer[] = '(0,' . $arr['id'] . ',NOW(), ' . sqlesc($msg) . ', \'Warning Removed\')'; $users_buffer[] = '(' . $arr['id'] . ',\'no\',\'0000-00-00 00:00:00\',' . $modcomment . ')'; } if (sizeof($msgs_buffer) > 0) { sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__); sql_query("INSERT INTO users (id, warned, warneduntil, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE warned=values(warned),\nwarneduntil=values(warneduntil),modcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__); $count = mysql_affected_rows(); write_log("autodewarn", "Delayed Cleanup: System Removed Warning(s) from " . $count / 2 . " Member(s)"); } unset($users_buffer); unset($msgs_buffer); } // == snuggs donation progress //== updated // === remove karma vip - change class to whatever is under your vip class number $res = sql_query("SELECT id, modcomment FROM users WHERE vip_added='yes' AND vip_until < NOW()") or sqlerr(__FILE__, __LINE__); $msgs_buffer = $users_buffer = array(); if (mysql_num_rows($res) > 0) { $subject = "VIP status removed by system."; $msg = "Your VIP status has timed out and has been auto-removed by the system. Become a VIP again by donating to " . $SITENAME . ", or exchanging some Karma Bonus Points. Cheers !\n"; while ($arr = mysql_fetch_assoc($res)) { $modcomment = sqlesc(gmdate("Y-m-d H:i") . " - Vip status Automatically Removed By System\n"); $msgs_buffer[] = '(0,' . $arr['id'] . ',NOW(), ' . sqlesc($msg) . ', \'Vip status expired.\')'; $users_buffer[] = '(' . $arr['id'] . ',1,\'no\',\'0000-00-00 00:00:00\', ' . $modcomment . ')'; } if (sizeof($msgs_buffer) > 0) { sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__); sql_query("INSERT INTO users (id, class, vip_added, vip_until, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE class=values(class),\nvip_added=values(vip_added),vip_until=values(vip_until),modcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__); $count = mysql_affected_rows(); write_log("autoremvip", "Delayed Cleanup: Karma Vip status expired - " . $count / 2 . " Member(s)"); } unset($users_buffer); unset($msgs_buffer); } // ===end===// // ===clear funds after one month $secs = 28 * 86400; $dt = sqlesc(get_date_time(gmtime() - $secs)); sql_query("DELETE FROM funds WHERE added < {$dt}"); // ===end // === remove donor status if time up AND set class back to power user... remember to set the class number for your system//==updated===// $res = sql_query("SELECT id, modcomment FROM users WHERE donor='yes' AND donoruntil < NOW() AND donoruntil <> '0000-00-00 00:00:00'") or sqlerr(__FILE__, __LINE__); $msgs_buffer = $users_buffer = array(); if (mysql_num_rows($res) > 0) { $subject = "Donor status removed by system."; $msg = "Your Donor status has timed out and has been auto-removed by the system, and your VIP status has been removed. We would like to thank you once again for your support to " . $SITENAME . " . If you wish to re-new your donation,Visit the site paypal link. Cheers!\n"; while ($arr = mysql_fetch_assoc($res)) { $modcomment = sqlesc(gmdate("Y-m-d H:i") . " - Donation status Automatically Removed By System\n"); $msgs_buffer[] = '(0,' . $arr['id'] . ',NOW(), ' . sqlesc($msg) . ', \'Donation status expired thanks for the support.\')'; $users_buffer[] = '(' . $arr['id'] . ',1,\'no\',\'0000-00-00 00:00:00\', ' . $modcomment . ')'; } if (sizeof($msgs_buffer) > 0) { sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__); sql_query("INSERT INTO users (id, class, donor, donoruntil, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE class=values(class),\ndonor=values(donor),donoruntil=values(donoruntil),modcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__); $count = mysql_affected_rows(); write_log("autoremdon", "Delayed Cleanup: Donation status expired - " . $count / 2 . " Member(s)"); } unset($users_buffer); unset($msgs_buffer); } // ===end===// // === Updated remove custom smilies :) $res = sql_query("SELECT id FROM users WHERE smile_until < NOW() AND smile_until <> '0000-00-00 00:00:00'") or sqlerr(__FILE__, __LINE__); $msgs_buffer = $users_buffer = array(); if (mysql_num_rows($res) > 0) { $msg = "Your Custom smilies have timed out and has been auto-removed by the system. If you would like to have them again, exchange some Karma Bonus Points again. Cheers!\n"; while ($arr = mysql_fetch_assoc($res)) { $modcomment = sqlesc(gmdate("Y-m-d H:i") . " - Custom smilies Automatically Removed By System\n"); $msgs_buffer[] = '(0,' . $arr['id'] . ',NOW(), ' . sqlesc($msg) . ', \'Custom Smilies\')'; $users_buffer[] = '(' . $arr['id'] . ',\'0000-00-00 00:00:00\',' . $modcomment . ')'; } if (sizeof($msgs_buffer) > 0) { sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__); sql_query("INSERT INTO users (id, smile_until, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE smile_until=values(smile_until),\nmodcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__); $count = mysql_affected_rows(); write_log("customsmiles", "Delayed Cleanup: Removed Custom smilies from " . $count / 2 . " members"); } unset($users_buffer); unset($msgs_buffer); } // /==updated/modified autoleech warning script//// $minratio = 0.4; // ratio < 0.4 $downloaded = 10 * 1024 * 1024 * 1024; // + 10 GB $length = 3 * 7; // Give 3 weeks to let them sort there shit $res = sql_query("SELECT id FROM users WHERE class >= 0 AND leechwarn = 'no' AND uploaded / downloaded < {$minratio} AND downloaded >= {$downloaded}") or sqlerr(__FILE__, __LINE__); $msgs_buffer = $users_buffer = array(); if (mysql_num_rows($res) > 0) { $dt = sqlesc(get_date_time()); $msg = "You have been warned and your download rights have been removed due to your low ratio. You need to get a ratio of 0.7 within the next 3 weeks or your downloads will remain disabled."; $leechwarnuntil = sqlesc(get_date_time(gmtime() + $length * 86400)); while ($arr = mysql_fetch_assoc($res)) { $modcomment = sqlesc(gmdate("Y-m-d H:i") . " - Automatically Leech warned and downloads disabled By System\n"); $msgs_buffer[] = '(0,' . $arr['id'] . ',NOW(), ' . sqlesc($msg) . ', \'Auto Leech Warn\')'; $users_buffer[] = '(' . $arr['id'] . ',\'yes\',' . $leechwarnuntil . ',\'no\', ' . $modcomment . ')'; } if (sizeof($msgs_buffer) > 0) { sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__); sql_query("INSERT INTO users (id, leechwarn, leechwarnuntil, downloadpos, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE leechwarn=values(leechwarn),\nleechwarnuntil=values(leechwarnuntil),downloadpos=values(downloadpos),modcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__); $count = mysql_affected_rows(); write_log("autowarn", "Delayed Cleanup: System applied auto leech Warning(s) to " . $count / 2 . " Member(s)"); } unset($users_buffer); unset($msgs_buffer); } // ////////////////////////////////////////////////// // ==Modified autoleech warn system - Remove warning and enable downloads $minratio = 0.7; // ratio > 0.7 $res = sql_query("SELECT id FROM users WHERE downloadpos = 'no' AND leechwarn = 'yes' AND uploaded / downloaded >= {$minratio}") or sqlerr(__FILE__, __LINE__); $msgs_buffer = $users_buffer = array(); if (mysql_num_rows($res) > 0) { $msg = "Your warning for a low ratio has been removed and your downloads enabled. We highly recommend you to keep your ratio positive to avoid being automatically warned again.\n"; while ($arr = mysql_fetch_assoc($res)) { $modcomment = sqlesc(gmdate("Y-m-d H:i") . " - Leech warn removed and download enabled By System\n"); $msgs_buffer[] = '(0,' . $arr['id'] . ',NOW(), ' . sqlesc($msg) . ', \'Auto leech warn removal and download\')'; $users_buffer[] = '(' . $arr['id'] . ',\'no\',\'0000-00-00 00:00:00\',\'yes\', ' . $modcomment . ')'; } if (sizeof($msgs_buffer) > 0) { sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__); sql_query("INSERT INTO users (id, leechwarn, leechwarnuntil, downloadpos, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE leechwarn=values(leechwarn),\nleechwarnuntil=values(leechwarnuntil),downloadpos=values(downloadpos),modcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__); $count = mysql_affected_rows(); write_log("autodewarn", "Delayed Cleanup: System removed auto leech Warning(s) and renabled download(s) - " . $count / 2 . " Member(s)"); } unset($users_buffer); unset($msgs_buffer); } // ///////////Delete old pms//////////// $secs = 15 * 86400; //change this to fit your needs $dt = sqlesc(get_date_time(gmtime() - $secs)); sql_query("DELETE FROM messages WHERE added < {$dt}"); // ////////////////////////// $secs = 28 * 86400; //change this to fit your needs $dt = sqlesc(get_date_time(gmtime() - $secs)); sql_query("DELETE FROM iplog WHERE access < {$dt}"); // delete from shoutbox after 2 days $secs = 2 * 86400; $dt = sqlesc(get_date_time(gmtime() - $secs)); sql_query("DELETE FROM shoutbox WHERE " . time() . " - date > {$secs}") or sqlerr(__FILE__, __LINE__); // Delete Orphaned announcement_processors sql_query("DELETE announcement_process FROM announcement_process LEFT JOIN users ON announcement_process.user_id = users.id WHERE users.id IS NULL"); // Delete expired announcements and processors sql_query("DELETE FROM announcement_main WHERE expires < " . sqlesc(get_date_time())); sql_query("DELETE announcement_process FROM announcement_process LEFT JOIN announcement_main ON announcement_process.main_id = announcement_main.main_id WHERE announcement_main.main_id IS NULL"); // //////auto-delete old torrents//////// if ($oldtorrents) { $dt = sqlesc(get_date_time(gmtime() - $torrent_ttl)); $days = 2; $days_la = 7; $dt_la = sqlesc(get_date_time(gmtime() - $days_la * 86400)); $res = sql_query("SELECT id, name FROM torrents WHERE added < {$dt} AND seeders=0 AND leechers=0 AND last_action < {$dt_la} "); if (mysql_num_rows($res) > 0) { $deadcount = mysql_num_rows($res); while ($arr = mysql_fetch_assoc($res)) { $ids[] = $arr['id']; $names[] = $arr['name']; } @unlink("{$torrent_dir}/" . join(',', $ids) . ".torrent"); sql_query("DELETE FROM torrents WHERE id IN (" . join(',', $ids) . ")"); sql_query("DELETE FROM peers WHERE torrent IN (" . join(',', $ids) . ")"); sql_query("DELETE FROM snatched WHERE torrent IN (" . join(',', $ids) . ")"); sql_query("DELETE FROM comments WHERE torrent IN (" . join(',', $ids) . ")"); sql_query("DELETE FROM files WHERE torrent IN (" . join(',', $ids) . ")"); write_log("torrentdelete", $deadcount . " Torrents (" . join(',', $ids) . ") (" . join(', ', $names) . ") were deleted by system (older than {$days} days and no seeders or leechers in 7 day's)"); //==autoshout - comment out if not required $message = $deadcount . " Torrents (" . join(',', $ids) . ") (" . join(', ', $names) . ")) were deleted by system (older than {$days} days and no seeders or leechers in 7 day's)"; autoshout($message); } } // lock topics where last post was made more than x days ago $res = mysql_query("SELECT topics.id FROM topics LEFT JOIN posts ON topics.lastpost = posts.id AND topics.sticky = 'no' WHERE " . gmtime() . " - UNIX_TIMESTAMP(posts.added) > {$max_dead_topic_time}") or sqlerr(__FILE__, __LINE__); while ($arr = mysql_fetch_assoc($res)) { mysql_query("UPDATE topics SET locked='yes' WHERE id={$arr['id']}") or sqlerr(__FILE__, __LINE__); } // / freeslots $dt = sqlesc(get_date_time(gmtime() - $slotduration * 86400)); sql_query("UPDATE freeslots SET doubleup = 'no' WHERE addedup<{$dt}") or sqlerr(__FILE__, __LINE__); sql_query("UPDATE freeslots SET free = 'no' WHERE addedfree<{$dt}") or sqlerr(__FILE__, __LINE__); sql_query("DELETE FROM freeslots WHERE doubleup = 'no' AND free = 'no'") or sqlerr(__FILE__, __LINE__); write_log("slowautoclean", " -------------------- Delayed cleanup stage 2 Complete using {$queries} queries --------------------"); }
function userlogin() { global $INSTALLER09, $mc1, $CURBLOCK; unset($GLOBALS["CURUSER"]); $dt = time(); $ip = getip(); $nip = ip2long($ip); if (isset($CURUSER)) { return; } require_once INCL_DIR . 'user_functions.php'; require_once CACHE_DIR . 'bans_cache.php'; if (count($bans) > 0) { foreach ($bans as $k) { if ($nip >= $k['first'] && $nip <= $k['last']) { header("HTTP/1.0 403 Forbidden"); print "<html><body><h1>403 Forbidden</h1>Unauthorized IP address.</body></html>\n"; exit; } } unset($bans); } 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; } // ==Retro's Announcement mod $prefix = '09skan'; /** let's cache $CURUSER - pdq **/ $row = $mc1->get_value('MyUser_' . $id); if ($row === false) { // $row not found $res = sql_query("SELECT " . $prefix . ".*, ann_main.subject AS curr_ann_subject, ann_main.body AS curr_ann_body, s.last_status, s.last_update, s.archive FROM users AS " . $prefix . " LEFT JOIN announcement_main AS ann_main " . "ON ann_main.main_id = " . $prefix . ".curr_ann_id LEFT JOIN ustatus as s ON s.userid = " . $prefix . ".id WHERE " . $prefix . ".id = {$id} AND " . $prefix . ".enabled='yes' AND " . $prefix . ".status = 'confirmed'") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($res) == 0) { logoutcookie(); return; } $row = mysql_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['uploaded'] = (double) $row['uploaded']; $row['downloaded'] = (double) $row['downloaded']; $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['seedbonus'] = (double) $row['seedbonus']; $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['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']; $ratio = $row['downloaded'] > 0 ? $row['uploaded'] / $row['downloaded'] : 0; $row['ratio'] = number_format($ratio, 2); $row['rep'] = get_reputation($row); $mc1->cache_value('MyUser_' . $id, $row, $INSTALLER09['expires']['curuser']); // set $Cache unset($res); } if (get_mycookie('pass') !== md5($row["passhash"] . $_SERVER["REMOTE_ADDR"])) { return; } //==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: " . $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__); write_log($msg); autoshout($msg); logoutcookie(); } } // If curr_ann_id > 0 but curr_ann_body IS NULL, then force a refresh if ($row['curr_ann_id'] > 0 and $row['curr_ann_body'] == NULL) { $row['curr_ann_id'] = 0; $row['curr_ann_last_check'] = '0'; } // If elapsed > 10 minutes, force a announcement refresh. if ($row['curr_ann_last_check'] != '0' and $row['curr_ann_last_check'] < time($dt) - 600) { $row['curr_ann_last_check'] = '0'; } if ($row['curr_ann_id'] == 0 and $row['curr_ann_last_check'] == '0') { // Force an immediate check... $query = sprintf('SELECT m.*,p.process_id FROM announcement_main AS m ' . 'LEFT JOIN announcement_process AS p ON m.main_id = p.main_id ' . 'AND p.user_id = %s ' . 'WHERE p.process_id IS NULL ' . 'OR p.status = 0 ' . 'ORDER BY m.main_id ASC ' . 'LIMIT 1', sqlesc($row['id'])); $result = sql_query($query); if (mysql_num_rows($result)) { // Main Result set exists $ann_row = mysql_fetch_assoc($result); $query = $ann_row['sql_query']; // Ensure it only selects... if (!preg_match('/\\ASELECT.+?FROM.+?WHERE.+?\\z/', $query)) { die; } // The following line modifies the query to only return the current user // row if the existing query matches any attributes. $query .= ' AND u.id = ' . sqlesc($row['id']) . ' LIMIT 1'; $result = sql_query($query); if (mysql_num_rows($result)) { // Announcement valid for member $row['curr_ann_id'] = $ann_row['main_id']; // Create two row elements to hold announcement subject and body. $row['curr_ann_subject'] = $ann_row['subject']; $row['curr_ann_body'] = $ann_row['body']; // Create additional set for main UPDATE query. $add_set = ', curr_ann_id = ' . sqlesc($ann_row['main_id']); $status = 2; } else { // Announcement not valid for member... $add_set = ', curr_ann_last_check = ' . sqlesc($dt); $status = 1; } // Create or set status of process if ($ann_row['process_id'] === NULL) { // Insert Process result set status = 1 (Ignore) $query = sprintf('INSERT INTO announcement_process (main_id, ' . 'user_id, status) VALUES (%s, %s, %s)', sqlesc($ann_row['main_id']), sqlesc($row['id']), sqlesc($status)); } else { // Update Process result set status = 2 (Read) $query = sprintf('UPDATE announcement_process SET status = %s ' . 'WHERE process_id = %s', sqlesc($status), sqlesc($ann_row['process_id'])); } sql_query($query); } else { // No Main Result Set. Set last update to now... $add_set = ', curr_ann_last_check = ' . sqlesc($dt); } unset($result); unset($ann_row); } 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']; $CURBLOCK = $mc1->get_value($blocks_key); if ($CURBLOCK === false) { $c_sql = sql_query('SELECT * FROM user_blocks WHERE userid = ' . $row['id']) or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($c_sql) == 0) { sql_query('INSERT INTO user_blocks(userid) VALUES(' . $row['id'] . ')'); header('Location: index.php'); die; } $CURBLOCK = mysql_fetch_assoc($c_sql); $CURBLOCK['index_page'] = (int) $CURBLOCK['index_page']; $CURBLOCK['global_stdhead'] = (int) $CURBLOCK['global_stdhead']; $mc1->cache_value($blocks_key, $CURBLOCK, 0); } //== online time pdq $userupdate0 = 'onlinetime = onlinetime + 0'; $new_time = TIME_NOW - $row['last_access_numb']; if ($new_time < 300) { $userupdate0 = "onlinetime = onlinetime + " . $new_time; } $userupdate1 = "last_access_numb = " . TIME_NOW; //end online-time $add_set = isset($add_set) ? $add_set : ''; if ($row['ip'] !== $ip) { sql_query("UPDATE users SET last_access=" . TIME_NOW . ", {$userupdate0}, {$userupdate1}, ip=" . sqlesc($ip) . $add_set . " WHERE id=" . $row['id']); // or die(mysql_error()); $mc1->delete_value('MyUser_' . $row['id']); } elseif ($row['last_access'] != '0' and $row['last_access'] < time($dt) - 180) { sql_query("UPDATE users SET last_access=" . TIME_NOW . ", {$userupdate0}, {$userupdate1}, ip=" . sqlesc($ip) . $add_set . " WHERE id=" . $row['id']); // or die(mysql_error()); $mc1->delete_value('MyUser_' . $row['id']); } //== if ($row['override_class'] < $row['class']) { $row['class'] = $row['override_class']; } // Override class and save in GLOBAL array below. $GLOBALS["CURUSER"] = $row; get_template(); }