Forum Moderators: coopster

Message Too Old, No Replies

Die if file not found

         

sssweb

8:08 pm on Feb 7, 2006 (gmt 0)

10+ Year Member



How do I tell a script to die if no file is found, where the file is defined as $page.

vevs

8:33 pm on Feb 7, 2006 (gmt 0)

10+ Year Member



something like this should do it
if (is_file('path_to_file_and_file_name')) {

} else {
die("no such file");
};

sssweb

10:22 pm on Feb 7, 2006 (gmt 0)

10+ Year Member



Thanks, that worked. I added a command to send an email to the site admin before it dies; I want to include the page with the bad link - what would be the $string for the current page?

vevs

10:38 pm on Feb 7, 2006 (gmt 0)

10+ Year Member



try this
$_SERVER['REQUEST_URI'];

sssweb

10:49 pm on Feb 7, 2006 (gmt 0)

10+ Year Member



I got a parse error; the context I'm using it in is this:

mail( $email, "Subject",
"Message - $_SERVER['REQUEST_URI']; ",
"From: Sender <$email>" );

vevs

11:13 pm on Feb 7, 2006 (gmt 0)

10+ Year Member



mail( $email, "Subject",
"Message - ".$_SERVER['REQUEST_URI'],
"From: Sender <$email>" );

sssweb

12:19 am on Feb 8, 2006 (gmt 0)

10+ Year Member



Thanks -- that did it.