View file index.php

File size: 3.01Kb
<?php
Error_Reporting(E_ALL & ~E_NOTICE);
include("conf/config.php");
include("conf/header.php");
if(!isset($_REQUEST['sort']) or $_REQUEST['sort']=="name"){
echo "<ul>";
$fl=array();	
$dir_pointer=opendir(".");
while (($res=readdir($dir_pointer))!==FALSE){
if($res==".")unset($res);	
if($res=="..")unset($res);	
if($res=="index.php")unset($res);	
if(!$res==""){
array_push($fl,$res);}
}
sort($fl);
$cnt=count($fl);
$n = $kol_vo; 
@$p= intval($_REQUEST['p']); 
if(empty($_REQUEST['page']) or $_REQUEST['page']<1) {$_REQUEST['page']=1; } 
if($_REQUEST['page']>$cnt) { $page=$cnt; } 
$pages = intval(($cnt-1 )/$n+1); 
$st = $_REQUEST['page']*$n-$n; 
$nx = $st+$n;
for($i=$st; $i<$nx;$i++)
{
if(!isset($fl[$i]))continue;
$fname1= ereg_replace ($filex, "", $fl[$i]);
$fnsize1= round(filesize ($fl[$i]) /1024 , 1);
$fninfo1="info/".$fname1.".txt";
if ($fl[$i] !="info" and $fl[$i] !="conf") {
if (file_exists($fninfo1)) {echo "<li><a href=\"$fl[$i]\">$fname1</a> ($fnsize1 Kb)<br/>"; include($fninfo1); echo "</li>";}
else {echo "<li><a href=\"$fl[$i]\">$fname1</a> ($fnsize1 Kb)</li>";};}
}
echo "</ul>";
echo "Страницы:<br/>";
for($c=0; $c<$pages; $c++) { 
$pg = $c+1; 
if($pg == $_REQUEST['page']) {
echo "|&nbsp;<span class=\"bold\">$pg</span>&nbsp;|"; } 
else {echo "|&nbsp;<a href=\"./?page=".$pg."&sort=name\">".$pg."</a>&nbsp;|"; } 
}
echo "<br/>Сортировать:<br/>
По имени | <a href=\"./?sort=date&page=1\">По дате</a>";
include("conf/footer.php");
}
if(isset($_REQUEST['sort']) and $_REQUEST['sort']=="date"){
echo "<ul>";
$fl=array();	
$dir_pointer=opendir(".");
while (($res=readdir($dir_pointer))!==FALSE){
if($res==".")unset($res);	
if($res=="..")unset($res);	
if($res=="index.php")unset($res);	
if(!$res==""){array_push($fl,$res);}
}
for($i=0; $i<count($fl); $i++) { 
$time[$fl[$i]] = filectime($fl[$i]); } 
asort($time); 
$keys = array_keys($time); 
$cnt=count($keys);
$n = $kol_vo; 
@$p= intval($_REQUEST['p']); 
if(empty($_REQUEST['page']) or $_REQUEST['page']<1) { $page=1; } 
if($_REQUEST['page']>$cnt) { $page=$cnt; } 
$pages = intval(($cnt-1 )/$n+1); 
$st = $_REQUEST['page']*$n-$n; 
$nx = $st+$n;
for($i=$st; $i<$nx;$i++)
{
if(!isset($keys[$i]))continue;
$fname2= ereg_replace ("$filex", "", $keys[$i]);
$fnsize2= round(filesize ($keys[$i]) /1024 , 1);
$fninfo2="info/".$fname2.".txt";
if ($keys[$i] !="info" and $keys[$i] !="conf") {
if (file_exists($fninfo2)) {echo "<li><a href=\"$keys[$i]\">$fname2</a> ($fnsize2 Kb)<br/>"; include($fninfo2); echo "</li>";}
else {echo "<li><a href=\"$keys[$i]\">$fname2</a> ($fnsize2 Kb)</li>";};}
}
echo "</ul>";
echo "Страницы:<br/>";
for($c=0; $c<$pages; $c++) {
$pg = $c+1; 
if($pg == $_REQUEST['page']) {
echo "|&nbsp;<span class=\"bold\">$pg</span>&nbsp;|"; } 
else {echo "|&nbsp;<a href=\"./?page=".$pg."&sort=date\">".$pg."</a>&nbsp;|"; }
}
echo "<br/>Сортировать:<br/>	
<a href=\"./?sort=name&page=1\">По имени</a> | По дате";
include("conf/footer.php");
}
?>