command Posted May 23, 2009 Report Share Posted May 23, 2009 I have the next problem with my uploads.When I try to upload to a site then I get no matter what I select with Piece Size.I get the ERROR standing beneath. Sometimes he does not give an error, sometimes he does give the error.Foutmelding: Foute info_hash (21 - L%CF%16%3D%8Eu%82%FF%BB%8Am%EE%5C%5C%C2%B8%D6%C2%E6%2F%0D) 17m 54s 0 0 0 I have no idea what is the problem.I hope that maybe somebody can help me?announce.php<?ob_start("ob_gzhandler");require_once("include/bittorrent.php");require_once("include/benc.php");function dbconn_announce($autoclean = false) { global $SITE_ONLINE, $SITE_ONLINE_MSG, $mysql_host, $mysql_user, $mysql_pass, $mysql_db, $_SERVER, $krediet_groot, $aktie_vandaag, $aktie_text; if (!$SITE_ONLINE) err("Server is tijdelijk offline"); if (!@mysql_connect($mysql_host, $mysql_user, $mysql_pass)) { switch (mysql_errno()) { case 1040: case 2002: if ($_SERVER['REQUEST_METHOD'] == "GET") err("Tijdelijk contact verlies met server"); else err("Tijdelijk contact verlies met server"); default: err("Tijdelijk contact verlies met server"); } } mysql_select_db($mysql_db) or die('dbconn: mysql_select_db: ' + mysql_error()); userlogin(); }function err($msg) { benc_resp(array("failure reason" => array(type => "string", value => $msg))); exit(); }function benc_resp($d) { benc_resp_raw(benc(array(type => "dictionary", value => $d))); }function benc_resp_raw($x) { header("Content-Type: text/plain"); header("Pragma: no-cache"); print($x); }foreach (array("passkey","info_hash","peer_id","ip","event") as $x) $GLOBALS[$x] = "" . $_GET[$x];foreach (array("port","downloaded","uploaded","left") as $x) $GLOBALS[$x] = 0 + $_GET[$x];if (strpos($passkey, "?")) { $tmp = substr($passkey, strpos($passkey, "?")); $passkey = substr($passkey, 0, strpos($passkey, "?")); $tmpname = substr($tmp, 1, strpos($tmp, "=")-1); $tmpvalue = substr($tmp, strpos($tmp, "=")+1); $GLOBALS[$tmpname] = $tmpvalue; }foreach (array("passkey","info_hash","peer_id","port","downloaded","uploaded","left") as $x) if (!isset($x)) err("Ontbrekende gegevens: $x");foreach (array("info_hash","peer_id") as $x) if (strlen($GLOBALS[$x]) != 20) err("Foute $x (" . strlen($GLOBALS[$x]) . " - " . urlencode($GLOBALS[$x]) . ")");if (strlen($passkey) != 32) err("Verkeerde passkey. Download de torrent opnieuw aub.");$ip = getip();$rsize = 50;foreach(array("num want", "numwant", "num_want") as $k) { if (isset($_GET[$k])) { $rsize = 0 + $_GET[$k]; break; } }$agent = $_SERVER["HTTP_USER_AGENT"];$headers = getallheaders();if (isset($headers["Cookie"]) || isset($headers["Accept-Language"]) || isset($headers["Accept-Charset"])) err("U bent betrapt op vals spel. En uw gegevens zijn opgeslagen");// Deny access made with a browser...if (ereg("^Mozilla\\/", $agent) || ereg("^Opera\\/", $agent) || ereg("^Links ", $agent) || ereg("^Lynx\\/", $agent)) err("Deze torrent is niet geregistreerd bij deze tracker 1");//if ("text/html, */*" == $_SERVER["HTTP_ACCEPT"] || "Close" == $_SERVER["HTTP_CONNECTION"] && "gzip, deflate" != $_SERVER["HTTP_ACCEPT_ENCODING"])// {// $u = mysql_fetch_assoc(mysql_query("SELECT id, username FROM users WHERE id=".$userid));// $dt = sqlesc(get_date_time());//// $msg = sqlesc("You have been logged for trying to cheat!");// mysql_query("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, 1, $dt, $msg, 0)");// mysql_query("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $userid, $dt, $msg, 0)") or sqlerr(__FILE__, __LINE__);// write_log("User ".$userid." (".$u["username"].") was logged for trying to cheat.");// benc_resp_raw("You have been logged for trying to cheat");// $ip = getip();// $subject = sqlesc("Fake upload - $ip");// $body = sqlesc("User ".$userid." (".$u["username"].") has been detected trying to cheat using a fake maker.\n\n His IP address is $ip.");// auto_post( $subject , $body );// }if (!$port || $port > 0xffff) err("Verkeerde poort");if (!isset($event)) $event = "";$seeder = ($left == 0) ? "yes" : "no";dbconn_announce(false);$valid = @mysql_fetch_row(@mysql_query("SELECT COUNT(*) FROM users WHERE passkey=" . sqlesc($passkey))); if ($valid[0] != 1) err("Foute passkey! Download de .torrent opnieuw van de site");$def = mysql_query("SELECT id FROM users WHERE passkey=" . sqlesc($passkey));$defs = mysql_fetch_assoc($def);if ($defs) { $userid=$defs['id']; }//$res = mysql_query("SELECT id, banned, seeders + leechers AS numpeers, UNIX_TIMESTAMP(added) AS ts FROM torrents WHERE " . hash_where("info_hash", $info_hash));$res = mysql_query("SELECT id, banned, UNIX_TIMESTAMP(added) AS ts FROM torrents WHERE " . hash_where("info_hash", $info_hash));$torrent = mysql_fetch_assoc($res);if (!$torrent) err("Deze torrent bestaat niet op deze tracker. ");$torrentid = $torrent["id"];$fields = "seeder, peer_id, ip, port, uploaded, downloaded, userid";//$numpeers = $torrent["numpeers"];//$limit = "";//if ($numpeers > $rsize) $limit = "ORDER BY RAND() LIMIT 50";$res = mysql_query("SELECT $fields FROM peers WHERE torrent = $torrentid AND connectable = 'yes' $limit");$resp = "d" . benc_str("interval") . "i" . $announce_interval . "e" . benc_str("peers") . "l";unset($self);while ($row = mysql_fetch_assoc($res)) { $row["peer_id"] = hash_pad($row["peer_id"]); if ($row["peer_id"] === $peer_id) { $userid = $row["userid"]; $self = $row; continue; } $resp .= "d" . benc_str("ip") . benc_str($row["ip"]) . benc_str("peer id") . benc_str($row["peer_id"]) . benc_str("port") . "i" . $row["port"] . "e" . "e"; }$resp .= "ee";$selfwhere = "torrent = $torrentid AND " . hash_where("peer_id", $peer_id);if (!isset($self)) { $res = mysql_query("SELECT $fields FROM peers WHERE $selfwhere"); $row = mysql_fetch_assoc($res); if ($row) { $userid = $row["userid"]; $self = $row; } }//// Up/down stats ////////////////////////////////////////////////////////////function verbindbaar() { $sockres = @fsockopen($ip, $port, $errno, $errstr, 5); if (!$sockres) { @fclose($sockres); return "Nee"; } else { @fclose($sockres); return ""; } }if (!isset($self)) { if (!verbindbaar()) { $connectable = "no"; err("U bent niet verbindbaar..1.."); } $valid = @mysql_fetch_row(@mysql_query("SELECT COUNT(*) FROM peers WHERE torrent=$torrentid AND passkey=" . sqlesc($passkey))); $rz = mysql_query("SELECT maxtorrents, id, uploaded, downloaded, class FROM users WHERE passkey=".sqlesc($passkey)." AND enabled = 'yes' ORDER BY last_access DESC LIMIT 1") or err("Tracker error 2"); if (mysql_num_rows($rz) == 0) err("Onbekende passkey. Download de torrent opnieuw aub."); $az = mysql_fetch_assoc($rz); $userid = $az["id"]; if (!verbindbaar()) { $connectable = "no"; err("U bent niet verbindbaar..2.."); } $allowedtorrents = $az["maxtorrents"]; $res = mysql_query("SELECT COUNT(*) FROM peers WHERE userid=$userid") or err("Maximale torrents bereikt."); $row = mysql_fetch_row($res); $activetorrents = $row[0]; if ($activetorrents >= $allowedtorrents) err("Sorry, $allowedtorrents is maximaal voor u."); }else { $upthis = max(0, $uploaded - $self["uploaded"]); $downthis = max(0, $downloaded - $self["downloaded"]); if ($upthis > 0 || $downthis > 0) { $ressite = mysql_query("SELECT * FROM downup WHERE user=$userid AND torrent=$torrentid") or err("DownUpStats Error"); $rowsite = mysql_fetch_array($ressite); if (!$rowsite) mysql_query("INSERT INTO downup (torrent, user, added, uploaded, downloaded) VALUES ($torrentid, $userid, NOW(), $upthis, $downthis)"); else mysql_query("UPDATE downup SET uploaded = uploaded + $upthis, downloaded = downloaded + $downthis, lastseen = NOW() WHERE user=$userid AND torrent=$torrentid") or err("Tracker foutmelding 4");// if (get_super_seeder($userid) == "no")// {// $verschil = 1024*1024*1024;// if ($upthis > $verschil)// {// $verzendtekst = "<a href=userdetails.php?id=".$userid.">" . get_username($userid) . "</a> heeft " . mksize($upthis) . " verzonden voor torrent <a href=details.php?id=".$torrentid.">".get_torrentname($torrentid)."</a>, terwijl max is " . mksize($verschil) . " - <a href=sendmessage.php?receiver=".$userid."&auto=9>PM</a>";// write_log_cheat($verzendtekst);// }// } mysql_query("UPDATE users SET uploaded = uploaded + $upthis, downloaded = downloaded + $downthis WHERE id=$userid") or err("Tracker foutmelding 3"); }}/// Client ban code/*$uagent = $_SERVER['HTTP_USER_AGENT'];$bua = mysql_query("SELECT agent FROM banned_agent") or err('Foutmelding Agents');while ($nea = mysql_fetch_array($bua)) { $n = $nea['agent']; $nr = preg_replace("/\//", "\/", $n); $neadle = "/\b$nr\b/i"; if (preg_match($neadle, $uagent)) { err("Client software verbannen."); } }*/ /// Client ban codefunction portblacklisted($port) { if ($port >= 411 && $port <= 413) return true; // direct connect if ($port >= 6881 && $port <= 6889) return true; // bittorrent if ($port == 1214) return true; // kazaa if ($port >= 6346 && $port <= 6347) return true; // gnutella if ($port == 4662) return true; // emule if ($port == 6699) return true; // winmx return false; }$updateset = array();if ($event == "stopped") { if (isset($self)) { mysql_query("DELETE FROM peers WHERE $selfwhere"); if (mysql_affected_rows()) { if ($self["seeder"] == "yes") $updateset[] = "seeders = seeders - 1"; else $updateset[] = "leechers = leechers - 1"; } } }else { if ($event == "completed") { $ratiocompleted = floor($uploaded / $downloaded * 1000) / 1000; $updateset[] = "times_completed = times_completed + 1"; mysql_query("INSERT INTO downloaded (torrent, user, added, uploaded, downloaded) VALUES ($torrentid, $userid, NOW(), $uploaded, $downloaded)"); } if (isset($self)) { if (!verbindbaar()) { $connectable = "no"; err("U bent niet verbindbaar..3.."); } mysql_query("UPDATE peers SET uploaded = $uploaded, downloaded = $downloaded, to_go = $left, last_action = NOW(), seeder = '$seeder'" . ($seeder == "yes" && $self["seeder"] != $seeder ? ", finishedat = " . time() : "") . " WHERE $selfwhere"); if (mysql_affected_rows() && $self["seeder"] != $seeder) { if ($seeder == "yes") { $updateset[] = "seeders = seeders + 1"; $updateset[] = "leechers = leechers - 1"; } else { $updateset[] = "seeders = seeders - 1"; $updateset[] = "leechers = leechers + 1"; } } } else { if (portblacklisted($port)) err("Poort $port is geblokkeerd op site name."); else { if (!verbindbaar()) { $connectable = "no"; } else { $connectable = "yes"; } } $ret = mysql_query("INSERT INTO peers (connectable, torrent, peer_id, ip, port, uploaded, downloaded, to_go, started, last_action, seeder, userid, agent, uploadoffset, downloadoffset, passkey) VALUES ('$connectable', $torrentid, " . sqlesc($peer_id) . ", " . sqlesc($ip) . ", $port, $uploaded, $downloaded, $left, NOW(), NOW(), '$seeder', $userid, " . sqlesc($agent) . ", $uploaded, $downloaded, " . sqlesc($passkey) . ")"); if ($ret) { if ($seeder == "yes") $updateset[] = "seeders = seeders + 1"; else $updateset[] = "leechers = leechers + 1"; } } }if ($seeder == "yes") { if ($torrent["banned"] != "yes") $updateset[] = "visible = 'yes'"; $updateset[] = "last_action = NOW()"; }if (count($updateset)) mysql_query("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $torrentid");if (!verbindbaar()) { err("U bent niet verbindbaar..3.."); }else benc_resp_raw($resp);?> Link to comment Share on other sites More sharing options...
moogly Posted May 23, 2009 Report Share Posted May 23, 2009 If it appears only on one specific tracker, it's an issue relative to this tracker, not with your torrents.Some trackers have issues with torrents containing a lot of files (like folder with 1000 pictures). Link to comment Share on other sites More sharing options...
DreadWingKnight Posted May 23, 2009 Report Share Posted May 23, 2009 Given that you're getting a 21-byte infohash, I'd say either the tracker software is broken or the tracker's server is broken. Link to comment Share on other sites More sharing options...
command Posted May 23, 2009 Author Report Share Posted May 23, 2009 It is not the script or the server. I have changed server because of this problem, but it is still present.The script is also being used on another server with no problems at all.So if anybody else has a suggestion? Or need another php for more information? Link to comment Share on other sites More sharing options...
DreadWingKnight Posted May 23, 2009 Report Share Posted May 23, 2009 I'm about 98% sure that your server/script isn't handling magic quotes properly. Link to comment Share on other sites More sharing options...
command Posted May 24, 2009 Author Report Share Posted May 24, 2009 It is not the script or the server. I have changed server because of this problem, but it is still present.So if anybody else has a suggestion? Or need another php for more information? Link to comment Share on other sites More sharing options...
DreadWingKnight Posted May 24, 2009 Report Share Posted May 24, 2009 I just double-checked. Your script is escaping characters when it's not supposed to be.Not a uTorrent issue. Link to comment Share on other sites More sharing options...
command Posted May 24, 2009 Author Report Share Posted May 24, 2009 what you need to make it fix whits php's Link to comment Share on other sites More sharing options...
DreadWingKnight Posted May 24, 2009 Report Share Posted May 24, 2009 if the infohash string is over 20bytes, stripslashes it. Link to comment Share on other sites More sharing options...
command Posted June 7, 2009 Author Report Share Posted June 7, 2009 can you maybe explain to me how I do that with the stripslashes? Link to comment Share on other sites More sharing options...
DreadWingKnight Posted June 7, 2009 Report Share Posted June 7, 2009 I have no idea where in your script the infohash is obtained from the announce request, but you need to put a conditional check on the infohash where if it's greater than 20bytes, you stripslashes it.Your extensive use of globals goes against the programming recommendations of PHP. Link to comment Share on other sites More sharing options...
command Posted June 7, 2009 Author Report Share Posted June 7, 2009 you meen foreach (array("info_hash","peer_id") as $x) if (strlen($GLOBALS[$x]) != 20) err("Foute $x (" . strlen($GLOBALS[$x]) . " - " . urlencode($GLOBALS[$x]) . ")"); Link to comment Share on other sites More sharing options...
DreadWingKnight Posted June 7, 2009 Report Share Posted June 7, 2009 It would be around there, yes. Link to comment Share on other sites More sharing options...
command Posted June 7, 2009 Author Report Share Posted June 7, 2009 beneath is the complete php from announce. I can't pinpoint where I need to make the change and what I need to put there.Can you be so kind to help me a little bit more?I would be very gratefull.<?ob_start("ob_gzhandler");require_once("include/bittorrent.php");require_once("include/benc.php");function dbconn_announce($autoclean = false) { global $SITE_ONLINE, $SITE_ONLINE_MSG, $mysql_host, $mysql_user, $mysql_pass, $mysql_db, $_SERVER, $krediet_groot, $aktie_vandaag, $aktie_text; if (!$SITE_ONLINE) err("Server is tijdelijk offline"); if (!@mysql_connect($mysql_host, $mysql_user, $mysql_pass)) { switch (mysql_errno()) { case 1040: case 2002: if ($_SERVER['REQUEST_METHOD'] == "GET") err("Tijdelijk contact verlies met server"); else err("Tijdelijk contact verlies met server"); default: err("Tijdelijk contact verlies met server"); } } mysql_select_db($mysql_db) or die('dbconn: mysql_select_db: ' + mysql_error()); userlogin(); }function err($msg) { benc_resp(array("failure reason" => array(type => "string", value => $msg))); exit(); }function benc_resp($d) { benc_resp_raw(benc(array(type => "dictionary", value => $d))); }function benc_resp_raw($x) { header("Content-Type: text/plain"); header("Pragma: no-cache"); print($x); }foreach (array("passkey","info_hash","peer_id","ip","event") as $x) $GLOBALS[$x] = "" . $_GET[$x];foreach (array("port","downloaded","uploaded","left") as $x) $GLOBALS[$x] = 0 + $_GET[$x];if (strpos($passkey, "?")) { $tmp = substr($passkey, strpos($passkey, "?")); $passkey = substr($passkey, 0, strpos($passkey, "?")); $tmpname = substr($tmp, 1, strpos($tmp, "=")-1); $tmpvalue = substr($tmp, strpos($tmp, "=")+1); $GLOBALS[$tmpname] = $tmpvalue; }foreach (array("passkey","info_hash","peer_id","port","downloaded","uploaded","left") as $x) if (!isset($x)) err("Ontbrekende gegevens: $x");foreach (array("info_hash","peer_id") as $x) if (strlen($GLOBALS[$x]) != 20) err("Foute $x (" . strlen($GLOBALS[$x]) . " - " . urlencode($GLOBALS[$x]) . ")");if (strlen($passkey) != 32) err("Verkeerde passkey. Download de torrent opnieuw aub.");$ip = getip();$rsize = 50;foreach(array("num want", "numwant", "num_want") as $k) { if (isset($_GET[$k])) { $rsize = 0 + $_GET[$k]; break; } }$agent = $_SERVER["HTTP_USER_AGENT"];$headers = getallheaders();if (isset($headers["Cookie"]) || isset($headers["Accept-Language"]) || isset($headers["Accept-Charset"])) err("U bent betrapt op vals spel. En uw gegevens zijn opgeslagen");// Deny access made with a browser...if (ereg("^Mozilla\\/", $agent) || ereg("^Opera\\/", $agent) || ereg("^Links ", $agent) || ereg("^Lynx\\/", $agent)) err("Deze torrent is niet geregistreerd bij deze tracker 1");//if ("text/html, */*" == $_SERVER["HTTP_ACCEPT"] || "Close" == $_SERVER["HTTP_CONNECTION"] && "gzip, deflate" != $_SERVER["HTTP_ACCEPT_ENCODING"])// {// $u = mysql_fetch_assoc(mysql_query("SELECT id, username FROM users WHERE id=".$userid));// $dt = sqlesc(get_date_time());//// $msg = sqlesc("You have been logged for trying to cheat!");// mysql_query("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, 1, $dt, $msg, 0)");// mysql_query("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $userid, $dt, $msg, 0)") or sqlerr(__FILE__, __LINE__);// write_log("User ".$userid." (".$u["username"].") was logged for trying to cheat.");// benc_resp_raw("You have been logged for trying to cheat");// $ip = getip();// $subject = sqlesc("Fake upload - $ip");// $body = sqlesc("User ".$userid." (".$u["username"].") has been detected trying to cheat using a fake maker.\n\n His IP address is $ip.");// auto_post( $subject , $body );// }if (!$port || $port > 0xffff) err("Verkeerde poort");if (!isset($event)) $event = "";$seeder = ($left == 0) ? "yes" : "no";dbconn_announce(false);$valid = @mysql_fetch_row(@mysql_query("SELECT COUNT(*) FROM users WHERE passkey=" . sqlesc($passkey))); if ($valid[0] != 1) err("Foute passkey! Download de .torrent opnieuw van de site");$def = mysql_query("SELECT id FROM users WHERE passkey=" . sqlesc($passkey));$defs = mysql_fetch_assoc($def);if ($defs) { $userid=$defs['id']; }//$res = mysql_query("SELECT id, banned, seeders + leechers AS numpeers, UNIX_TIMESTAMP(added) AS ts FROM torrents WHERE " . hash_where("info_hash", $info_hash));$res = mysql_query("SELECT id, banned, UNIX_TIMESTAMP(added) AS ts FROM torrents WHERE " . hash_where("info_hash", $info_hash));$torrent = mysql_fetch_assoc($res);if (!$torrent) err("Deze torrent bestaat niet op deze tracker. ");$torrentid = $torrent["id"];$fields = "seeder, peer_id, ip, port, uploaded, downloaded, userid";//$numpeers = $torrent["numpeers"];//$limit = "";//if ($numpeers > $rsize) $limit = "ORDER BY RAND() LIMIT 50";$res = mysql_query("SELECT $fields FROM peers WHERE torrent = $torrentid AND connectable = 'yes' $limit");$resp = "d" . benc_str("interval") . "i" . $announce_interval . "e" . benc_str("peers") . "l";unset($self);while ($row = mysql_fetch_assoc($res)) { $row["peer_id"] = hash_pad($row["peer_id"]); if ($row["peer_id"] === $peer_id) { $userid = $row["userid"]; $self = $row; continue; } $resp .= "d" . benc_str("ip") . benc_str($row["ip"]) . benc_str("peer id") . benc_str($row["peer_id"]) . benc_str("port") . "i" . $row["port"] . "e" . "e"; }$resp .= "ee";$selfwhere = "torrent = $torrentid AND " . hash_where("peer_id", $peer_id);if (!isset($self)) { $res = mysql_query("SELECT $fields FROM peers WHERE $selfwhere"); $row = mysql_fetch_assoc($res); if ($row) { $userid = $row["userid"]; $self = $row; } }//// Up/down stats ////////////////////////////////////////////////////////////function verbindbaar() { $sockres = @fsockopen($ip, $port, $errno, $errstr, 5); if (!$sockres) { @fclose($sockres); return "Nee"; } else { @fclose($sockres); return ""; } }if (!isset($self)) { if (!verbindbaar()) { $connectable = "no"; err("U bent niet verbindbaar..1.."); } $valid = @mysql_fetch_row(@mysql_query("SELECT COUNT(*) FROM peers WHERE torrent=$torrentid AND passkey=" . sqlesc($passkey))); $rz = mysql_query("SELECT maxtorrents, id, uploaded, downloaded, class FROM users WHERE passkey=".sqlesc($passkey)." AND enabled = 'yes' ORDER BY last_access DESC LIMIT 1") or err("Tracker error 2"); if (mysql_num_rows($rz) == 0) err("Onbekende passkey. Download de torrent opnieuw aub."); $az = mysql_fetch_assoc($rz); $userid = $az["id"]; if (!verbindbaar()) { $connectable = "no"; err("U bent niet verbindbaar..2.."); } $allowedtorrents = $az["maxtorrents"]; $res = mysql_query("SELECT COUNT(*) FROM peers WHERE userid=$userid") or err("Maximale torrents bereikt."); $row = mysql_fetch_row($res); $activetorrents = $row[0]; if ($activetorrents >= $allowedtorrents) err("Sorry, $allowedtorrents is maximaal voor u."); }else { $upthis = max(0, $uploaded - $self["uploaded"]); $downthis = max(0, $downloaded - $self["downloaded"]); if ($upthis > 0 || $downthis > 0) { $ressite = mysql_query("SELECT * FROM downup WHERE user=$userid AND torrent=$torrentid") or err("DownUpStats Error"); $rowsite = mysql_fetch_array($ressite); if (!$rowsite) mysql_query("INSERT INTO downup (torrent, user, added, uploaded, downloaded) VALUES ($torrentid, $userid, NOW(), $upthis, $downthis)"); else mysql_query("UPDATE downup SET uploaded = uploaded + $upthis, downloaded = downloaded + $downthis, lastseen = NOW() WHERE user=$userid AND torrent=$torrentid") or err("Tracker foutmelding 4");// if (get_super_seeder($userid) == "no")// {// $verschil = 1024*1024*1024;// if ($upthis > $verschil)// {// $verzendtekst = "<a href=userdetails.php?id=".$userid.">" . get_username($userid) . "</a> heeft " . mksize($upthis) . " verzonden voor torrent <a href=details.php?id=".$torrentid.">".get_torrentname($torrentid)."</a>, terwijl max is " . mksize($verschil) . " - <a href=sendmessage.php?receiver=".$userid."&auto=9>PM</a>";// write_log_cheat($verzendtekst);// }// } mysql_query("UPDATE users SET uploaded = uploaded + $upthis, downloaded = downloaded + $downthis WHERE id=$userid") or err("Tracker foutmelding 3"); }}/// Client ban code/*$uagent = $_SERVER['HTTP_USER_AGENT'];$bua = mysql_query("SELECT agent FROM banned_agent") or err('Foutmelding Agents');while ($nea = mysql_fetch_array($bua)) { $n = $nea['agent']; $nr = preg_replace("/\//", "\/", $n); $neadle = "/\b$nr\b/i"; if (preg_match($neadle, $uagent)) { err("Client software verbannen."); } }*/ /// Client ban codefunction portblacklisted($port) { if ($port >= 411 && $port <= 413) return true; // direct connect if ($port >= 6881 && $port <= 6889) return true; // bittorrent if ($port == 1214) return true; // kazaa if ($port >= 6346 && $port <= 6347) return true; // gnutella if ($port == 4662) return true; // emule if ($port == 6699) return true; // winmx return false; }$updateset = array();if ($event == "stopped") { if (isset($self)) { mysql_query("DELETE FROM peers WHERE $selfwhere"); if (mysql_affected_rows()) { if ($self["seeder"] == "yes") $updateset[] = "seeders = seeders - 1"; else $updateset[] = "leechers = leechers - 1"; } } }else { if ($event == "completed") { $ratiocompleted = floor($uploaded / $downloaded * 1000) / 1000; $updateset[] = "times_completed = times_completed + 1"; mysql_query("INSERT INTO downloaded (torrent, user, added, uploaded, downloaded) VALUES ($torrentid, $userid, NOW(), $uploaded, $downloaded)"); } if (isset($self)) { if (!verbindbaar()) { $connectable = "no"; err("U bent niet verbindbaar..3.."); } mysql_query("UPDATE peers SET uploaded = $uploaded, downloaded = $downloaded, to_go = $left, last_action = NOW(), seeder = '$seeder'" . ($seeder == "yes" && $self["seeder"] != $seeder ? ", finishedat = " . time() : "") . " WHERE $selfwhere"); if (mysql_affected_rows() && $self["seeder"] != $seeder) { if ($seeder == "yes") { $updateset[] = "seeders = seeders + 1"; $updateset[] = "leechers = leechers - 1"; } else { $updateset[] = "seeders = seeders - 1"; $updateset[] = "leechers = leechers + 1"; } } } else { if (portblacklisted($port)) err("Poort $port is geblokkeerd op exclusive-torrents.org."); else { if (!verbindbaar()) { $connectable = "no"; } else { $connectable = "yes"; } } $ret = mysql_query("INSERT INTO peers (connectable, torrent, peer_id, ip, port, uploaded, downloaded, to_go, started, last_action, seeder, userid, agent, uploadoffset, downloadoffset, passkey) VALUES ('$connectable', $torrentid, " . sqlesc($peer_id) . ", " . sqlesc($ip) . ", $port, $uploaded, $downloaded, $left, NOW(), NOW(), '$seeder', $userid, " . sqlesc($agent) . ", $uploaded, $downloaded, " . sqlesc($passkey) . ")"); if ($ret) { if ($seeder == "yes") $updateset[] = "seeders = seeders + 1"; else $updateset[] = "leechers = leechers + 1"; } } }if ($seeder == "yes") { if ($torrent["banned"] != "yes") $updateset[] = "visible = 'yes'"; $updateset[] = "last_action = NOW()"; }if (count($updateset)) mysql_query("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $torrentid");if (!verbindbaar()) { err("U bent niet verbindbaar..3.."); }else benc_resp_raw($resp);?> Link to comment Share on other sites More sharing options...
DreadWingKnight Posted June 7, 2009 Report Share Posted June 7, 2009 There's too much in the code that I have major problems with (the obsession with globals that isn't healthy in php programming for one) that I don't know where to begin. Link to comment Share on other sites More sharing options...
command Posted June 7, 2009 Author Report Share Posted June 7, 2009 you have one that works Link to comment Share on other sites More sharing options...
DreadWingKnight Posted June 7, 2009 Report Share Posted June 7, 2009 I don't deal in PHP trackers normally. I'm just able to see where the problems are because of the php support code I've written for my own setup. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.