Working in the WAMP test server enviroment. I want to be able to register, login and logout from any where in the site, so I included the login form with relative URLS in the header.php file.

This all works fine on the root directory but breaks as soon as you reach any off the subdirectories.

On the root folder
login = http://mytest/login.php 
on a subfolder
login = http://mytest/subfolder/login.php/login.php

For each subdirectory I drop to I place a corresponding ../ and it works because it finds the file header.php file. The only problem is the URL actions with the header.php file always have an extra folder attached which doesn't exist.

I have tried

<?php require_once( str_replace('//','/',dirname(__FILE__).'/') .'../header.php'); ?>

and I still get the same results

Is there any fnction to stop PHP parsing the included file as the same as the current file in process?

6 Years
Discussion Span
Last Post by diafol

if you use an absolute path, it should be ok. $_SERVER has problems on certain servers though, but I've never experienced any:


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.