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? Link to comment https://forums.phpfreaks.com/topic/146192-include-query-string-file-failed/ 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 Link to comment https://forums.phpfreaks.com/topic/146192-include-query-string-file-failed/#findComment-767540 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.