PHP include() issues

  • IcyDragoon
  • Student
  • Student
  • No Avatar
  • Joined: Mar 12, 2008
  • Posts: 65
  • Status: Offline

Post January 25th, 2009, 4:07 pm

Let's say I want to know if the file is already included or not,
what are my options?

I do not want to use the include_once() or require_once()*

hmmm ..... I know maybe I define() a CONSTANT in the included file and check
if that CONSTANT with defined()?

any other alternatives? better ones?

if the file is included, then do this and this
if not then do that and that..
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post January 25th, 2009, 4:07 pm

  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Joined: Sep 22, 2003
  • Posts: 6128
  • Loc: Seattle, WA
  • Status: Offline

Post January 25th, 2009, 4:26 pm

IcyDragoon wrote:
hmmm ..... I know maybe I define() a CONSTANT in the included file and check
if that CONSTANT with defined()?

That would be the easiest way. I believe phpBB uses this technique to prevent access to non-executable scripts (config files, etc).
The Beer Monocle. Classy.
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post January 25th, 2009, 4:48 pm

http://www.php.net/get_included_files

Most people browse the net looking for porn, I browse the PHP manual looking for obscure function names to memorize.
Strong with this one, the sudo is.
  • IcyDragoon
  • Student
  • Student
  • No Avatar
  • Joined: Mar 12, 2008
  • Posts: 65
  • Status: Offline

Post January 25th, 2009, 5:48 pm

hmmmm I see.

I'll give it a try ^^

thanks.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 149 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.