Jonnyabc 0 Report post Posted March 22, 2010 I've done some research on the internet about the following issue, and think I have a small understanding of the issue at hand. I am receiving the following error(s) on my new sub-domain site at SocialCite when I attempt to login with the valid username "Jonnyabc" and password "jonnyabc". Warning: Cannot modify header information - headers already sent by (output started at /home/jonnyabc/public_html/global.php:2) in /home/jonnyabc/public_html/global.php on line 130Warning: Cannot modify header information - headers already sent by (output started at /home/jonnyabc/public_html/global.php:2) in /home/jonnyabc/public_html/global.php on line 131 I had a problem with another piece of code, and all of the problems I seem to be having evolve around setting cookies. From what I have read, it is understood to place this code (or reference thereof) at the very, very top of the page before the <html> tag.Here's the very basic psuedocode for the related functions of the global.php file:function login(...) logout(...) check database if all is true setCookie(...username...) setCookie(...password...)function logout(...) if cookie username set, setCookie(...username...) if cookie password set, setCookie(...password...) Originally, I was having problems with the logout() cookies, but have finally gotten that resolved. Now I am having problems with setting the cookies in login() when "all is true". The code works fine locally running WampServer, but not on the website. I am willing to believe that setting the cookies twice on the same page creates this error, but I am not certain of that.Please advise. Share this post Link to post Share on other sites
afshin_a 0 Report post Posted March 22, 2010 I think if it works localy fine ,so it' because of your web server may be it add some character start of your page Share this post Link to post Share on other sites
truefusion 3 Report post Posted March 22, 2010 Served pages have a similar structure to that of e-mails. Headers are always supposed to come first before the page's content is received. The "headers already sent" message is due to the script echoing (or printing) information before sending headers. Recheck the structure of your code and make sure setcookie comes before all echos and prints. Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted March 23, 2010 just a blank space sent before you try to set a header will throw that error.post your full code. Share this post Link to post Share on other sites