File targeting.
Posted: Tue Jan 06, 2009 7:48 pm
I know this probably has an easier solution and I am just over thinking it but:
Say every page you have has a function in php that checks your login status.
--If you are logged in, it says "Hi $accountName"
--If not it pops up the login form.
Here is the code:
The problem is targeting the verify.php without using a absolute link (http: //www.domain.com/php/verify.php)
I understand you can use relative targeting (../php/verify.php), but this becomes a problem when a page is visited within directories that go deeper then the relative target. So in some cases a page might have to (../../../ etc...) to target the verify.php file.
Is there a way / method to doing this with out using absolute targeting which includes the domain?
Say every page you have has a function in php that checks your login status.
--If you are logged in, it says "Hi $accountName"
--If not it pops up the login form.
Here is the code:
Code: Select all
function loginStatus(){
if ($_SESSION['loginStatus'] == "logedIn"){
$userName = $_SESSION['userLogin'];
echo "Welcome $userName";
} else {
echo "<form action=\"../php/[color=#00BF40]verify.php[/color]\" method=\"post\" name=\"loginVerify\">
Username:: <input type=\"text\" name=\"user\" size=\"8\"/>
<br/>
Password:: <input type=\"password\" name=\"pass\" size=\"8\"/>
<br/>
<input type=\"submit\" value=\"login\" name=\"submit\"/>
</form>";
}
}
I understand you can use relative targeting (../php/verify.php), but this becomes a problem when a page is visited within directories that go deeper then the relative target. So in some cases a page might have to (../../../ etc...) to target the verify.php file.
Is there a way / method to doing this with out using absolute targeting which includes the domain?