require problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
CrazyJimmy
Forum Commoner
Posts: 34
Joined: Tue Nov 19, 2002 1:40 pm

require problem

Post by CrazyJimmy »

Hello,

I have a script that checks a user is logged in, i require this at the top of every member page I have, this works fine. If user is not logged in then the script exits, if the file does'nt exist then the script exits, but if their is a error in the scripting it displays an error and continues executing rest of the page.

This should'nt be a problem normally but I just wanted to know how I could secure this in the off chance it does happen.
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Is there a particular block of code that is causing problems?
CrazyJimmy
Forum Commoner
Posts: 34
Joined: Tue Nov 19, 2002 1:40 pm

Post by CrazyJimmy »

Basically I want to know if I can return a value from a require call to make sure it executed else I can trap and exit
qartis
Forum Contributor
Posts: 271
Joined: Sat Dec 14, 2002 4:43 pm
Location: BC, Canada
Contact:

Post by qartis »

if (!@require($file)){
die("I had a problem including that file");
}
Post Reply