PHP код:
![Выделить весь код](images/misc/selectcode.png)
if ($action == "states") {
$inc="states.php";
if ($st == $st and !empty($st)) {
if (file_exists("states/$st.php") and substr($st, 0, 2) != ".." and substr($st, 0, 1) != "/") {
$inc="states/$st.php";
} else {$inc="error.htm";}
}
}
Вот рабочий вариант, правда можно читать все файлы которые в каталоге лежат.