Page 1 of 1

Display diffrent text depending on url

Posted: Sun Oct 01, 2006 10:15 pm
by dclamp
Hi,

what i am looking for is when some one looks at my page "error.php?err=1" it will show whatever i have set for that. same with other numbers as well. i hope that is not confusing...

thanks in advanced!

Posted: Sun Oct 01, 2006 11:21 pm
by aaronhall
Something simple:

Code: Select all

<?

// here's where you set your errors
$errorArray[1] = "There is an error!";
$errorArray[2] = "This is another error!";
$errorArray[3] = "Ugh, yet another";

if(is_numeric($_GET['err'])) { // check that $_GET['err'] is numeric, and not a hijack attempt
	if(!empty($errorArray[$_GET['err']])) { // check that this error number exists
		echo "ERROR: " . $errorArray[$_GET['err']]; // print the error
	}
}

?>

Posted: Mon Oct 02, 2006 12:07 am
by dclamp
the error message is going to have contain alot of info. will it still work with that code?

Posted: Mon Oct 02, 2006 12:53 am
by daedalus__
Why wouldn't it?