We help IT Professionals succeed at work.

The page isn't redirecting properly

Hi Experts,

I've just uploaded a PHP code that works on my localhost, but on the server FF gives me:

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.

    This problem can sometimes be caused by disabling or refusing to accept cookies.


IE just hangs.

The code behind this is
  $user = $_POST['txtUser'];
        $password = $_POST['txtPassword'];
        $login_status = Login::verify_login($user, $password);
    
        if ($login_status == 'admin') {
            header('Location: index.php?action=list');
        } 
        else if ($login_status == 'rs') {
            header('Location: ../dispatch');
        } 
        else {
            header('Location: ../?type=err&msg=User Id / Password combination not found.');
        }
      

Open in new window


What could it be?  Again, under localhost, no issues..
Comment
Watch Question

Commented:
Always add a die() underneath header() lines that redirect the Location. Not sure if it's relevant, but it'll avoid continuing to run the script, which could introduce unexpected behavior.
APD TorontoSoftware Developer

Author

Commented:
Still happening
Commented:
Install Fiddler if you don't already have it installed, then turn it on to start capturing requests and reproduce the problem. It should tell you all the redirects that are happening.
APD TorontoSoftware Developer

Author

Commented:
Fiddler?
Dave BaldwinFixer of Problems
Most Valuable Expert 2014
Commented:
In this one...
header('Location: ../?type=err&msg=User Id / Password combination not found.');

Open in new window

'/' is not a 'legal' character in a query string.  It must be urlencoded or percent encoded.  %2F
header('Location: ../?type=err&msg=User Id %2F Password combination not found.');

Open in new window

Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
Fiddler - network debugging tool.
http://www.telerik.com/fiddler
APD TorontoSoftware Developer

Author

Commented:
Thanks
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
You're welcome!