Step by step I am getting there... not that easy to make the debugger work.
What I am trying to do is debug a user login page that uses a POST form. That page is (quite cleverly) called "login.php" and its code is mainly a huge switch statement that examines the value of a $_POST variable 'action'.
Here is a snippet of the code:
switch($action)
{
case 'userlogin':
DebugBreak();
$logged_user_name = $_POST['user_name'];
...
if (user_exists($logged_user_name))
{
save_user_profile($logged_user_name);
header($header_location.'index.php?'.SID);
exit;
}
...
default:
DebugBreak();
show_default('');
break;
} |
I load the page in my browser a first time, without any parameter and it switches to 'default', which displays the login page. I put the login and password in (the correct ones) and submit, which send to the same php script with the 'action' variable set to "userlogin". The DebugBreak does what it is supposed to do, I get control with phpED and can step through the code. All is well until I get to the line
header($header_location.'index.php?'.SID);
|
At that stage, what should happen is that I get redirected to the index page since the login check found that all is well. When the debugger is disabled, that works fine. When it is enabled though, it just stops there and never redirects me.
Any idea why?
I suspect that might have to do with the fact (explained in a previous post) that when the debugger is enabled, all the HTTP headers are printed on the output (browser). Maybe they are printed on the output INSTEAD of being sent as headers, rather that in addition to being sent as headers as I assumed it was (some sort of debugging feature)
Any idea how to avoid that?
Cheers,
Wabiloo