View file list.php

File size: 2.49Kb
<?php
error_reporting(0);
$k=trim($_GET['k']); include("key.php");
$d=rawurldecode(trim($_GET['d'])); $n=rawurldecode(trim($_GET['n']));
if ($d==NULL) {$d="";} else {if ($d=="/") {$d="";}}
if ($n==NULL) {$n=preg_replace("~.*/([^/]*)~m","\\1",$d);
$d=preg_replace("~(.*)/[^/]*~m","\\1",$d);}
$rd=rawurlencode($d); $rn=rawurlencode($n);
$d=str_replace('$','$$',$d); $n=str_replace('$','$$',$n);
$d=str_replace(".|htaccess",".htaccess",$d);
$n=str_replace(".|htaccess",".htaccess",$n);

$fls=@file("data/$k.act"); $links="";
if ($fls<>NULL) {$bln=true;
 $p=trim($_GET['p']); $cnt=count($fls); $v=20; $allp=ceil($cnt/$v);
 if (($p==NULL)||($p==0)) {$p=1;} elseif ($p>$allp) {$p=$allp;}
 $begin=$p*$v-$v; if ($begin>$cnt) {$begin=0;}
 $end=$begin+$v; if ($end>$cnt) {$end=$cnt;}
 for ($i=$begin;$i<$end;$i++) {
  list($p1,$p2,$p3)=split('[|]',$fls[$i]);
  $p1=trim($p1); $p2=trim($p2); $p3=trim($p3);
  if ($p3=="copy") {$act=" [К]";}
  elseif ($p3=="cut") {$act=" [П]";}
  elseif ($p3=="arh") {$act=" [ZIP]";}
  elseif ($p3=="at1") {$act=" [TAR]";}
  elseif ($p3=="at2") {$act=" [TGZ]";}
  elseif ($p3=="at3") {$act=" [TGZ2]";}
  elseif ($p3=="at4") {$act=" [TBZ]";}
  elseif ($p3=="at5") {$act=" [TBZ2]";} else {$act="";}
  $links.="<a href=\"actn.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ac=rm&amp;lnm=".str_replace(".htaccess",".|htaccess",$p1)."&amp;go=1\">[X]</a> $p1$act<br/>\r\n";
 } $bl="";
 if ($p>1) {$v=$p-1; $bl.="<a href=\"list.php?k=$k&amp;d=$rd&amp;n=$rn&amp;p=$v\">Предыдущие</a><br/>\r\n";}
 if ($allp>$p) {$v=$p+1; $bl.="<a href=\"list.php?k=$k&amp;d=$rd&amp;n=$rn&amp;p=$v\">Следующие</a><br/>\r\n";}
 if ($bl<>NULL) {$bl.="- - -<br/>";}
} else {$bln=false; $links="Нет записей.<br/>";}
header("Content-Type: text/vnd.wap.wml; charset=Utf-8");
echo("<?xml version=\"1.0\" encoding=\"Utf-8\"?><!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml_1.2.xml\"><wml>
<head><meta forua=\"true\" http-equiv=\"Cache-Control\" content=\"no-cache,no-store,must-revalidate\"/></head><card title=\"FTP - Список\">
<p align=\"left\"><small>
<a href=\"ftp.php?k=$k&amp;d=$rd&amp;n=$rn\">$d/$n</a><br/>
- - -<br/>
$links- - -<br/>$bl");
if ($bln) {echo("<a href=\"listex.php?k=$k&amp;d=$rd&amp;n=$rn\">Выполнить действия</a><br/>
<a href=\"actn.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ac=rmall&amp;go=1\">Очистить список</a><br/>
- - -<br/>");}
echo("<anchor>Назад<prev/></anchor>
</small></p>
</card></wml>");
?>