joshysquashy Posted April 20, 2008 Share Posted April 20, 2008 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 More sharing options...
joshysquashy Posted April 20, 2008 Author Share Posted April 20, 2008 My bad! I deleted the setcookie command from the verification! Didn't realise I had done that! All fixed now! Link to comment https://forums.phpfreaks.com/topic/101996-solved-php-page-protection/#findComment-521986 Share on other sites More sharing options...
p2grace Posted April 20, 2008 Share Posted April 20, 2008 Glad you got it working, Could you hit the Topic Solved button so people don't have to check Thank you! Link to comment https://forums.phpfreaks.com/topic/101996-solved-php-page-protection/#findComment-522057 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.