note 49860 added to function.readdir
| From: | machitopeleon at hotmail dot com | Date: | Thu, 10 Feb 2005 17:20:17 +0000 |
| Subject: | note 49860 added to function.readdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84802@lists.php.net to get a copy of this message | ||
<?php
$ficheros=array();
$dir=opendir(".");
?>
<table width='100%' border='3' cellpadding='5'
cellspacing='0' align='center' style='border-collapse: collapse'
bordercolor= #006898>
<tr>
<td width="100%" colspan="3" bgcolor= #EEEEEE>
</tr>
<tr>
<td width="100%" bgcolor= #CCCCCC height="7"
class="tabla_subtitulo"><font face="arial"
size="4"><b>PAQUETES DE ACTUALIZACIÓN
DISPONIBLES</b></font></td>
<td bgcolor= #CCCCCC class="tabla_subtitulo"><font face="arial"
size="4"><b>TAMAÑO</b></font></td>
<td bgcolor= #CCCCCC class="tabla_subtitulo"><font face="arial"
size="4"><b>FECHA</b></font></td>
</tr>
<?
while(false !== ($file= readdir($dir))){
if ($file != "." && $file != "..") {
$ficheros[]=$file;
}
}
closedir($dir);
sort($ficheros);
while (list ($key, $val) = each ($ficheros))
{
$elemento1 = strtolower($val);
if (strpos($elemento1, ".z") > 1 || strpos($elemento1, ".exe") > 1)
{
$elementotiempo = filemtime("$val");
$fecha=explode(",",date(",d,m,y,h,i,s,",$elementotiempo));
$fecha="$fecha[1]/$fecha[2]/$fecha[3]";
$tamano = filesize($val)/1024;
$tamano = ceil($tamano) ;
?>
<tr>
<td bgcolor= #EEEEEE height='10' class='tabla_mensaje'><a
href="<?php echo $val ?>"><font face="arial"
size="3"><b><?php echo $val; ?></b></font></a></td>
<td bgcolor= #EEEEEE height='10' class='tabla_mensaje'><font
face="arial" size="3"><b><?php echo $tamano ; ?>
Kb</b></font></td>
<td bgcolor= #EEEEEE height='10' class='tabla_mensaje'><font
color="#FF0000" face="arial" size="3"><b><? echo $fecha ;
?></b></font></td>
</tr>
<?
}
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.readdir.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49860
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49860&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49860&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49860&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49860&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49860&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49860&report=yes
Search -- http://master.php.net/manage/user-notes.php