SteweGriffin
Technical User
Hello,
I have a page ( UploadFile.php ) that is access via another page ( LogIn.html ) which uses, at the moment, a predefined access code and password.
That works great.
What I would like to do is restrict access to UploadFile.php so that it will only open if the last / refering page is LogIn.html, thus stopping people from saving the UploadFile.php into the favorites and bypassing the LogIn.html page everytime.
I've been trying to do this and found some PHP code which uses $HTTP_REFERER, but I seem to be getting a NULL value from this, and end up going round in a loop
See Code ---
<?
$ref = $HTTP_REFERER;
$desired = 'if ($ref != $desired)
{
header('Location:}
else
{
header('Location:}
?>
-----
I do not have access to my .htaccess file. Mt ISP will not allow me to.
Please can someone either point out where I am going wrong, or point me in the direction of a better way of doing this?
feherke and BigRed1212 on the html forum pointed out that if I stored the login info in $_SESSION and redirect the to the login page if is not logged in or the login expired, but I am VERY nex wo php and do not know how to do this.
My login page code is VERY simple, and could definately be better
code ---
<p class="style3" style="width: 460px; height: 31px;">Access Code :
<input type="text" name="text2" style="width: 235px">
</p>
<p class="style1" style="width: 458px; height: 38px;"> Access Password :
<input type="password" name="text1" style="width: 233px"></p>
<p class="style2" style="width: 357px; height: 26px;"> <input type="button" value="Check In" name="Submit" style="color: #FFFFFF; background-color: #000000; background-image: url('images/btnbck.gif'); border-color: #000000"; onclick=javascript:validate(text2.value,"USERCODE",text1.value,"PASSWORDCODE") >
</p>
-----
I my defense, I was planing on encryping the page once I got it to work.
So any Advice will be great to get me going.
Thanks
I have a page ( UploadFile.php ) that is access via another page ( LogIn.html ) which uses, at the moment, a predefined access code and password.
That works great.
What I would like to do is restrict access to UploadFile.php so that it will only open if the last / refering page is LogIn.html, thus stopping people from saving the UploadFile.php into the favorites and bypassing the LogIn.html page everytime.
I've been trying to do this and found some PHP code which uses $HTTP_REFERER, but I seem to be getting a NULL value from this, and end up going round in a loop
See Code ---
<?
$ref = $HTTP_REFERER;
$desired = 'if ($ref != $desired)
{
header('Location:}
else
{
header('Location:}
?>
-----
I do not have access to my .htaccess file. Mt ISP will not allow me to.
Please can someone either point out where I am going wrong, or point me in the direction of a better way of doing this?
feherke and BigRed1212 on the html forum pointed out that if I stored the login info in $_SESSION and redirect the to the login page if is not logged in or the login expired, but I am VERY nex wo php and do not know how to do this.
My login page code is VERY simple, and could definately be better
code ---
<p class="style3" style="width: 460px; height: 31px;">Access Code :
<input type="text" name="text2" style="width: 235px">
</p>
<p class="style1" style="width: 458px; height: 38px;"> Access Password :
<input type="password" name="text1" style="width: 233px"></p>
<p class="style2" style="width: 357px; height: 26px;"> <input type="button" value="Check In" name="Submit" style="color: #FFFFFF; background-color: #000000; background-image: url('images/btnbck.gif'); border-color: #000000"; onclick=javascript:validate(text2.value,"USERCODE",text1.value,"PASSWORDCODE") >
</p>
-----
I my defense, I was planing on encryping the page once I got it to work.
So any Advice will be great to get me going.
Thanks