View file ftp.php

File size: 3.61Kb
<?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="";} if ($n==NULL) {$n="";}
$rd=rawurlencode($d); $rn=rawurlencode($n);
$d=str_replace(".|htaccess",".htaccess",$d);
$n=str_replace(".|htaccess",".htaccess",$n);

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>
<card title=\"FTP - ".strtoupper($lg)."\">
<do name=\"back\" type=\"options\" label=\"Назад\"><prev/></do><do name=\"go\" type=\"options\" label=\"Перейти\"><go href=\"$dftp/go.php?k=$k&amp;d=$rd&amp;n=$rn\"/></do><do name=\"faq\" type=\"options\" label=\"FAQ\"><go href=\"$dftp/faq.php\"/></do><do name=\"exit\" type=\"options\" label=\"Выход\"><go href=\"$dftp/exit.php?k=$k\"/></do>\r\n");

if (($ftp=@ftp_connect($sr))&&(@ftp_login($ftp,$lg,$ps))) {
 @ftp_pasv($ftp,true); $links="";
 ftp_chdir($ftp,$d."/".$n); $curd=ftp_pwd($ftp);
 if ($curd<>"/") {
  $back=preg_replace("~(.*)/[^/]*~m","\\1",$curd);
  $back=str_replace(".htaccess",".|htaccess",$back);
 }
 include("flist.php"); $fls=flist($ftp,$curd,$k);
 @ftp_close($ftp);

 $p=trim($_GET['p']); $cnt=count($fls);
 $v=$skl; if (($v<1)||($v>100)) {$v=15;} $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++) {$links.=$fls[$i]."<br/>\r\n";} $bl="";
 if ($p>1) {$v=$p-1; $bl.="<a href=\"ftp.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=\"ftp.php?k=$k&amp;d=$rd&amp;n=$rn&amp;p=$v\">Следующая</a><br/>\r\n";}
 if ($bl<>NULL) {$bl="- - -<br/>Страница: $p/$allp<br/>$bl</small><input name=\"pg\" type=\"text\" value=\"$p\" size=\"3\" format=\"*N\"/><small><a href=\"ftp.php?k=$k&amp;d=$rd&amp;n=$rn&amp;p=$(pg)\">GO</a><br/>\r\n";}
$d=str_replace("\$","\$\$",$d); $n=str_replace("\$","\$\$",$n);
$curd=str_replace("\$","\$\$",$curd); $links=str_replace("\$","\$\$",$links);
echo("<p align=\"left\"><small>
$curd<br/>- - -<br/>");
if ($curd<>"/") {
 if ($ib==1) {
  $icn="<img src=\"icons/back.png\" width=\"16\" height=\"16\" alt=\"&lt;\"/>";
 } else {$icn="&lt;";}
 echo("$icn<a href=\"ftp.php?k=$k&amp;d=$back\">..</a><br/>");
}
echo("$links$bl");
if ($curd<>"/") {echo("- - -<br/>В список:[<a href=\"actn.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ac=copy&amp;t=d&amp;go=1\">К</a>][<a href=\"actn.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ac=cut&amp;t=d&amp;go=1\">П</a>]<br/>
<a href=\"arhdir.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=mv&amp;t=d\">Переместить..</a><br/>
<a href=\"actn.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ac=ren&amp;t=d\">Переименовать</a><br/>
<a href=\"actn.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ac=delf\">Удалить</a><br/>");}
echo("- - -<br/>
<a href=\"create.php?k=$k&amp;d=$rd&amp;n=$rn\">Создать..</a><br/>
<a href=\"list.php?k=$k&amp;d=$rd&amp;n=$rn\">Список</a><br/>
<a href=\"import.php?k=$k&amp;d=$rd&amp;n=$rn\">Импорт</a><br/>
<a href=\"upload.php?k=$k&amp;d=$rd&amp;n=$rn\">Upload</a>
</small></p>
</card></wml>");
} else {
echo("<p align=\"center\"><small>
Нет соединения с сервером.<br/>
- - -<br/>
<anchor>Назад<prev/></anchor>
</small></p>
</card></wml>");//<a href=\"find.php?k=$k&amp;d=$rd&amp;n=$rn\">Поиск</a>
}
?>