You are here: Re: How can I get this redirect to work? (and this mail function) « PHP Programming Language « IT news, forums, messages
Re: How can I get this redirect to work? (and this mail function)

Posted by ljb on 11/07/07 01:31

anrdaemon@freemail.ru wrote:
> Greetings, ljb.
> In reply to Your message dated Tuesday, November 6, 2007, 05:25:41,
>
>>>> > > <?php
>>>> > > header('Location:http://www.PAGE-TO-REDIRECT-TO.com/');
>>>> > > mail('my-em...@website.com', 'TEST', $_SERVER['REMOTE_ADDR']);
>>>> > > ?>
>>>>
>>>> > <?php
>>>> > mail('my-em...@website.com', 'TEST', $_SERVER['REMOTE_ADDR']);
>>>> > header('Location:http://www.PAGE-TO-REDIRECT-TO.com/');
>>>> > ?>
>>>>
>>>> So that would redirect the browser and then send the IP address of the
>>>> person accessing the page to an email?
>>>
>>> that sends an email then redirects the browser.
>>> notice the difference?
>
>> You got me. What is the difference? Since mail() runs server-side, and
>> header sends lines to the browser, I can't see why the order would make any
>> difference. Both are PHP functions, and both will run regardless of the
>> order in the script. Won't they?
>
> If server didn't set up to buffer script output, headers will be sent almost
> immediately.

Interesting discussion. Shows I can always learn something.
Let's also add: From a programming point of view, it would be better to do
mail() etc before headers. Someone reading the code some time in the future
can more clearly see what happens: we send mail, and (then) redirect the
user to...

 

Navigation:

[Reply to this 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

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