Hello, this webform is from The Web Help .com. I modifty it so visitor can input their name, email address, recepient email address, subject and message. The problem is, when visitor input email address like this in the recepient input box: , , or <dfss@yahoo.com>, <kljlkj@gmail.com>, the message will be sent to 2 to 3 selected recipent so if 10000 email format like above is being input in the recepient input box, my host will suspend me for sure... spammers can use my webform for sending spam . This is the code <?php // ----------------------------------------- // The Web Help .com // ----------------------------------------- // remember to replace you@email.com with your own email address lower in this code. // load the variables form address bar $to = $_REQUEST["to"]; $subject = $_REQUEST["subject"]; $message = $_REQUEST["message"]; $sendname = $_REQUEST["sendname"]; $from = $_REQUEST["from"]; $verif_box = $_REQUEST["verif_box"]; $headers .= 'From: ' . $sendname . ' <' . $from . ">\r\n" . 'Reply-To: ' . $from . "\r\n"; // remove the backslashes that normally appears when entering " or ' $to = stripslashes($to); $message = stripslashes($message); $subject = stripslashes($subject); $sendname = stripslashes($sendname); $from = stripslashes($from); // check to see if verificaton code was correct if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){ // if verification code was correct send the message and show this page mail($to, $subject, $message, $headers); // delete the cookie so it cannot sent again by refreshing this page setcookie('tntcon',''); } else { // if verification code was incorrect then return to contact page and show error header("Location:http://www.mydomain.com/?wrong_code=true"); exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>E-Mail Sent</title> <style type="text/css"> <!-- body,td,th { font-family: Arial, Helvetica, sans-serif; font-size: 12px; } --> </style></head> <body> Email sent. Thank you.<br /> <br /> Return to <a href="/">home page</a> ? </body> </html> PHP: What I want to do now is only allowed every visitor to input 1 email address in the recepient input box thats mean only 1 email will be sent... My webform also use captcha. The captcha works great. I hope anyone can help me with my web form. Thanks in advance.
When visitors input more than one email address, its will use only the first email address and ignore the rest. $to = $_REQUEST["to"]; $to = explode(',',$to); $to = (count($to)>1)?$to[0]:$to[0]; PHP: