PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
This web page has a redirect loop
The web page at http://www.xxx.com/ has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
Here are some suggestions:
Reload this web page later.
Learn more about this problem.
Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.
There are several fundamental problems here. This will only redirect if the user types in http://xxx.com/ If I type in http://xxx.com/index.html it won't work. You're probably redirecting multiple times because it is stuck in a loop detecting the xxx.com domain. Also, this script is open to XSS attacks.
You might be better off using mod_rewrite in .htaccess to handle this for you.
That's because originally you were using a single "=" in your script. You fixed this accidentally when you put the variable in.
You shouldn't compare strings using the == in an IF statement with PHP. Try using either preg_match or one of the string comparison functions. PHP can do funny things during string comparisons, it's best to use a string function for that.
Also you still need to filter those $_SESSION variable to avoid your server from getting hijacked by an XSS attack.
And you need to figure out if your IF statement really is catching all the cases that you need to redirect.