<? if(isset($_GET['delfile'])) { $file2del=$_GET['delfile']; @unlink('images/'.$file2del); } $todel=$_POST['todel']; while (list ($key,$val) = @each ($todel)) { @unlink('images/'.$val); } $dir = "images"; $list = scandir( $dir ); foreach( $list as $name ) { $time[$name] = filemtime( $dir."/".$name ); } arsort( $time ); $cnt = 0; echo "<table width=100% class=sort><thead><td>Название файла</td><td>Дата загрузки</td><td align=center width=20px>Кнопа</td><td align=center width=20px>Чека</td><tr></thead><tbody>"; foreach( $time as $file => $value ) { if ( $file != "." and $file != "..") { echo " <form action='inf.php?delfile=".$file."' method=post><tr><td>".$file." </td> <td> ".date("d.m.Y H:i:s", $value)."</td> <td> <input type='checkbox' value=".$file." name=todel[]> </td> <td align=center width=20px> <input type=submit value=удалить></td> "; $cnt = $cnt + 1; } if ( $cnt == 100 ) break; } echo "<input type=submit value='удалить выделенные'> </form></tbody></table> "; ?>
<? if(isset($_POST['delfile'])) { $file2del=$_POST['delfile']; @unlink('images/'.$file2del); } $todel=$_POST['todel']; while (list ($key,$val) = @each ($todel)) { @unlink('images/'.$val); } $dir = "images"; $list = scandir( $dir ); foreach( $list as $name ) { $time[$name] = filemtime( $dir."/".$name ); } arsort( $time ); $cnt = 0; echo "<table width=100% class=sort><thead><td>Название файла</td><td>Дата загрузки</td><td align=center width=20px>Чека</td><tr></thead><tbody>"; echo "<form action='' method=post>"; foreach( $time as $file => $value ) { if ( $file != "." and $file != "..") { echo "<tr><td>".$file." </td> <td> ".date("d.m.Y H:i:s", $value)."</td> <td> <input type='checkbox' value=".$file." name=todel[]> </td> "; $cnt = $cnt + 1; } if ( $cnt == 100 ) break; } echo "<input type=submit value='удалить выделенные'> </form></tbody></table> "; ?>