Problems with Includes and Relative Paths
Posted: Wed Feb 06, 2008 1:06 pm
Hey guys,
I have a huge problem. I just spent 9 months building some software the relies on this one idea... and I just found a major problem.
My software includes files that are supplied by the user. It does this so that it can do some mysql magic and then display the page the user wanted.
So instead of showing index.php, they are redirected with htaccess to bounce.php which sets some database stuff and then includes index.php. To the user it's transparent and seems as if they have just gone to index.php as usual.
My problem is this : when bounce.php includes a file from a different directory (/blog for example), relative includes ('./wp-header.php') can't be included because './' is the web root directory rather than /blog.
Any ideas on this? Is there some way to change the directory php thinks it's in?
My best idea so far is to implement a caching system where upon first access files are scanned for relative includes, a duplicate is made with absolute includes, and the user is directed to the cached version until the checksum changes for the original. Kind of messy.
Tynan
I have a huge problem. I just spent 9 months building some software the relies on this one idea... and I just found a major problem.
My software includes files that are supplied by the user. It does this so that it can do some mysql magic and then display the page the user wanted.
So instead of showing index.php, they are redirected with htaccess to bounce.php which sets some database stuff and then includes index.php. To the user it's transparent and seems as if they have just gone to index.php as usual.
My problem is this : when bounce.php includes a file from a different directory (/blog for example), relative includes ('./wp-header.php') can't be included because './' is the web root directory rather than /blog.
Any ideas on this? Is there some way to change the directory php thinks it's in?
My best idea so far is to implement a caching system where upon first access files are scanned for relative includes, a duplicate is made with absolute includes, and the user is directed to the cached version until the checksum changes for the original. Kind of messy.
Tynan