I am writing a website and i have a user login system. I am sending out alot of headers. I have a functions.inc page wich is where i write all the script then on the individual pags i just use function() and reference the specific function. However, i am encountering alot of headers already sent errors.
Does anybody have a better solution for this or can help me on a better way to layout my code?
I thought about ob_start(); but i can't figure out how to use it.
Any help you can provide would be awsome.
Thank you
Anthony
Best way to layout code?
Moderator: General Moderators
-
pinehead18
- Forum Contributor
- Posts: 329
- Joined: Thu Jul 31, 2003 9:20 pm
-
pootergeist
- Forum Contributor
- Posts: 273
- Joined: Thu Feb 27, 2003 7:22 am
- Location: UK
Re: Best way to layout code?
I presume from that line that you are aware of the headers you are sending and I'd guess are using them as conditional redirects (most other headers couldn't be ran as inline code after a http one is sent)pinehead18 wrote:I am sending out alot of headers
output buffering would be the sensible fix.
<?php
ob_start("ob_gzhandler");
// rest of code - sessions, cookies, db, html output etc.
ob_end_flush();
?>
the ob_gzhandler just compresses the data into a gzip format for the client browser to unzip - leave a blank parameter for no compression ob_start();