|
#21
|
||||
|
||||
lmao ok missed the first use check on passkey
PHP Code:
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent Do not ask me to make a mod for any other source Do not Ask me to setup your site. I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum My Current Demo is here http://demo.btmanager.org/ |
#22
|
|||
|
|||
Well this is a wierd one. Got the invalid info hash at first, so i reset my passkey like last time.
And i got invalid passkey, resetted it another 3-4 times and still get invalid passkey straight away.. :S Thanks |
#23
|
||||
|
||||
is it Invalid passkey ( -) or
"Invalid passkey! Re-download the .torrent from
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent Do not ask me to make a mod for any other source Do not Ask me to setup your site. I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum My Current Demo is here http://demo.btmanager.org/ |
#24
|
|||
|
|||
It was:
"Invalid passkey! Re-download the .torrent from |
#25
|
||||
|
||||
ok this is the one I know it
PHP Code:
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent Do not ask me to make a mod for any other source Do not Ask me to setup your site. I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum My Current Demo is here http://demo.btmanager.org/ |
#26
|
|||
|
|||
YESSSSSS!!!
This worked! I had to reset my passkey firstly because of invalid info hash. After that i downloaded a torrent it connected with the passkey, i edited the torrent in utorrent, removed the passkey and it connected again! I had to increase the leech limit from 1 to 2 mainly because i got the "only leech from one location at a time" error. But it's working!!! :D :D :D Thank you so much for all your work tonight, i really appreciate it. I will leave this on the site overnight and see what members report, but i will make an announcement telling everyone to reset their passkey first to make sure :) Amazing work man! Bump: Ahh crap, spoke too soon. Tried to add a torrent into my seedbox and it came back wit invalid info hash. And i have noticed that only certain torrents are working and others are reporting invalid info hash even with resetting the passkey.. Bump: Yup, just tested my seedbox out with a few different torrents. Some work and connect fine, while others won't, they say invalid info hash even after resetting the passkey. |
#27
|
||||
|
||||
please PM me a fresh downloaded torrent that is giving you this error.
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent Do not ask me to make a mod for any other source Do not Ask me to setup your site. I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum My Current Demo is here http://demo.btmanager.org/ |
#28
|
|||
|
|||
Sent in PM
Bump: Well i have had this announce running for 24 hours and my server load has gone through the roof, pages are taking close to 45 seconds to load up. 13014 nobody 15 0 48188 6016 4172 S 2.0 0.1 0:00.27 lsphp5:/home/xtremewr/public_html/announce.php 13084 nobody 15 0 48172 5084 3392 S 2.0 0.1 0:00.06 lsphp5:/home/xtremewr/public_html/announce.php 12788 nobody 15 0 48212 6376 4444 S 1.7 0.2 0:00.76 lsphp5:/home/xtremewr/public_html/announce.php 13023 nobody 15 0 48508 6048 3848 S 1.7 0.1 0:00.17 lsphp5:/home/xtremewr/public_html/announce.php Can anyone have a look and help me optimize it? Code:
<? $free = false; $double = false; require_once("include/bittorrent.php"); require_once("include/benc.php"); 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); } // To resolve BitTornado stupidity if (strpos($_GET["passkey"], "?")) { $chop = $_GET["passkey"]; $delim = "?"; $half = strtok($chop, $delim); $onehalf = array(); while(is_string($half)) { if ($half) $onehalf[] = $half; $half = strtok($delim); } $_GET["passkey"] = $onehalf[0]; $delim2 = "="; $hash = strtok($onehalf[1], $delim2); $onehash = array(); while(is_string($hash)) { if ($hash) $onehash[] = $hash; $hash = strtok($delim2); } $_GET["info_hash"] = $onehash[1]; } $dopasskey = array_key_exists('passkey', $_GET); if($dopasskey){ $dopasskey = true; //err("Doing passkey"); $paskey = ":!passkey"; } else { $dopasskey = false; //err("Not doing passkey"); $paskey = ""; } $req = "info_hash:peer_id:!ip:port:uploaded:downloaded:left:!event$paskey"; foreach (explode(":", $req) as $x) { if ($x[0] == "!") { $x = substr($x, 1); $opt = 1; } else $opt = 0; if (!isset($_GET[$x])) { if (!$opt) err("missing key"); continue; } $GLOBALS[$x] = unesc($_GET[$x]); } $passkey = $_GET["passkey"]; if($dopasskey){ if ((strlen($passkey) != 32 && @mysql_num_rows(@mysql_query("SELECT id FROM users WHERE passkey=" . sqlesc($passkey))) != 1)) err("Invalid passkey! Re-download the .torrent from $BASEURL ($passkey)"); $passkey=sqlesc($passkey); } foreach (array("info_hash","peer_id") as $x) { if (strlen($GLOBALS[$x]) != 20) err("invalid $x (" . strlen($GLOBALS[$x]) . " - " . urlencode($GLOBALS[$x]) . ")"); } //if (empty($ip) || !preg_match('/^(\d{1,3}\.){3}\d{1,3}$/s', $ip)) $ip = getip(); $port = 0 + $port; $downloaded = 0 + $downloaded; $uploaded = 0 + $uploaded; $left = 0 + $left; $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"]; // Deny access made with a browser... if (ereg("^Mozilla\\/", $agent) || ereg("^Opera\\/", $agent) || ereg("^Links ", $agent) || ereg("^Lynx\\/", $agent)) err("torrent not registered with this tracker"); if (!$port || $port > 0xffff) err("invalid port"); if (!isset($event)) $event = ""; $seeder = ($left == 0) ? "yes" : "no"; dbconn(false); //$res = mysql_query("SELECT $fields FROM peers WHERE torrent = $torrentid AND connectable = 'yes' $limit") or err('nog iets'); $res = mysql_query("SELECT id, banned, seeders + leechers AS numpeers, UNIX_TIMESTAMP(added) AS ts FROM torrents WHERE " . hash_where("info_hash", $info_hash)); $torrent = mysql_fetch_assoc($res); if (!$torrent) err("torrent not registered with this tracker"); $torrentid = $torrent["id"]; // Modified ABnormal Upload Speed Detector! //$fields = "seeder, peer_id, ip, port, uploaded, downloaded, userid"; $fields = "seeder, peer_id, ip, port, uploaded, downloaded, userid, UNIX_TIMESTAMP(last_action) AS ts"; //end of Modified Abnormal Upload speed detector! $numpeers = $torrent["numpeers"]; $limit = ""; if ($numpeers > $rsize) $limit = "ORDER BY RAND() LIMIT $rsize"; $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; } if($compact) { $peer_ip = explode('.', $row["ip"]); $plist .= pack("C*", $peer_ip[0], $peer_ip[1], $peer_ip[2], $peer_ip[3]). pack("n*", (int)$row["port"]); } else { $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"; $resp .= ($compact ? benc_str($plist):''). "ee"; if($dopasskey){ $selfwhere = "torrent = $torrentid AND ". ("passkey=$passkey AND ") . hash_where("peer_id", $peer_id); } else { $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 //////////////////////////////////////////////////////////// $passkey = $_GET["passkey"]; if (!isset($self)) { if($dopasskey){ $valid = @mysql_num_rows(@mysql_query("SELECT id FROM peers WHERE torrent='$torrentid' AND passkey='$passkey'")); if ($valid[0] >= 1 && $seeder == 'no') err("Connection limit exceeded! You may only leech from one location at a time."); if ($valid[0] >= 3 && $seeder == 'yes') err("Connection limit exceeded!"); } if($dopasskey){ $sql = "SELECT id, uploaded, downloaded, class FROM users WHERE enabled = 'yes' AND passkey='$passkey' ORDER BY last_access DESC LIMIT 1"; $rz = mysql_query($sql); //or err("Tracker error 2 - $passkey and $ip"); if (mysql_num_rows($rz) == 0) err($rows ." Unrecognized host ($ip). Please go to $BASEURL to sign-up or login."); } else { $rz = mysql_query("SELECT id, uploaded, downloaded, class FROM users WHERE ip='$ip' AND enabled = 'yes' ORDER BY last_access DESC LIMIT 1"); // or err("Tracker error 2"); if (mysql_num_rows($rz) == 0) err("ip - Unrecognized host ($ip). Please go to $BASEURL to sign-up or login."); } $az = mysql_fetch_assoc($rz); $userid = $az["id"]; // Get the last uploaded amount from user account for reference and store it in $last_up $rst = mysql_query("SELECT class, uploaded FROM users WHERE id = $userid") or err("Tracker error 5"); $art = mysql_fetch_array($rst); $last_up = $art["uploaded"]; $class = $art["class"]; $upthis = max(0, $uploaded - $self["uploaded"]); $downthis = max(0, $downloaded - $self["downloaded"]); if ($free) $downthis = 0; if ($double) $upthis *= 2; if ($upthis > 0 || $downthis > 0) mysql_query("UPDATE users SET uploaded = uploaded + $upthis". ($torrent['free']=='no'?", downloaded = downloaded + $downthis ":' '). "WHERE id=$userid") or err("Tracker error 3"); // 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 (2097152). Increase to 5MB/s (5242880) once finished testing. if ($rate > 2097152) { if ($class < UC_MODERATOR) { $rate = mksize($rate); $client = $agent; $userip = getip(); auto_enter_cheater($userid, $rate, $upthis, $diff, $torrentid, $client, $userip, $last_up); } } } } /////////////////////////////////////////////////////////////////////////////// function portblacklisted($port) { // direct connect if ($port >= 411 && $port <= 413) return true; // bittorrent if ($port >= 6881 && $port <= 6889) return true; // kazaa if ($port == 1214) return true; // gnutella if ($port >= 6346 && $port <= 6347) return true; // emule if ($port == 4662) return true; // winmx if ($port == 6699) return true; 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") { $updateset[] = "times_completed = times_completed + 1"; mysql_query("INSERT INTO snatched (torrentid,userid) VALUES ($torrentid,$userid)"); } if (isset($self)) { 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 ($az["parked"] == "yes") err("Error, your account is parked! Please read the FAQ!"); if (portblacklisted($port)) err("Port $port is blacklisted."); else { $sockres = @fsockopen($ip, $port, $errno, $errstr, 5); if (!$sockres) $connectable = "no"; else { $connectable = "yes"; @fclose($sockres); } } $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"); benc_resp_raw($resp); ?> Last edited by ZenoX; 20th March 2012 at 19:11. |
Tags |
account , adding , address , ip , member , seedbox |
|
|