View file ftp_servis/file.php

File size: 5.49Kb
<?php
error_reporting(0);
$k=trim($_GET['k']); include("key.php");
include_once("freedata.php"); freedata($k,0);
$d=rawurldecode(trim($_GET['d'])); $n=rawurldecode(trim($_GET['n']));
if ($d==NULL) {$d="";} elseif ($d=="/") {$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>
<head><meta forua=\"true\" http-equiv=\"Cache-Control\" content=\"no-cache,no-store,must-revalidate\"/></head><card title=\"FTP - ".strtoupper($lg)."\"><do name=\"back\" type=\"options\" label=\"Назад\"><prev/></do>\r\n");

if (($ftp=@ftp_connect($sr))&&(@ftp_login($ftp,$lg,$ps))) {
 @ftp_pasv($ftp,true);
 $sz=@ftp_size($ftp,"$d/$n");
 $tm=@ftp_mdtm($ftp,"$d/$n");
 @ftp_close($ftp);

 $fsz=$sz;
 if ($sz<1024) {$sz="$sz байт";}
 elseif (($sz>=1024)&&($sz<1048576)) {$sz=strtr(round($sz/1024,2),".",",")." кб";}
 elseif ($sz>=1048576) {$sz=strtr(round($sz/1024/1024,2),".",",")." мб";}

 if ($tm<>NULL) {$tmv=date("d.m.y, H:i:s",$tm);} else {$tmv="-";}
 $d=str_replace("\$","\$\$",$d); $n=str_replace("\$","\$\$",$n);
 $rf=strtolower(preg_replace("~.*\.([^.]*)~m","\\1",$n));
echo ("<p align=\"left\"><small>
<a href=\"ftp.php?k=$k&amp;d=$rd\">$d/</a>$n<br/>
- - -<br/>
Размер: $sz<br/>
Изменён: ".$tmv."<br/>\r\n");

if ((($rf=="zip")||($rf=="jar")||($rf=="tar")||($rf=="tgz")||($rf=="gz")||($rf=="gz2")||($rf=="bz")||($rf=="bz2")||($rf=="tbz")||($rf=="tbz2")||($rf=="tgz2"))&&($fsz<=716800)&&($fsz>0)) {echo("- - -<br/><a href=\"openarh.php?k=$k&amp;d=$rd&amp;n=$rn&amp;tp=$rf\">Открыть..</a><br/>");
if (($rf=="zip")||($rf=="jar")) {echo("<a href=\"zip.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ac=ext\">Разархивировать</a><br/>");}
elseif (($rf=="tar")||($rf=="tgz")||($rf=="gz")||($rf=="gz2")||($rf=="bz")||($rf=="bz2")
||($rf=="tbz")||($rf=="tbz2")||($rf=="tgz2")) {echo("<a href=\"tgz.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ac=ext\">Разархивировать</a><br/>");}}
if (($rf<>"jpg")&&($rf<>"jpeg")&&($rf<>"jpe")&&($rf<>"png")&&($rf<>"gif")&&($rf<>"bmp")&&($rf<>"dll")&&($rf<>"wav")&&($rf<>"mid")&&($rf<>"midi")&&($rf<>"mp3")&&($rf<>"mmf")&&($rf<>"psd")&&($rf<>"doc")&&($rf<>"pdf")&&($rf<>"zip")&&($rf<>"rar")&&($rf<>"jar")&&($rf<>"3gp")&&($rf<>"avi")&&($rf<>"mp4")&&($rf<>"class")&&($rf<>"tgz")&&($rf<>"gz")&&($rf<>"bz")&&($rf<>"gz2")&&($rf<>"bz2")&&($rf<>"tbz")&&($rf<>"tbz2")&&($rf<>"tgz2")&&($rf<>"tar")&&($fsz<=122880)) {
echo("- - -<br/><a href=\"edit.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ed=1&amp;msz=$(msz)&amp;kdr=$(kdr)&amp;ln=$(ln)\">Редактировать</a>&nbsp;
[<a href=\"edit2.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ed=1&amp;msz=$(msz)&amp;kdr=$(kdr)&amp;ln=$(ln)\">2.0</a>]<br/>
Строк в редакторе(1-15):</small><input name=\"ln\" type=\"text\" value=\"7\" maxlength=\"2\" size=\"2\" format=\"*N\"/><small><br/>
Символов в строке(32-1024):</small><input name=\"msz\" type=\"text\" value=\"0\" maxlength=\"4\" size=\"4\" format=\"*N\"/><br/>
<small>Кодировка файла:</small><select name=\"ikdr\" value=\"2\">
<option value=\"1\">Koi8-R</option>
<option value=\"2\">Другая</option>
</select><br/>
<small>Сохранить как:</small><select name=\"kdr\" value=\"1\">
<option value=\"1\">UTF-8</option>
<option value=\"2\">Windows-1251</option>
<option value=\"3\">Escape(Unicode)</option>
<option value=\"4\">Koi8-R</option>
<option value=\"5\">Не изменять</option>
</select><br/><small>");
}
if (($rf=="txt")&&($fsz<=204800)) {echo("- - -<br/><a href=\"book.php?k=$k&amp;d=$rd&amp;n=$rn\">Создать книгу</a><br/>");}
if (($rf=="sql")&&($fsz<=204800)) {echo("- - -<br/><a href=\"inst.php?k=$k&amp;d=$rd&amp;n=$rn\">Создать установщик</a><br/>");}
echo("- - -<br/>В список:<br/>[<a href=\"actn.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ac=copy&amp;t=f&amp;go=1\">К</a>][<a href=\"actn.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ac=cut&amp;t=f&amp;go=1\">П</a>]");
if (($rf<>"zip")&&($rf<>"jar")&&($rf<>"rar")&&($rf<>"tgz")&&($rf<>"gz")&&($rf<>"bz")&&($rf<>"gz2")&&($rf<>"bz2")&&($rf<>"tbz")&&($rf<>"tbz2")&&($rf<>"tgz2")&&($rf<>"tar")&&($fsz<=3145728)) {echo("[<a href=\"actn.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ac=arh&amp;t=f&amp;go=1\">ZIP</a>][<a href=\"actn.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ac=at&amp;t=f\">TAR</a>]<br/>");}
else {echo("<br/>");}
if (($rf<>"zip")&&($rf<>"jar")&&($rf<>"rar")&&($rf<>"tgz")&&($rf<>"gz")&&($rf<>"bz")&&($rf<>"gz2")&&($rf<>"bz2")&&($rf<>"tbz")&&($rf<>"tbz2")&&($rf<>"tgz2")&&($rf<>"tar")&&($fsz<=3145728)) {echo("Архивировать:<br/>[<a href=\"ecopy.php?k=$k&amp;d=$rd&amp;n=$rn&amp;tp=a\">ZIP</a>][<a href=\"ecopy.php?k=$k&amp;d=$rd&amp;n=$rn&amp;tp=t\">TAR</a>]<br/>");}
echo("<a href=\"ecopy.php?k=$k&amp;d=$rd&amp;n=$rn&amp;tp=c\">Копировать..</a><br/>
<a href=\"ecopy.php?k=$k&amp;d=$rd&amp;n=$rn&amp;tp=m\">Переместить..</a><br/>");
echo("<a href=\"actn.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ac=ren&amp;t=f\">Переименовать</a><br/>
<a href=\"actn.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ac=del&amp;t=f\">Удалить</a>
</small></p>
</card></wml>");
} else {
echo("<p align=\"center\"><small>
Нет соединения с сервером.<br/>
- - -<br/>
<anchor>Назад<prev/></anchor>
</small></p>
</card></wml>");
}
?>