you just use file_exists
http://au.php.net/manual/en/function.file-exists.php
so you could use
code:
$file = "path to file here";
if (!file_exists($file)) {
die("page can not be found");
}
just put it before anything echo's in your code and when the file can not be found it will echo "page can not be found" then kill the script
so in your script it would be something like
code:
<?php
$page = htmlentities($_GET['page']) ;
$language = htmlentities($_GET['lan']) ;
if (!isset($_GET['page'])) {
if(!isset($_GET['lan'])) {
include ("pages/code/home.txt");
}
else {
$file = "pages/code/$language.txt";
if (!file_exists($file)) { die("page can not be found");}
include ("$file");
}
}
else {
$file = "pages/code/$language/$page.txt";
if (!file_exists($file)) { die("page can not be found");}
include ("$file");
}
?>
[/code]