PHP header redirect not working when posting a form - using output buffer - but does in other cases? -


I have an unusual problem, the following code is happening on one server only

 . ... elseif ($ _GET ['action'] == 'login') {if ($ _ POST ['login_name'])) {$ _POST ['LOGIN_NAME'] = ''; } If ($ _ POST ['login_pass'])) {$ _POST ['login_pass'] = ''; } If {(($ _ POST ['send'])) {if (($ _POST ['login_name'] == _ ADMIN_NAME) and ($ _POST ['login_pass'] == _ ADMIN_PASS)) // Successfully logged in $ _SESSION ['Login'] = 1; // Header does not work ('location:'. $ Filename); die ('command'. $ Filename);}} // show form; (' Plogin.inc.php ');} Otherwise ($ _GET [' verb '] ==' logout ') {$ _SESSION [' log '] = - 1; // will work! Header (' location: ' $ Filename);}  

The problem is that if I click on link logout, all goes well and I am redirected to $ filename. If I submit the entry form, it checks that the post is correct, the set of sessions is set, but then dies rather than redirecting.

Reporting all the errors to me, but (no error) But the output buffers were found, even when I post with the form, it is not redirected, even if it definitely passes (because the session is set var and I get a part of the death) / P>

What could be the reason for this behavior? Thank you

I also found redirected, sometimes after the POST request, does not work. This server browser is not a problem, I think

I use something like this:

  if (sizeof ($ _POST) == 0) header ( "Location:". $ Url); Other resonance '& lt; Html & gt; & Lt; Principal & gt; & Lt; Meta http-equiv = "Refresh" content = "1; url = '. $ Url." "/> Gt; . $ Url '& lt; / body & gt; & lt; / html & gt; In short, if this is a post request - then I use the html refresh redirect, otherwise - the normal header redirect. 


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -