} // ///// Initial sanity check xMB/s for 1 second if ($upthis > 2097152) { // Work out time difference $endtime = time(); $starttime = $self['ts']; $diff = $endtime - $starttime; // Normalise to prevent divide by zero. $rate = $upthis / ($diff + 1); // Currently 2MB/s. Increase to 5MB/s once finished testing. if ($rate > 2097152) { if ($class < UC_CODER and $highspeed == "no") { $rate = prefixed($rate); $client = $agent; $userip = getip(); auto_enter_cheater($userid, $rate, $upthis, $diff, $torrentid, $client, $userip, $last_up); $modcomment = gmdate("Y-m-d") . " Warned and download disabled for possible ratio cheating at high upload speeds\n" . $arr['modcomment']; mysql_query("UPDATE users set warned='yes', downloadpos='no', modcomment = " . sqlesc($modcomment) . " WHERE id={$userid}") or sqlerr(__FILE__, __LINE__); $body = sqlesc("Cheat alert : [url={$BASEURL}/userdetails.php?id=" . $userid . "]View Members profile[/url] \n This member has been flagged with a high upload speed\n Automatic warning and download disablement applied - Please verify the members actual upload speeds.\n "); $subject = sqlesc("High Upload Speed Detected"); auto_post($subject, $body); } } } } // //////////////end abnormal upload speed detection //// function portblacklisted($port) { // direct connect if ($port >= 411 && $port <= 413) { return true;
$updq[1] = "uploaded = uploaded + " . ($torrent['doubleslot'] != 0 || $isdouble ? $upthis * 2 : $upthis); } $udq = implode(',', $updq); mysql_query("UPDATE users SET {$udq} WHERE id=" . $user['id']) or err('Tracker error 3'); $mc1->delete_value('MyUser_' . $user['id']); $mc1->delete_value('user' . $user['id']); } //=== abnormal upload detection if ($user['highspeed'] == 'no' && $upthis > 103872) { //=== Work out difference $diff = TIME_NOW - $self['ts']; $rate = $upthis / ($diff + 1); $last_up = $user['uploaded']; //=== about 1 MB/s if ($rate > 103872) { auto_enter_cheater($user['id'], $rate, $upthis, $diff, $torrentid, $agent, $ip, $last_up); } } //=== end abnormal upload detection } /////////////////////////////////////////////////////////////////////////////// if (portblacklisted($port)) { err("Port {$port} is blacklisted."); } elseif ($INSTALLER09['connectable_check']) { //== connectable checking - pdq $connkey = 'conn:' . $ip . ':' . $port; $connectable = $mc1->get_value($connkey); if ($connectable === false) { $sockres = @fsockopen($ip, $port, $errno, $errstr, 5); if (!$sockres) { $connectable = 'no';