Файл: ftp.php
Строк: 185
<?php
error_reporting(0);
$act=trim($_GET['act']);
$go=trim($_GET['go']);
$LOGIN=trim($_GET['LOGIN']);
if ($go=="LOGIN") {
include("inc/login.php");
} else {
include("inc/login2.php");
}
$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);
if (($ftp=@ftp_connect($sr))&&(@ftp_login($ftp,$lg,$ps))) {
@ftp_pasv($ftp,true);
$sz=@ftp_size($ftp,"$d,$n,$nm");
$tm=@ftp_mdtm($ftp,"$d/$n");
@ftp_close($ftp);
$fsz=$sz;
if ($size<100) {$sz="".$sz."b";}
elseif ($size<1024) {$sz="".str_replace(".",",",round($size/1024,1))."kb";}
elseif ($size<102400) {$sz="".round($size/1024)."kb";}
else {$sz="".str_replace(".",",",round($size/1024/1024,1))."mb";}
} else {$sz="";}
if ($tm<>NULL) {$tmv=gmdate("d-m-y,H:i:s a" , time() +3600*7);} else {$tmv="-";}
$d=str_replace("$","$$",$d); $n=str_replace("$","$$",$n);
$rf=strtolower(preg_replace("~.*.([^.]*)~m","\1",$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/>rn";} $bl="";
if ($p>1) {$v=$p-1; $bl.="<a style="color:red" href="ftp.php?k=$k&d=$rd&n=$rn&p=$v"><b><<</b></a> | ";} elseif ($allp>$p) {$bl.="<b><<</b> | ";}
if ($allp>$p) {$v=$p+1; $bl.="<a style="color:red" href="ftp.php?k=$k&d=$rd&n=$rn&p=$v"><b>>></b></a><br/>rn";} elseif ($p>1) {$bl.="<b>>></b><br/>rn";}
if ($bl<>NULL) {$bl="Page: $p/$allp<br/>$bl
<!-- pm.cx.net -->
<form action='ftp.php'><input type='hidden' name='k' value='$k'/><input type='hidden' name='d' value='$rd'/><input type='hidden' name='n' value='$rn'/><input name='p' type='text' value='$p' size='2' format='*N'/><input type='submit' value='Go'/></form>";}
$d=str_replace("$","$$",$d); $n=str_replace("$","$$",$n);
$curd=str_replace("$","$$",$curd); $links=str_replace("$","$$",$links);
// pm.cx.net
$title="Listing ".$curd;
include('inc/head.php');
echo("<div class="gmenu">$curd</div>");
if ($curd<>"/") {
if ($ib==1) {
$icn="<img src="img/back.png" width="16" height="16" alt="<" />";
} else {$icn="Up";}
echo("<div class="menu">$icn<a href="ftp.php?k=$k&d=$back"><b>..</b></a></div>");
}
echo("<div class="menu">");
if ($act=="pm") {
$msg="<p>Done !</p>";
} elseif ($act=="errs") {
$msg="<p>No file selected !</p>";
} elseif ($act=="copy") {
$msg="<p>Selected files has been successfully copyed</p>";
} elseif ($act=="move") {
$msg="<p>Selected files has been successfully moved</p>";
} elseif ($act=="zip") {
$msg="<p>Selected files has been successfully ziped</p>";
} elseif ($act=="delete") {
$msg="<p>Selected files has been successfully deleted</p>";
} elseif ($act=="chmod") {
$msg="<p>Selected files has been successfully chmoded</p>";
} elseif ($act=="LOGIN") {
$msg="Links automatically enter your ftp account:<br/><textarea rows="2">$dftp/ftp.php?server=$sr&user=$lg&pass=$ps&d=$curd&size=$shs&icons=$ib&items=$skl&tema=$tema</textarea>";
} elseif ($act=="greet") {$msg="<p>Wecome back user ".$lg."</p>";
} else {echo("<div class="ads" align="center"><br/>");include("inc/buzz.php");echo("</div>");}
echo("<center><font color="red"><b>$msg</b></font></center>");
echo("<br/>$bl<br/>");
echo "<form action='actions.php?k=$k&d=$rd&n=$rn' align='left' method='post'>";
echo("$links</div>");
echo("<div class="phdr"><h3>Actions selected:</h3></div><div class="menu" style="padding:1px"><input type='submit' name='del' value='Delete' /><input type='submit' name='c' value='Copy' /><input type='submit' name='m' value='Move' /><input type='submit' name='ch' value='Chmod' /><input type='submit' name='arh' value='Create Zip' /></form></div>");
echo("<div class="menu2">$bl</div>");
{echo("<div class="phdr"><h3>Lists:</h3></div><p class="menu">[<a href="ecopy.php?k=$k&d=$rd&n=$rn&tp=c">Copy</a>][<a href="actn.php?k=$k&d=$rd&n=$rn&ac=cut&t=d&go=1">Cut</a>]</p>
<div class="phdr"><h3>Acttions:</h3></div><p class="menu"><a href="arhdir.php?k=$k&d=$rd&n=$rn">Add to archive</a>
<a href="list.php?k=$k&d=$rd&n=$rn">View file list</a>
<a href="actn.php?k=$k&d=$rd&n=$rn&ac=mv&t=d">Move</a>
<a href="actn.php?k=$k&d=$rd&n=$rn&ac=ren&t=d">Rename</a>
<a href="actn.php?k=$k&d=$rd&n=$rn&ac=delf">Delete</a></p>");}
echo("<div class="phdr"><h3>
Create: </h3></div><p class="menu">
<a href="create.php?k=$k&d=$rd&n=$rn&tp=f">File</a>
<a href="create.php?k=$k&d=$rd&n=$rn&tp=d">Folder</a>
<a href="import.php?k=$k&d=$rd&n=$rn">Import</a>
<a href="upload.php?k=$k&d=$rd&n=$rn">Upload</a></p>");
include('inc/foot.php');
} else {
header ("Location: $dftp/index.php?act=err");
/* $title="No Connection..";
include("inc/in_head.php");
echo('<div class="rmenu" align="left"><small>
Connection error..!!<br/>
<br/></div>');
include('inc/foot.php'); */
}
?>