Website is too slow [closed]

1

This site uploads .torrent files, downloads, opens magnet, takes seeds, leechers, etc., however it is VERY SLOW , it takes about 15 seconds to open. >

What can I do to reduce this 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;
            }
        }
        ?>
    
asked by anonymous 13.05.2015 / 01:41

1 answer

1

Try closing the PHP connections as soon as you're done with query() . JQuery / Javascript places in a separate file saved with .js extension. Beware of extreme spaces (no need). Look at your code and think "is this really accurate?". But what I think is more important is the issue of closing the connections / actions after doing query() , because doing so, you will use less memory. If you have many images on your site or large images (type 1MB, 2MB, etc.) I recommend that you use the site compressor.io it will help you a lot in the matter of images.

    
13.05.2015 / 01:49