Jump to content

Archived

This topic is now archived and is closed to further replies.

Guest kilbad

Concerning:: Preventing warning messages, and globals off

Recommended Posts

Guest kilbad
Currently I have the following index.php script::

[code]
<?php
$id = $_GET['id'];

if ($id == "")

{
include 'header.php';
include 'frontpage.php';
include 'footer.php';
}

else

{
include 'header.php';
include "$id.php";
include 'footer.php';
        }
?>
[/code]

where "id" is a passed variable that specifies the file name of the page that loads in the wrapper..

My questions are these::

1) In the unlikely, but possible, event that someone enters a random ID in the address line (like example.php?id=some_manual_entry ), how can I make the script automatically load a specific error page, instead of inserting the "Warning:...failed to open stream: No such file or directory ... on line ..." in the wrapper?

2) Do I have to use register globals if I don't need to authenticate the user? [i] (note to self: http://us2.php.net/register_globals)[/i]



Thanks again in advance!  bt

Share this post


Link to post
Share on other sites
try using file_exists() or something similar to make sure that the requested file is truly a real file. if it's not, then show your error message.

Share this post


Link to post
Share on other sites
Guest kilbad
just what I needed, thanks!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.