Reply to Re: headers sent issue

Your name:

Reply:


Posted by Rik on 12/09/96 11:55

Mladen Gogala wrote:
> On Mon, 14 Aug 2006 13:42:58 +0200, Rik wrote:
>
>> The fact of the matter is: there is no real reason NOT to use
>> ob_start(). Hell, it can be very usefull. If you're using it to be
>> able to send headers without regard to output, it shouldn't be
>> necessary however. The script doesn't break, there isn't a real
>> security issue. It's just a sign of you coding practices: sloppy.
>
> Actually, not necessarily. I use ob_start() in scripts like this one:
>
><snip code>
>
> Here I deliberately and explicitly send HTML headers in such a way
> that I can set the background color and write a line of text in HTML.
> I don't see why would I program those things in PHP when HTML is made
> for presenting static information in an easy way. PHP was designed to
> mix freely with
> HTML. All I want to do in this script is to print a warning and, if
> answered with "yes", kill the session, then go back to the invoker.
> Without "ob_start()" in the beginning, I am unable to use header()
> function on Win2k/Apache 2.0.54/PHP 5.1.4. How will ob_start() byte me
> later?

Well, on a server you generating and trashing content that didn't need to
be build in the first place. Not necessarily an issue, but a huge waste of
resources, cpu & memory.

What's the problem with the following flow?

1. start session
2. if form is submitted and answer is yes, destroy session and redirect
3. else show form

It will produce a lot less overhead.
--
Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация