Hi,
I have a filebased navigation system that lists out files in a directory with glob, exclude some files and finally highlight the current selected page.
Se script below. I wonder if there are any security issues I should address since I'm using $_GET ?
As far as I know there is a function called htmlspecialchars(), but I'm not shure this is what I should use and where to put it?
<?php
# Filabased navigation script
foreach (glob("*.php") as $file) {
if(preg_match("/(calendar|endre|index|test|glob|scandir)\b/i", $file)) continue;
$highlight = $_GET["page"] == $file ? " <font color='red'>" . ucfirst(substr($file,0,-4)) . " </font> " : $file;
print " <a href='index.php?page=$file' style='text-decoration:none'>" . ucfirst(substr($highlight,0,-4)) . "</a> | ";
}
print "</p>";
if(!$_GET[page]) {
# Blank page
}
else {
# Prints out selected page
include ($_GET[page]);
}
?>