I got file index.php that includes index.php file in admin folder
<?php require 'admin/index.php'; ?>
in admin folder index.php file is basically login form that imports 2 css files
<DOCTYPE HTML>
<html>
<head>
<title>Simple Login Form</title>
<meta charset="UTF-8" />
<meta name="Designer" content="PremiumPixels.com">
<meta name="Author" content="$hekh@r d-Ziner, CSSJUNTION.com">
<-- site layout -->
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<link rel="stylesheet" type="text/css" href="css/structure.css" />
</head>
<body>
<form id="myForm" class="boxlogin" action="index.php" method="POST">
<fieldset class="boxBody">
<label>Email <span style="color:red;"><?php if(isset($errorMsg)) echo $errorMsg;?></span></label>
<input name="email" type="text" tabindex="1" placeholder="root" required>
<label><a href="" class="rLink" tabindex="5">Forget your password?</a>Password</label>
<input name="password" type="password" tabindex="2" required>
</fieldset>
<div class="footer">
<label><input type="checkbox" tabindex="3">Keep me logged in</label>
<input type="submit" class="btnLogin" value="Login" tabindex="4"/>
</div>
</form>
</body>
</html>
When I run index.php file, script includes admin/index.php file.
But links to css are broken because admin/index.php file was included
in file with different path.
I could change .css files path to
<link rel="stylesheet" type="text/css" href="admin/css/reset.css" />
<link rel="stylesheet" type="text/css" href="admin/css/structure.css" />
and that would fix the problem, but what if I want to call /admin/index.php script from another path.
Let’s assume that “root folder” is not in root folder on sever, for example /var/www/php/loginscript/
What is the best solution for this situation?
Thanks.
Do this:
Note the added
/inhrefs