Jump to content

Recommended Posts

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 :)
Link to comment
https://forums.phpfreaks.com/topic/12501-spammed-through-the-php-form/
Share on other sites

[!--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 from
spaming 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.



[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!
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]
[!--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?.
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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.