Location: PHPKode > projects > FREE WAP PHP SCRIPTS CENTER > free_wap_ftp_client/ecopy.php
<?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($_POST['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="copy to"; $v2="copy";
} elseif ($tp=="m") {
 $vl=$d."/".$n; $v1="move to"; $v2="move";
} elseif ($tp=="a") {
 $vl=$d."/".preg_replace("~([^.]*).*~m","\\1",$n).".zip";
 $v1="make archive in"; $v2="make archive";
} elseif ($tp=="t") {
 $vl=$d."/".preg_replace("~([^.]*).*~m","\\1",$n).".tgz";
 $v1="make archive in"; $v2="make archive";
} else {header("Location: $dftp/ftp.php?k=$k&d=$rd"); exit;}
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=\"back\"><prev/></do>
<p align=\"left\"><small>
<a href=\"ftp.php?k=$k&amp;d=$rd\">$d/</a><a href=\"file.php?k=$k&amp;d=$rd&amp;n=$rn\">$n</a><br/>
- - -<br/>
$v1:</small><input name=\"nm".$nar."\" type=\"text\" value=\"$vl\" maxlength=\"250\"/><br/>
<small>CHMOD:</small>
<input name=\"chf\" type=\"text\" value=\"644\" size=\"3\" maxlength=\"3\" format=\"*N\"/><br/>
<small>- - -<br/>
<anchor>$v2<go href=\"$dftp/ecopy.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ch=$(chf)&amp;tp=$tp\" method=\"post\">
<postfield name=\"nm\" value=\"$(nm".$nar.")\"/>
</go></anchor>
</small></p>
</card></wml>");
} 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 {
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)."\">
<p align=\"center\"><small>
connection error.<br/>
- - -<br/>
<anchor>back<prev/></anchor>
</small></p>
</card></wml>");
}
}
?>
Return current item: FREE WAP PHP SCRIPTS CENTER