Page 1 of 1

php Includes and basic HTML Nightmare

Posted: Thu Feb 03, 2005 6:49 am
by mmanders
Hi,

I have a php script located in /login/ of my web root. This script, accesscontrol.php contains code to verify a user, if they are not logged in they sign in thru a form, if they are logged in, the protected content is displayed. This file is included at the top of ever page that has protected content.

The problem is, despite having my include_path set up at the top of the script so the include is always there, the HTML references to images etc change depending upon where the script is currently executing from. I.e. if ./index.php called accesscontrol.php, the links to images etc are fine, however if /foldername/index.php calls the include, then the include file references are wrong. If that made sense, can any one suggest a solution!>

Thanks
Max

Posted: Thu Feb 03, 2005 7:27 am
by neophyte
Use an absolute path:

/home/what/www/images/

Or if you need dynamic "../../" read this thread:

viewtopic.php?t=30094

The thread is about links but it will also work for images....