Файл: actn.php
Строк: 272
<?php
error_reporting(0);
$sid=trim($_GET['sid']);
$k=trim($_GET['k']); include("key.php");
$d=rawurldecode(trim($_GET['d'])); $n=rawurldecode(trim($_GET['n']));
if ($d==NULL) {$d="";} elseif ($d=="/") {$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);
$ac=trim($_GET['ac']); $t=trim($_GET['t']); $go=trim($_GET['go']); $nm=trim($_POST['nm']);
if ($nm<>NULL) {
$repl=array("\"=>"",":"=>"","*"=>"","?"=>"","""=>"","<"=>"",">"=>"","|"=>"");
$nm=trim(strtr($nm,$repl));
if ($ac<>"mv") {$nm=str_replace("/","",$nm);}
include("repl.php"); $nm=u2t($nm);
}
if ($go<>1){if (($ac=="del")&&($t=="f")) {
$title="Delete file";
include("inc/head.php");
echo('<div class="gmenu" align="left"><a
href="ftp.php?k='.$k.'&d='.$rd.'&n='.$rn.'">'.$d.'/</a><a
href="file.php?k='.$k.'&d='.$rd.'&n='.$rn.'">'.$n.'</a></div>');
echo "<div class="bmenu"><b>$title</b></div>";
echo "<div class="menu" align="center"><div class="ads"><br/>";
include("buzz.php");
echo "<br/></div>
<p>Are you sure want to delete this file?<br/><br/><a class="rmenu" href="actn.php?k=$k&d=$rd&n=$rn&ac=del&t=f&go=1"> Execute </a></p><div class="ads"><br/>";
include("mobgold.php");
echo "<br/></div></div>";
include("inc/foot.php");
} elseif ($ac=="delf") {
$title="Delete directory";
include("inc/head.php");
echo('<div class="gmenu" align="left"><a
href="ftp.php?k='.$k.'&d='.$rd.'&n='.$rn.'">'.$d.'/</a><a
href="file.php?k='.$k.'&d='.$rd.'&n='.$rn.'">'.$n.'</a></div>');
echo "<div class="bmenu"><b>$title</b></div>";
echo "<div class="menu" align="center"><div class="ads"><br/>";
include("buzz.php");
echo "<br/></div>
<p>Are you sure want to delete this directory include all files?<br/><br/><a class="rmenu" href="actn.php?k=$k&d=$rd&n=$rn&ac=delf&t=d&go=1"> Execute </a></p><div class="ads"><br/>";
include("mobgold.php");
echo "<br/></div></div>";
include("inc/foot.php");
} elseif (($ac=="ren")||($ac=="mv")) {
if ($n==NULL) {
$n=preg_replace("~.*/([^/]*)~m","\1",$d); $d=preg_replace("~(.*)/[^/]*~m","\1",$d);
$rn=str_replace(".htaccess",".|htaccess",$n);
$rd=str_replace(".htaccess",".|htaccess",$d);
}
$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 ($ac=="ren") {$sn="Rename"; $vl=$n;}
else {$sn="Move to"; $vl=$d."/".$n;}
$title=$sn;
include("inc/head.php");
echo('<div class="gmenu" align="left"><a
href="ftp.php?k='.$k.'&d='.$rd.'&n='.$rn.'">'.$d.'/</a><a
href="file.php?k='.$k.'&d='.$rd.'&n='.$rn.'">'.$n.'</a></div>');
echo "<div class="bmenu"><b>$title</b></div>";
echo "<div class="menu" align="center"><div class="ads"><br/>";
include("buzz.php");
echo "<br/></div>";
$ajaja="$sn:<input name="nm" type="text" value="$vl" maxlength="150"/><br/>";
echo "<p><form action="actn.php?k=$k&d=$rd&n=$rn&ac=$ac&t=$t&go=1" method="post">$ajaja<input type="submit" value="Execute"/></form></p><div class="ads"><br/>";
include("mobgold.php");
echo "<br/></div></div>";
include("inc/foot.php");
} elseif (($ac=="at")&&($t=="f")) {
$title="Create archive";
include("inc/head.php");
echo "<div class="gmenu"><a href="ftp.php?k=$k&d=$rd&n=$rn">$d/</a><a href="file.php?k=$k&d=$rd&n=$rn">$n</a></div>";
echo "<div class="bmenu"><b>$title</b></div><div class="menu" align="center"><div class="ads"><br/>";
include("buzz.php");
echo "<br/></div>";
$slt="Format:</small>
<select name="ac" value="at2">
<option value="at1">TAR</option>
<option value="at2">TGZ</option>
<option value="at3">TGZ2</option>
<option value="at4">TBZ</option>
<option value="at5">TBZ2</option>
</select><br/>";
echo "<p><form action="actn.php?k=$k&d=$rd&n=$rn&t=f&go=1" method="get">$slt<input type="submit" value="Execute"/></form></p><div class="ads"><br/>";
include("buzz.php");
echo "<br/></div></div>";
include("inc/foot.php");
}
} else {$stb="";
if (($ftp=@ftp_connect($sr))&&(@ftp_login($ftp,$lg,$ps))) {
@ftp_pasv($ftp,true);
$st="<div class="gmenu">file saved.</div>";
if (($ac=="del")&&($t=="f")) {//del file
if (@ftp_delete($ftp,"$d/$n")) {
@ftp_close($ftp);
header("Location: $dftp/ftp.php?k=$k&d=$rd&act=pm"); exit;
} else {$st="<div class="gmenu">file deleted.</div>";}
} elseif (($ac=="delf")&&($t=="d")) {//del all dir
function rdir($conn,$dir) {ftp_chdir($conn,$dir);
$arr=ftp_nlist($conn,"."); $ctns=count($arr); if ($ctns>700) {$ctns=700;}
for ($i=0;$i<$ctns;$i++) {$fl=$dir."/".$arr[$i];
if ((ftp_size($conn,$fl)==-1)&&(preg_replace("~.*/([^/]*)~m","\1",$fl)<>".")&&
(preg_replace("~.*/([^/]*)~m","\1",$fl)<>"..")) {rdir($conn,$fl);}
else {@ftp_delete($conn,$fl);}
} ftp_chdir($conn,"/");
@ftp_delete($conn,$dir."/".".htaccess");
if (ftp_rmdir($conn,$dir)) {return true;} else {return false;}
}
if ($n==NULL) {
$n=preg_replace("~.*/([^/]*)~m","\1",$d); $d=preg_replace("~(.*)/[^/]*~m","\1",$d);
$rn=str_replace(".htaccess",".|htaccess",$n);
$rd=str_replace(".htaccess",".|htaccess",$d);
}
if (@rdir($ftp,"$d/$n")) {
@ftp_close($ftp);
header("Location: $dftp/ftp.php?k=$k&d=$rd&act=pm"); exit;
} else {$st="folder deleted.";}
@ftp_close($ftp);
} elseif (($ac=="mv")&&($t=="d")) {//move dir
if (@ftp_rename($ftp,$d."/".$n,$nm)) {
@ftp_close($ftp);
$nm=str_replace(".htaccess",".|htaccess",$nm);
$nm=rawurlencode($nm);
header("Location: $dftp/ftp.php?k=$k&d=$nm&act=pm"); exit;
} else {$st="folder cant moved.";}
} elseif (($ac=="ren")&&($t=="d")) {//rename dir
if (@ftp_rename($ftp,$d."/".$n,$d."/".$nm)) {
@ftp_close($ftp);
$nm=str_replace(".htaccess",".|htaccess",$nm);
$nm=rawurlencode($nm);
header("Location: $dftp/ftp.php?k=$k&d=$rd&n=$nm&act=pm"); exit;
} else {$st="folder cant renamed.";}
} elseif (($ac=="ren")&&($t=="f")) {//rename file
if (@ftp_rename($ftp,$d."/".$n,$d."/".$nm)) {
@ftp_close($ftp);
header("Location: $dftp/ftp.php?k=$k&d=$rd&act=pm"); exit;
} else {$st="file cant renamed.";}
} elseif (($ac=="copy")||($ac=="cut")||($ac=="arh")||($ac=="at1")||
($ac=="at2")||($ac=="at3")||($ac=="at4")||($ac=="at5")) {//add act
$flist=@file("data/$k.act");if($n[strlen($n)-1]=="/") {$n[strlen($n)-1]="";}
$str="$d/$n|$t|$acrn";
if ($flist<>NULL) {
for ($i=0;$i<count($flist);$i++) {if ($i==100) {break;} $str.=$flist[$i];}
}
$f=@fopen("data/$k.act","w"); @fwrite($f,$str); @fclose($f);
if ($t=="d") {$st="folder "".htmlspecialchars($d."/".$n)."" added to list.";}
else {$stb="<div class="gmenu"><a href="ftp.php?k=$k&d=$rd">$d/</a><a href="file.php?k=$k&d=$rd&n=$rn">$n</a></div>"; $st="file "".htmlspecialchars($d."/".$n)."" Added to list.";}
} elseif ($ac=="rm") {//list; remove
$lnm=rawurldecode(trim(str_replace(".|htaccess",".htaccess",$_GET['lnm'])));
if ($flist=@file("data/$k.act")) {$str="";
for ($i=0;$i<count($flist);$i++) {
list($p1,$p2,$p3)=split('[|]',$flist[$i]); $p1=trim($p1);
if ($p1<>$lnm) {$str.=$flist[$i];}
}
$f=@fopen("data/$k.act","w"); @fwrite($f,$str); @fclose($f);
header("Location: $dftp/list.php?k=$k&d=$rd&n=$rn"); exit;
} else {$st="<div class="rmenu">gagal aja hehe :p</div>";}
} elseif ($ac=="rmall") {//list; remove all
if (unlink("data/$k.act")) {
header("Location: $dftp/list.php?k=$k&d=$rd&n=$rn"); exit;
} else {$st="<div class="rmenu">gagal bro.</div>";}
}
@ftp_close($ftp);
$title=$st;
include("inc/head.php");
echo "$st $stb";
include("inc/foot.php");
} else {
$title="No Connection..!!";
include("inc/in_head.php");
echo "<p class=rmenu">ga konek...</p>";
include("inc/foot.php");
}
}
?>