PHP Redirect Loop -
On my index page, I have a link with this code on my login.php page:
& lt ;? Php if (isset ($ _ session ['username'])) {echo "and IDE = 'logout'> "; } F {echo " gt; & lt; a href = 'login.php' & gt; login (regular) & lt; / div & gt; ; "; }? & Gt; I have access to the login.php page
& lt ;? Include php ('check.php'); $ Ref = getenv ('HTTP_REFERER'); If (isset ($ ref)) {header ("Location:". $ Ref); Go out; } Other {header ("location: index.php"); Go out; }? & Gt; check.php is the code for the login form and it ensures that they can access the page. I was told that I need to add an inquiry to see if there is a referral login. Php, otherwise it will go into an infinite loop and I'm definitely getting "There is a redirect loop in this webpage". However, I have no clue how to do this and how can I get the information about how to fix it. Anyone know the quick solution?
All you need to do is
if (isset ($ _ SERVER ['HTTP_REFERER']) & amp; amp; amp; amp; amp; amp; amp; end; explosion ('/', $ _ server ['HTTP_REFERER'])! = 'Login Php ') {header ("location: $ _SERVER [' HTTP_REFERER ']); go out;} other {header (" location: index.php "); go out;} Note that this is a simplified code - you may have to be a little more efficient than this.
Comments
Post a Comment