Absolute URL include using relative URL (fixed)
Posted: Fri Oct 31, 2003 6:30 pm
I have a PHP file (include.php) which is designed to be included in a webpage that could be anywhere on the domain. This file in turn includes a config file at config/config.php (relative to include.php). The problem is that the config folder has permissions of 700 to stop the config files being accessed, so as far as I know config.php can only be included using a relative URL. Is there a way to have it include the right file regardless of where the page that includes it is - maybe by running include.php at include.php instead of the including page (no idea how to do that)?
I'm stumped here, I tried some filename string functions to organise it, and it only worked in a couple of cases. If there's a way to keep config files from being accessed without using permissions, I'd love to hear it.
Any help would be appreciated.
- B
Edit: Found a solution (similar to what I was trying, but this one actually works ;p) - http://php.net/include and find the comment by greg at doutromundo dot com (17-Sep-2003 08:37).
I'm stumped here, I tried some filename string functions to organise it, and it only worked in a couple of cases. If there's a way to keep config files from being accessed without using permissions, I'd love to hear it.
Any help would be appreciated.
- B
Edit: Found a solution (similar to what I was trying, but this one actually works ;p) - http://php.net/include and find the comment by greg at doutromundo dot com (17-Sep-2003 08:37).