1
This site uploads files . torrent, downloads, opens Magnet, takes Seeds, leechers, etc, but it is VERY SLOW, it takes about 15 seconds to open.
what I can do to reduce that time?
if($sql = mysqli_query($coneccao, "SELECT * FROM arquivos_downloads WHERE nome LIKE '%$palavra_chave%' ORDER BY id DESC"))
{
while($linha = mysqli_fetch_array($sql))
{
if($i == $linha['id'] || $i != $linha['id'])
{
$arq = $linha['nome'];
$arq_title = $arq;
$arq_nome = substr($linha['nome'], 0, 50);
$arq_nome = str_replace("_", " ", $arq_nome);
for($icont = 0; $icont <= 100; $icont++)
{
$arq_nome = str_replace("[".$icont."]", "", $arq_nome);
$arq_title = str_replace("[".$icont."]", "", $arq_title);
}
error_reporting(E_STRICT);
ini_set('user_agent', 'PHP');
$torrent = new Torrent("Uploads/".$arq.".torrent");
$torrentHash = $torrent->hash_info();
$SeedsLeechs = obterSeedLeech($torrentHash);
$SeedsLeechs = json_decode($SeedsLeechs);
if (is_array($SeedsLeechs))
{
foreach($SeedsLeechs as $anuncios)
{
$seeds = $seeds + $anuncios->NUM_SEEDERS;
$leechers = $leechers + $anuncios->NUM_LEECHERS;
}
}
?>
//AQUI TEM UM MONTE DE DIV QUE NÃO ATRAPALHA
<?
}
$seeds = 0;
$leechers = 0;
}
}
?>
Lucas, edit the question and leave only the code relevant so that someone can help you.
– stderr
I just left the part that really slows down the site
– Lucas Caresia
Have you tried to analyze if the problem is in the bank consultation? To do this, you can run the query using Mysql Workbench (or similar) or calculate the time before and after the database calls.
– Vinícius Gobbo A. de Oliveira