musicalcat Posted June 21, 2006 Share Posted June 21, 2006 I have a php page that process information entered in a form. I'm getting spam through that form. I've tried all kinds of php code to stop getting the spam. Now I'm wondering if it's possible to block special characters in the message field. Because in these spam messages I get links and forum codes like [/URL]. So I'd like to know if I can block characters like [ and ] in the message field with php code. Anyone know if that's possible? So if the $message field contains characters like [ and ] it won't be sent.I hope somone understands what I'm trying to say.Thanks in advance :) Quote Link to comment https://forums.phpfreaks.com/topic/12501-spammed-through-the-php-form/ Share on other sites More sharing options...
redarrow Posted June 21, 2006 Share Posted June 21, 2006 [!--quoteo(post=386224:date=Jun 21 2006, 01:23 AM:name=tabby)--][div class=\'quotetop\']QUOTE(tabby @ Jun 21 2006, 01:23 AM) [snapback]386224[/snapback][/div][div class=\'quotemain\'][!--quotec--]I have a php page that process information entered in a form. I'm getting spam through that form. I've tried all kinds of php code to stop getting the spam. Now I'm wondering if it's possible to block special characters in the message field. Because in these spam messages I get links and forum codes like [/URL]. So I'd like to know if I can block characters like [ and ] in the message field with php code. Anyone know if that's possible? So if the $message field contains characters like [ and ] it won't be sent.I hope somone understands what I'm trying to say.Thanks in advance :)[/quote]look up eregi ok.YOUR have to look up the revelent code stucture ok.[code]<?if(!erigi("^[url]\$",$message) {echo" sorry you enter a bad charecter or name";}?>[/code]Adding a captcha will let the user enter a random letter to slow the user down fromspaming but will not stop spaming.Should really let only users that are logged in users use a form except a regesration form.If the form is a form that a registered user keeps spamming band that user from posting posts band via there id. Quote Link to comment https://forums.phpfreaks.com/topic/12501-spammed-through-the-php-form/#findComment-47870 Share on other sites More sharing options...
yonta Posted June 21, 2006 Share Posted June 21, 2006 You could try to protect your form with a captcha image script. Just [a href=\"http://www.google.com/search?hl=en&q=php+captcha&btnG=Google+Search\" target=\"_blank\"]google it[/a]. Quote Link to comment https://forums.phpfreaks.com/topic/12501-spammed-through-the-php-form/#findComment-47871 Share on other sites More sharing options...
musicalcat Posted June 21, 2006 Author Share Posted June 21, 2006 Thanks. I'll try that.Take care! Quote Link to comment https://forums.phpfreaks.com/topic/12501-spammed-through-the-php-form/#findComment-47873 Share on other sites More sharing options...
AndyB Posted June 21, 2006 Share Posted June 21, 2006 [a href=\"http://www.imarc.net/blog/61/stopping_blog_comment_spam_with_php/\" target=\"_blank\"]http://www.imarc.net/blog/61/stopping_blog..._spam_with_php/[/a]I added that and it stopped almost all of the 'messages' from losers peddling medical solutions to problems I don't have! Quote Link to comment https://forums.phpfreaks.com/topic/12501-spammed-through-the-php-form/#findComment-47878 Share on other sites More sharing options...
redarrow Posted June 21, 2006 Share Posted June 21, 2006 Heres my example if you want to use it ok[code]$message = $message;$mess=array("@", "*", "$", "'", "{", "}", "<br>", "mysql", "connect", "</br>", "password", "money", "scam", ".", "com", "net", "uk");foreach($mess as $val) {$invalid = strpos($message, $val);if($invalid===FALSE) { $count++; }}$array_count = count($mess, COUNT_RECURSIVE);if($count==$array_count) { //INSERT DATABASE}else { echo "<b>Your message contains illegal words / characters</b><br><br>Please try agin!<br><br><a href='url.php'>Please try agin</a>";}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12501-spammed-through-the-php-form/#findComment-47885 Share on other sites More sharing options...
musicalcat Posted June 21, 2006 Author Share Posted June 21, 2006 Thanks for your help.I've tried both code suggestions. But I wasn't able to get it to work. I think this is too difficult for me. Quote Link to comment https://forums.phpfreaks.com/topic/12501-spammed-through-the-php-form/#findComment-47904 Share on other sites More sharing options...
redarrow Posted June 21, 2006 Share Posted June 21, 2006 [!--quoteo(post=386263:date=Jun 21 2006, 03:08 AM:name=tabby)--][div class=\'quotetop\']QUOTE(tabby @ Jun 21 2006, 03:08 AM) [snapback]386263[/snapback][/div][div class=\'quotemain\'][!--quotec--]Thanks for your help.I've tried both code suggestions. But I wasn't able to get it to work. I think this is too difficult for me.[/quote]What is the name of the varable that holds the information that your checking?. Quote Link to comment https://forums.phpfreaks.com/topic/12501-spammed-through-the-php-form/#findComment-47906 Share on other sites More sharing options...
musicalcat Posted June 21, 2006 Author Share Posted June 21, 2006 I'm sorry. I'm lost again.What is "varable"?What php codes I've used to build the page that process the info is on this page:[a href=\"http://www.tutorialtastic.co.uk/page/php_feedback_form_advanced\" target=\"_blank\"]http://www.tutorialtastic.co.uk/page/php_f...k_form_advanced[/a]I've just changed the form action link, the number of input type fields and their names to fit my form fields. Quote Link to comment https://forums.phpfreaks.com/topic/12501-spammed-through-the-php-form/#findComment-47967 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.