Jump to content

[SOLVED] redirect loop problem


dennismonsewicz

Recommended Posts

I have this code:

 

session_start();
ob_start();

$username = $_SESSION['username'];

if(!$username) {
	header("location: index.php?action=login");
}

 

the $username var is for testing... in Firefox i am getting a redirect loop error... any ideas?

Link to comment
https://forums.phpfreaks.com/topic/143519-solved-redirect-loop-problem/
Share on other sites

thanks flyhoney!

 

rhodesa: the code is at the top of my header.php... why would that have created an infinite loop?

 

do you include your header.php file on your index.php page? cus the page tries to load, runs header.php, doesn't find a username in SESSION, redirects to index.php?action=login, loads header.php, doesn't find a username in SESSION, redirects to index.php?action=login....

 

do you see the loop?

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.