Exemple #1
0
 function copyRemote($src, $dest)
 {
     //  On essaye de forcer les limites du serveur..
     @set_time_limit(0);
     @max_execution_time(0);
     // Si CURL est installé on l'utilise c'est mieux que les sockets.
     if (function_exists('curl_init')) {
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, $src);
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($curl, CURLOPT_HEADER, false);
         curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
         $info = curl_exec($curl);
         curl_close($curl);
     } else {
         //  Sinon on utilise Fsocket mais il est limité sur les gros fichiers
         $errno = 0;
         $url = parse_url($src);
         $errstr = $info = '';
         $fichier = '';
         $fichier .= $url['path'] != '' ? $url['path'] : '';
         $fichier .= $url['query'] != '' ? '?' . $url['query'] : '';
         $fsock = @fsockopen($url['host'], 80, $errno, $errstr, 10);
         @fputs($fsock, "GET " . $fichier . " HTTP/1.1\r\n");
         @fputs($fsock, "HOST: " . $url['host'] . " \r\n");
         @fputs($fsock, "Connection: close\r\n\r\n");
         $get_info = false;
         while (!@feof($fsock)) {
             if ($get_info) {
                 $info .= @fread($fsock, 1024);
             } else {
                 if (@fgets($fsock, 1024) == "\r\n") {
                     $get_info = true;
                 }
             }
         }
         @fclose($fsock);
     }
     if (($fp2 = @fopen($dest, 'w')) === false) {
         return 'Impossible d\'écrire les données du jeu sur le disque.';
     } else {
         fwrite($fp2, $info);
         fclose($fp2);
         return true;
     }
 }
function tableau_limitations_PHP()
{
	global $tab_commentaires;
	return'
		<table class="p">
			<thead>
				<tr><th colspan="2">Réglage des limitations PHP</th></tr>
			</thead>
			<tbody>
				<tr><td><img alt="" title="'.$tab_commentaires['max_execution_time'].'" src="./_img/bulle_aide.png" /> max execution time</td><td class="hc">'.max_execution_time().'</td></tr>
				<tr><td><img alt="" title="'.$tab_commentaires['memory_limit'].'" src="./_img/bulle_aide.png" /> memory limit</td><td class="hc">'.memory_limit().'</td></tr>
				<tr><td><img alt="" title="'.$tab_commentaires['post_max_size'].'" src="./_img/bulle_aide.png" /> post max size</td><td class="hc">'.post_max_size().'</td></tr>
				<tr><td><img alt="" title="'.$tab_commentaires['upload_max_filesize'].'" src="./_img/bulle_aide.png" /> upload max filesize</td><td class="hc">'.upload_max_filesize().'</td></tr>
				<tr><td><img alt="" title="'.$tab_commentaires['safe_mode'].'" src="./_img/bulle_aide.png" /> safe_mode</td>'.safe_mode().'</tr>
				<tr><td><img alt="" title="'.$tab_commentaires['open_basedir'].'" src="./_img/bulle_aide.png" /> open_basedir</td>'.open_basedir().'</tr>
				<tr><td><img alt="" title="'.$tab_commentaires['ini_set_memory_limit'].'" src="./_img/bulle_aide.png" /> ini_set(memory_limit)</td>'.ini_set_memory_limit().'</tr>
			</tbody>
		</table>
	';
}