Jump to content

Concerning:: Preventing warning messages, and globals off

  • Please log in to reply
2 replies to this topic

#1 Guest_kilbad_*

  • Guests

Posted 01 August 2006 - 07:20 PM

Currently I have the following index.php script::

$id = $_GET['id'];

if ($id == "")

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

	include 'header.php';
	include "$id.php";
	include 'footer.php';

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? (note to self: http://us2.php.net/register_globals)

Thanks again in advance!  bt

#2 obsidian

  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 01 August 2006 - 07:29 PM

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.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#3 Guest_kilbad_*

  • Guests

Posted 01 August 2006 - 07:45 PM

just what I needed, thanks!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users