$ipv6 = ( preg_match("/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/",$_SERVER['REMOTE_ADDR']) ? false : true);
?>
//define the path as relative
$path = ".";
$TAG_precedent = "5";
$TAG_H5 = "5";
$TAG_H4 = "4";
//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");
echo " Exemples de Fichiers de Configuration
";
//running the while loop
while ($file = readdir($dir_handle)) {
$file_size= filesize("$path/$file");
if ($file_size >= 1073741824) {
$file_size = round($file_size / 1073741824 * 100) / 100 . " Go";
} elseif ($file_size >= 1048576) {
$file_size = round($file_size / 1048576 * 100) / 100 . " Mo";
} elseif ($file_size >= 1024) {
$file_size = round($file_size / 1024 * 100) / 100 . " Ko";
} else {
$file_size = $file_size . " bytes";
}
if ( ( $file != '.htaccess' ) && ( $file != 'valid-xhtml11.png' ) && ( $file != 'virus' )&& ( $file != 'css.png' ) && ( $file != '.htpasswd' ) && ( $file != '..' ) && ( $file!='.') && ( $file!='.index.php.swp') && ( $file!='index.php~')&& ( $file!= 'index.php' ) && ( $file!= 'index.css' ) ){
if ($TAG_precedent == $TAG_H5)
{
echo " $file" ;
$TAG_precedent = $TAG_H4;
}
else
{
echo "\n $file
" ;
$TAG_precedent = $TAG_H5;
}
}
}
//closing the directory
closedir($dir_handle);
?>
if($ipv6) {
echo 'Vous êtes connecté en IPv6 : '.$_SERVER['REMOTE_ADDR'].'
correspondant à ' .gethostbyaddr($_SERVER['REMOTE_ADDR']). ' Accès v4 : ici
'; }
else {
echo 'Vous êtes connecté en IPv4 : '.$_SERVER['REMOTE_ADDR'].'
correspondant à ' .gethostbyaddr($_SERVER['REMOTE_ADDR']). ' Accès v6 : ici
'; }
?>