Файл: explorer.mhos.tk/ecopy.php
Строк: 127
<?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=preg_replace("~.*/([^/]*)~m","\1",$d);
$d=preg_replace("~(.*)/[^/]*~m","\1",$d);}
$rd=rawurlencode($d); $rn=rawurlencode($n);
$d=str_replace(".|htaccess",".htaccess",$d);
$n=str_replace(".|htaccess",".htaccess",$n);
$tp=trim($_GET['tp']); $nm=trim($_GET['nm']); $ch=trim($_GET['ch']);
if ($nm<>NULL) {
$repl=array("\"=>"",":"=>"","*"=>"","?"=>"","""=>"","<"=>"",">"=>"","|"=>"");
$nm=trim(strtr($nm,$repl));
include("repl.php"); $nm=u2t($nm);
if (($nm==".")||($nm=="..")) {$nm="";}
}
if (($tp<>NULL)&&($nm==NULL)||(strlen($ch)<>3)) {
$num=@file_get_contents("allnumbd.dat"); $nar=NULL;
$num++; $nar=$num; if ($num>99999999) {$num=0;}
$f=@fopen("allnumbd.dat","w"); @fwrite($f,$num); @fclose($f);
if ($d=="/") {$d="";} $n=str_replace("$","$$",$n); $d=str_replace("$","$$",$d);
if ($tp=="c") {
$vl=$d."/~".$n; $v1="Копировать в"; $v2="Копировать";
} elseif ($tp=="m") {
$vl=$d."/".$n; $v1="Переместить в"; $v2="Переместить";
} elseif ($tp=="a") {
$vl=$d."/".preg_replace("~([^.]*).*~m","\1",$n).".zip";
$v1="Архивировать в"; $v2="Архивировать";
} elseif ($tp=="t") {
$vl=$d."/".preg_replace("~([^.]*).*~m","\1",$n).".tgz";
$v1="Архивировать в"; $v2="Архивировать";
} else {header("Location: $dftp/ftp.php?k=$k&d=$rd"); exit;}
include "includes/header.php";
echo '
<div class="box_2">
Путь: <b><a href="ftp.php?k='.$k.'&d='.$rd.'">'.$d.'/</a><a href="file.php?k='.$k.'&d='.$rd.'&n='.$rn.'">'.$n.'</a></b><br/>
</div><div class="box_1">
<form action="ecopy.php" method="get">
'.$v1.':<br/>
<input name="nm" type="text" value="'.$vl.'" maxlength="250"/><br/>
CHMOD:
<input name="ch" type="text" value="644" size="3" maxlength="3" format="*N"/><br/>
<input type="hidden" name="k" value="'.$k.'"/>
<input type="hidden" name="d" value="'.$rd.'"/>
<input type="hidden" name="n" value="'.$rn.'"/>
<input type="hidden" name="tp" value="'.$tp.'"/>
<input type="hidden" name="go" value="1"/>
<input type="submit" value="'.$v2.'"><br/>
</div>';
} else {
if (($ftp=@ftp_connect($sr))&&(@ftp_login($ftp,$lg,$ps))) {
@ftp_pasv($ftp,true);
if ((substr($nm,-1)<>"/")&&($d."/".$n<>$nm)) {
if ($tp=="c") {
@ftp_get($ftp,"data/$k.bk","$d/$n",FTP_BINARY);
@ftp_put($ftp,"$nm","data/$k.bk",FTP_BINARY);
@unlink("data/$k.bk");
$cmd="chmod 0$ch $nm"; @ftp_site($ftp,$cmd);
} elseif ($tp=="m") {
@ftp_rename($ftp,"$d/$n","$nm");
$cmd="chmod 0$ch $nm"; @ftp_site($ftp,$cmd);
} elseif (($tp=="a")&&(@ftp_size($ftp,"$d/$n")<=3145728)) {
include('pclzip.php'); $zip=new PclZip("data/$k.zip");
mkdir("data/$k",0777);
ftp_get($ftp,"data/$k/$n","$d/$n",FTP_BINARY);
if ($zip->create("data/$k/$n",PCLZIP_OPT_REMOVE_ALL_PATH,PCLZIP_OPT_COMMENT,$cmm)<>0) {
@ftp_put($ftp,"$nm","data/$k.zip",FTP_BINARY);
}
@unlink("data/$k.zip");
@unlink("data/$k/$n"); @rmdir("data/$k");
} elseif (($tp=="t")&&(@ftp_size($ftp,"$d/$n")<=3145728)) {mkdir("data/$k",0777);
$name=preg_replace("~.*/([^/]*)~m","\1",$nm);
include('tar.php'); $tar=new Archive_Tar("data/$k/$name");
ftp_get($ftp,"data/$k/$n","$d/$n",FTP_BINARY);
if ($tar->createModify("data/$k/$n","","data/$k")) {
@ftp_put($ftp,"$nm","data/$k/$name",FTP_BINARY);
}
@unlink("data/$k/$name");
@unlink("data/$k/$n"); @rmdir("data/$k");
}
}
@ftp_close($ftp);
header("Location: $dftp/ftp.php?k=$k&d=$rd"); exit;
} else {
include "includes/header.php";
echo '<div class="box_1">
Нет соединения с сервером</div>
<div class="title_page"><a href="index.php">Главная</a></div>';
}
}
include "includes/footer.php";
?>