Jump to content

[SOLVED] PHP page protection


joshysquashy

Recommended Posts

Hi,

 

I have a protected area on my website, and every protected page has the following at the top:

<? include_once("../php/protect.php"); ?>

 

The protect.php file is:

<?PHP 
$back = "<form><input type='button' value='< Back' onclick='history.back()'></form>"; 
$acc_denied = "<font face=\"Arial, Helvetica, sans-serif\"><h3>Access Denied, <a href=\"http://clients.uniquesite.co.uk/\">Please Login</a></h3></font>".$back;
if (!isset($_COOKIE["verified"])) { die($acc_denied); } 
?>

 

What I want is for the page to redirect to index.php?status=2, and I have tried doing:

<?PHP 
if (!isset($_COOKIE["verified"])) { header ("Location:http://clients.uniquesite.co.uk/index.php?status=2"); } 
?>

 

But now the page is redirected regardless of the cookie. Why does it always redirect this way? Why does the die() command doing to stop the page loading conditionally, but this does permanently?

 

I'm sure the solution will be a simple one, but I'm stumped!

 

Many thanks.

 

Link to comment
https://forums.phpfreaks.com/topic/101996-solved-php-page-protection/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.