Code:
$path = $_GET['path']; // z.B. path=./Artikel
if ($path == './Privat')
{
header('Location: /Privat');
}
if ($path == '')
{
$path = '.';
}
$dirs = listDirs($path.'/');
$files = listFiles($path.'/');
if (!file_exists(str_replace("./", "", $path)))
{
header('Location: '.$path);
}
if ($path != ".")
{
foreach($defaultPages as $file)
{
if (file_exists($path."/".$file))
{
header('Location: '.$path."/".$file);
exit;
}
}
}
if ($path != '.')
{
echo '
[b]Inhalt von: '.str_replace("./", "", $path).'[/b]</p>';
}
Das ist alles, was ich mit der Variablen mache.
Wie bekomme ich den Fehler weg und wie mache ich das Skript sicher?
Und die Ausgabe:
Code:
echo '<table class="noborder">';
if ($path != '.')
{
echo "<tr><td class=\"noborder\"><a href=\"/index.php?path=".$parentDir."\">..</a></td><td class=\"noborder\"></td><td class=\"noborder\"></td></tr>\n";
}
foreach ($dirs as $dir)
{
if (!in_array($dir, $forbiddenDirs))
{
$link = 'index.php?path='.$path.'/'.$dir;
echo "<tr><td class=\"noborder\"><a href=\"".$link."\">".$dir."</a></td><td class=\"noborder\" align=\"center\">[DIR]</td><td class=\"noborder\" align=\"center\" width=150px>".date("Y-m-d H:i",filemtime($path."/".$dir))."</td><td class=\"noborder\"</td></tr>\n";
}
}
foreach ($files as $file)
{
if (!in_array($file, $hiddenFiles))
{
$size = number_format(ceil(filesize($path.'/'.$file) / 1024), 0);
echo "<tr><td class=\"noborder\"><a href=\"".$path."/".$file."\">".$file."</a></td><td class=\"noborder\" align=\"right\">".$size."k</td><td class=\"noborder\" align=\"center\" width=150px>".date("Y-m-d H:i",filemtime($path."/".$file))."</td><td class=\"noborder\">".getTitleFromHTML($path."/".$file)."</td></tr>\n";
}
}