Example of mail()
am 28.04.2006 15:03:49 von Renzo Clavijo
--0-1733122958-1146229429=:49607
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Hi all.
In the code bellow you'll find an easy to use example of mail().
I know it's very simple but the question is: How can I erase the
values held in $_REQUEST such that when I press F5 or I click "Reload"
there are no messages sent again?
Thanks a lot for your help.
Best Regards
RENZO CLAVIJO
PD: Please forgive me if my english is not OK
--------------
Correo
if(isset($_REQUEST['send_mail'])){
mail($_REQUEST['address_mail'],$_REQUEST['subject'],$_REQUES T['message']);
}
?>
---------------------------------
Blab-away for as little as 1ยข/min. Make PC-to-Phone Calls using Yahoo! Messenger with Voice.
--0-1733122958-1146229429=:49607--
Re: Example of mail()
am 28.04.2006 22:15:08 von benmoreassynt
Renzo Clavijo wrote:
>
> if(isset($_REQUEST['send_mail'])){
> mail($_REQUEST['address_mail'],$_REQUEST['subject']
$_REQUEST['message']);
> }
I would try something like this:
if(isset($_REQUEST['send_mail']))
{
mail($_REQUEST['address_mail'],$_REQUEST['subject']
$_REQUEST['message']);
unset($_REQUEST);
}
That should wipe all the variables in $_REQUEST before the user clicks
reload. It will not work on a global variable if you use it inside a
function. There are other ways to do the same thing, but I think that
should do it.
BMA
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Example of mail()
am 28.04.2006 23:41:37 von benmoreassynt
benmoreassynt wrote:
> I would try something like this:
>
>
> if(isset($_REQUEST['send_mail']))
> {
> mail($_REQUEST['address_mail'],$_REQUEST['subject']
> $_REQUEST['message']);
> unset($_REQUEST);
> }
As a follow up, if you want to use that in a public environment, you really
need to run the $_REQUEST array through something like strip_tags() at the
very least, and probably write your script in such a way that nobody can
inject headers into the form for spamming. The archives of the PHP mailing
list include ways to do it.
BMA
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: Example of mail()
am 29.04.2006 08:18:08 von John Hicks
> Renzo Clavijo wrote:
> I know it's very simple but the question is: How can I erase the
> values held in $_REQUEST such that when I press F5 or I click "Reload"
> there are no messages sent again?
>>
>> if(isset($_REQUEST['send_mail'])){
>> mail($_REQUEST['address_mail'],$_REQUEST['subject']
> $_REQUEST['message']);
>> }
benmoreassynt wrote:
> I would try something like this:
> if(isset($_REQUEST['send_mail']))
> {
> mail($_REQUEST['address_mail'],$_REQUEST['subject']
> $_REQUEST['message']);
> unset($_REQUEST);
> }
>
> That should wipe all the variables in $_REQUEST before the user clicks
> reload. It will not work on a global variable if you use it inside a
> function. There are other ways to do the same thing, but I think that
> should do it.
No. That won't work. The variables will be sent to the server all over
again when the user reloads after sending the original email.
I guess the simplest solution is to do a redirect to a confirmation page
after sending the mail. That way a reload will not be reloading the post
but the confirmation page.
This won't prevent malicious spam. For that you will need to issue a
token and track submissions by token (and/or IP address).
(Also, please note:
--Your
Re: Re: Example of mail()
am 30.04.2006 12:28:00 von Julien Bonastre
>
>> Renzo Clavijo wrote:
>> I know it's very simple but the question is: How can I erase the
>> values held in $_REQUEST such that when I press F5 or I click
>> "Reload" there are no messages sent again?
>>>
>>> if(isset($_REQUEST['send_mail'])){
>>> mail($_REQUEST['address_mail'],$_REQUEST['subject']
>> $_REQUEST['message']);
>>> }
>
> benmoreassynt wrote:
>> I would try something like this:
>> if(isset($_REQUEST['send_mail']))
>> {
>> mail($_REQUEST['address_mail'],$_REQUEST['subject']
>> $_REQUEST['message']);
>> unset($_REQUEST);
>> }
>>
>> That should wipe all the variables in $_REQUEST before the user
>> clicks
>> reload. It will not work on a global variable if you use it inside a
>> function. There are other ways to do the same thing, but I think that
>> should do it.
>
> No. That won't work. The variables will be sent to the server all over
> again when the user reloads after sending the original email.
>
Quite right..
I use something as such
Somewhere in the