Re: General use of rewrite / redirect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Aschwin Wesselius wrote:

> Ok, let me point it out with an example:
> 
> include(this);
> include(that);
> connect(db);
> session check
> 
> That is what normally could exist on a script for every page hit.

Yep, that looks common enough.

> If you have a page that only does this:
> 
> if (GET || POST) {
>     process form variables
>     header (location: thankyou)
>     exit
> }
> else {
>     whatever
> }
> 
> On the thankyou:
> 
> echo 'thank you'
> 
> What happens is that just for submitting a form (or any process on any
> page), most cases all kind of libraries are included, db connection is
> made, sessions are checked etc. Besides the effect on PHP, the
> webserver does his job too, writing to logs, creating threads etc.
> Conclusion is 'load per page'.

Well, only if you write it like that.  The typical "Thank you" page does
not include all of that stuff.  It's pretty much static with some
(cached) graphics, a "Thank you" and a link back to the main page (or
whereever).

> That is my question. How do you people think about the trade-off of
> performance against the ease of just redirecting to another URL just
> to be sure a user get's to the right destination?

My typical setup for a form-page probably looks like this:

if ( $_POST )
{
        // do POST processing
        header(303 thankyou.html).
        exit
}
// regular page starts here
// process GET (if any)
// database stuff
// display page.



/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux