lard Posted February 21, 2009 Share Posted February 21, 2009 Hi I've got a page that includes a file according to the query string. I'd like to display a custom message rather than the normal php error messages. So what I currently have is: <?php $path=$_SERVER['QUERY_STRING']; include("$path.php"); ?> I was hoping to be able to do something like this, but obviously it doesn't work... <?php $path=$_SERVER['QUERY_STRING']; if (!$path) { echo "Sorry, that page cannot be found"; } include("$path.php"); ?> Any ideas? Quote Link to comment Share on other sites More sharing options...
Dtonlinegames Posted February 21, 2009 Share Posted February 21, 2009 <?php if(@fopen('file.php','r')){ echo 'works'; } else{ echo 'doesnt work'; } ?> Hopefully help you, was the answer straight to my head anyways Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.