Removed some unnecessary parts from your code which weren't needed to improve speed.
Add rest of your html code below the '.....' part.
[color=rgb(250, 197, 28)]Important: [/color]
array_pop($tracker) will only scrape the
last announce in additional trackers and show stats for it (It will also update all other additional trackers, but will take stats only from last one). So stats might look very low.
if ($scrape == '1') {
$seeders = $leechers = $downloaded = NULL;
$tress = SQL_Query_exec("SELECT * FROM `announce` WHERE `torrent` = $id");
if (mysqli_num_rows($tress) > 1) {
$resu = SQL_Query_exec("SELECT url FROM announce WHERE torrent=$id");
} else {
$resu = SQL_Query_exec("SELECT id, info_hash, announce FROM torrents WHERE external = 'yes' AND id = $id");
}
while ($rowu = mysqli_fetch_array($resu)) {
if (mysqli_num_rows($tress) > 1) {
$ann = $rowu["url"];
} else {
$ann = $rowu["announce"];
}
$annlist = array($ann);
$seeders = $leechers = $downloaded = NULL;
foreach ($annlist as $ann) {
$tracker = explode("/", $ann);
$path = array_pop($tracker);
$oldpath = $path;
$path = preg_replace("/^announce/", "scrape", $path);
$tracker = implode("/", $tracker) . "/" . $path;
if ($oldpath == $path) {
continue;
}
}
if (preg_match('/udp:\/\//', $tracker)) {
$udp = true;
try {
$timeout = 5;
$udp = new udptscraper($timeout);
$stats = $udp->scrape($tracker, $row["info_hash"]);
foreach ($stats as $idu => $scrape) {
$seeders1+= $scrape['seeders'];
$leechers1+= $scrape['leechers'];
$downloaded1+= $scrape['completed'];
}
}
catch(ScraperException $e) {
$e->isConnectionError();
}
} else {
$stats = torrent_scrape_url($tracker, $row["info_hash"]);
}
if ($scrape['seeds'] != - 1) {
$seeders+= $scrape['seeds'];
$leechers+= $scrape['peers'];
$downloaded+= $scrape['downloaded'];
SQL_Query_exec("UPDATE `announce` SET `online` = 'yes', `seeders` = '" . $scrape["seeders"] . "', `leechers` = '" . $scrape["leechers"] . "', `times_completed` = '" . $scrape["completed"] . "' WHERE `url` = " . sqlesc($ann) . " AND `torrent` = $id");
} else {
SQL_Query_exec("UPDATE `announce` SET `online` = 'no' WHERE `url` = " . sqlesc($ann) . " AND `torrent` = $id");
}
}
if ($seeders !== NULL) {
SQL_Query_exec("UPDATE torrents SET leechers = '" . $scrape["leechers"] . "', seeders = '" . $scrape["seeders"] . "', times_completed = '" . $scrape["completed"] . "', last_action = '" . get_date_time() . "', visible = 'yes' WHERE id = '" . $row['id'] . "'");
} else {
SQL_Query_exec("UPDATE torrents SET last_action = '" . get_date_time() . "' WHERE id ='" . $row['id'] . "'");
}
//===| End UDP Scraper
if ($seeders !== NULL)
{
print ("<div style='margin-bottom:5px; margin-left:20px'><b>".T_("LIVE_STATS")."</b>: </div>");
print ("<div style='margin-left:20px'>".T_("SEEDERS").": <font color='limegreen'>".$scrape["seeders"]."</font></div>");
print ("<div style='margin-left:20px'>".T_("LEECHERS").": <font color='#FF2000'>".$scrape["leechers"]."</font></div>");
print ("<div style='margin-left:20px'>".T_("COMPLETED").": <font color='#0080FF'>".$scrape["completed"]."</font></div>");
}
.......