include file

Using include file in php

Page 1 of 1

3 Replies - 1619 Views - Last Post: 08 March 2006 - 12:55 PM Rate Topic: -----

#1 chitara  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 89
  • Joined: 16-December 05

include file

Posted 08 February 2006 - 11:08 PM

Hello!!!

Its me again with the problem!

Would you please tell me the proper using of file including in php?

Actually I have created a file say as menu. And I want to use this file in

the other files of some different folder. But I am facing the link or path problem.

Can you please tell me what should I do???


Thanks
Is This A Good Question/Topic? 0
  • +

Replies To: include file

#2 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: include file

Posted 08 February 2006 - 11:30 PM

Well it's the same as moving around the file system under anything else. You need to use either a relative path or absolute.

I personally find that absolute paths are easier to remember in terms of where you are and where you're going.

However a lot can be said for using relative paths for things that are programed to be used on numorous systems.
Was This Post Helpful? 0
  • +
  • -

#3 keikee  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 5
  • Joined: 08-March 06

Re: include file

Posted 08 March 2006 - 10:42 AM

I agree that it is much better to include absolute path names. Also, be sure the file to be included is READABLE by the web server process.

And VERY, VERY IMPORTANT: NEVER use a variable in the include directive. Doing so is a HUGE security risk. Always use the actual path name of a file on your server.
Was This Post Helpful? 0
  • +
  • -

#4 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: include file

Posted 08 March 2006 - 12:55 PM

Using variables for or in include paths is only a risk if register globals is turned on. Or if for whatever reason, you're allowing user created code to run before you include.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1