Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-09-2012, 12:07 PM   PM User | #1
jeddi
Senior Coder

 
Join Date: May 2006
Posts: 1,526
Thanks: 26
Thanked 4 Times in 4 Posts
jeddi has a little shameless behaviour in the past
How to check field contents ??

Hi,

I am getting to much span in my contact form and want to
filter out any messages with a link in them.

I have written this code:

PHP Code:
// Test for link in message.
if($Db_mess  ) {
    
$err_msg "Please do not use links in message."
    
require_once ("contact_fm.php");
    exit;
    }  
// endif 
I would like to know what test I can use to find
this :[B] [url=[/B]

This is always found in the spam messages.

Thanks for any help.
__________________
If you want to attract and keep more clients, then offer great customer support.

Support-Focus.com. automates the process and gives you a trust seal to place on your website.
I recommend that you at least take the 30 day free trial.
jeddi is offline   Reply With Quote
Old 11-09-2012, 12:39 PM   PM User | #2
patryk
Regular Coder

 
patryk's Avatar
 
Join Date: Oct 2012
Location: /dev/couch
Posts: 395
Thanks: 2
Thanked 64 Times in 64 Posts
patryk is on a distinguished road
take a look at preg_match()
http://php.net/manual/en/function.preg-match.php
patryk is offline   Reply With Quote
Old 11-09-2012, 04:45 PM   PM User | #3
jeddi
Senior Coder

 
Join Date: May 2006
Posts: 1,526
Thanks: 26
Thanked 4 Times in 4 Posts
jeddi has a little shameless behaviour in the past
So this should work then ...

[PHP]

if (preg_match("[url=", $Db_mess)) { // Test for link in message.
$err_msg = "Please do not use links in message."
require_once ("contact_fm.php");
exit;
} // endif
[/PHP]

Thanks for the help.
__________________
If you want to attract and keep more clients, then offer great customer support.

Support-Focus.com. automates the process and gives you a trust seal to place on your website.
I recommend that you at least take the 30 day free trial.
jeddi is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:36 PM.


Advertisement
Log in to turn off these ads.