I’m using this code to set a variable wich tell the script what file to load:
[code=php]
if(isset($_GET[“page”])) {
$file = $_GET[“page”];
$file=$page.’.txt’;
} else {
$file = ‘error.txt’;
}
this is set like this:
[url]www.mydomainname.com/script.php?page=file
this loads file.txt
I have it working so if there is no variable set in the URL it loads the error.txt but I need to have the script check if the page exists incase there is a spelling error in the URL
e.g.
[url]www.mydomainname.com/script.php?page=fille
I need the script to then load error.txt
I’ve got this code but i’m unsure how to implement it.
[code=php]
if (file_exists($file)) {
do this
or die(
do this
); }
Cheers
Chris