Subbony Posted June 28, 2010 Share Posted June 28, 2010 I'm using cookies to password protect my site. If a visitor can get from index.php to index2.php by using the correct password, I set a cookie. None of the other pages will show unless they have that cookie. (Yes, faulty, but it's a temporary fix until I learn how to do something better.) If they don't have the cookie, I redirect them back to index.php. So far this has been working fine. Then I put this code into index.php. It's basically checking to see if the visitor has already entered the password/gotten the cookie, and if so, sends them directly to index2.php. <?php if (isset($_COOKIE['jbcookie'])) { header("Location: http://www.site.com/index2.php"); exit; } ?> For some reason, though, this sends Firefox into a tailspin. "The page isn't redirecting properly. Firefox has detected that the server is redirecting the request for this address in a way that will never complete." I'm using the exact same code on the other pages, except with a ! before the isset and redirection to index.php. Copy-paste! What's wrong? Link to comment https://forums.phpfreaks.com/topic/206112-checking-for-cookie-and-then-using-header-redirect-fails/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.