scotttyz Posted March 2, 2004 Share Posted March 2, 2004 trying to secure form submited info to disalow spammers. Any other PHP'ers out there with suggestions?? ><?php // set up variables $redirect = "thanks.url"; \\your thank you URL $subject = "Enter a subject here"; \\your subject $mailingto = "you@******"; \\hardcoded to: field $headers = "From: webserver@******\r\n" . "Reply-to: webserver@******\r\n" . "X-Mailer: PHP-" . phpversion(); \\change who you want the emails from $message = ""; \\just clearing anything a spammer tried to pass $tmessage = ""; \\just clearing anything a spammer tried to pass $securemessage ""; \\just clearing anything a spammer tried to pass $welcome = "enter message to send to form submittal recipient \n" \\start your email $footer = "this will apear after the form data\n" \\ this will end the email //parse form submittal - enters each field submitted on a new line "name : value" foreach($HTTP_POST_VARS as $key => $value) { $message .= $key ." : " .$value ."\n"; } //eliminate any email at's $securemessage = srt_replace('@', "at", $message); //build email $tmessage = "$welcome\n\n$message\n$footer"; $ret = mail($mailingto, $subject, $securemessage ,$headers); //make sure we sent email and redirect if ($ret) { header("Location: $redirect"); } else { echo('<h1>Enter your WOOPS form did not work here</h1>'); } ?> I have not checked the script yet, but wanted to get some input. I am aware of some spammers trying to send cc:'s thru form subbmitions and want to make a simple php script that had every place there could be an email either hardcoded or check and remove any @'s. Thoughts? Suggestions? Martini's?? Quote Link to comment Share on other sites More sharing options...
charle97 Posted March 2, 2004 Share Posted March 2, 2004 the ultimate form mail script is a php based form mail that does several checks. Quote Link to comment Share on other sites More sharing options...
scotttyz Posted March 2, 2004 Author Share Posted March 2, 2004 Thanks for the input Charlie. Unfortunately I have 2 php scripts that do other things in addition to sending out an email (append or modify a .htaccess style file) and it would take way to much work to try to include a script like that into my pages, but thanks for the info on a secure PHP form mailer!! Rock Sign Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.