amillsmcewan Posted June 13, 2009 Share Posted June 13, 2009 Hello Experts I recently downloaded what looks to be a very fully featured "membership-type" free script. My problem is that it does things like prompt for a member login and then tries to redisplay the same page with an indicator turned on to show an error message if the login is invalid. It uses: header("location:client_login.php?error=1"); to essentially re-display the page with a red error message. I am getting the error that you would expect: Warning: Cannot modify header information - headers already sent by (output started at blah blah blah in script blah blah blah. This happens throughout other parts of the script where header ("location: etc etc) is used to transfer control from one page to another (like pressing on a link, but under the script's control). It is unlikely that such as widely distributed script with about 60 sub-scripts has this fundamental error in it. Does anyone have any ideas? Is there some version of PHP that allows this? If I'd written it myself and mucked it up I could understand but the script seems otherwise very well written. That's why I think it must be something I've done rather than the author's error. Thanks in anticipation for your help. Alastair Link to comment https://forums.phpfreaks.com/topic/162074-headers-already-sent-problem-but-it-is-in-a-widely-distributed-script/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 13, 2009 Share Posted June 13, 2009 It's a script that did not use the "most common/least specific php configuration" available, probably because the person developing it was not experienced enough and just really wanted something that worked without regard to anything but what he was doing. Scripts that are intended to be distributed must be written to work on the greatest number of systems and with optional php settings in an off/default state. The code you are trying to use (in addition to being redirect-happy) most likely will only work if output buffing is globally turned on (before the script is requested.) Link to comment https://forums.phpfreaks.com/topic/162074-headers-already-sent-problem-but-it-is-in-a-widely-distributed-script/#findComment-855203 Share on other sites More sharing options...
amillsmcewan Posted June 15, 2009 Author Share Posted June 15, 2009 Thank you for your reply. Is this just a question of a change to the php.ini file? I am assuming that it must be something "environmental" like this since otherwise the code would never have worked. Thank you again for any advice. Link to comment https://forums.phpfreaks.com/topic/162074-headers-already-sent-problem-but-it-is-in-a-widely-distributed-script/#findComment-856561 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.