Re: Re: Example of mail()

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

 




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?
  <?php
  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 <form> tag lacks an 'action' property.
--You are not doing any validation of your input fields.
--By allowing the user to input the TO address, you are essentially offering all the word an open relay for transmitting spam. This makes you evil. May you soon be cut off by your ISP. Or repent and find salvation :)
)

-J

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux