| | |
prevent links in textarea
Thread Solved |
•
•
Join Date: Aug 2006
Posts: 20
Reputation:
Solved Threads: 0
Hi All
I'm trying to combat some SPAM coming through on a booking form. It's all the usual rubbish.
I've been searching to find the php code that would do the following
if ($msg contains http:// or www.) {echo "Please don't put links in the comments - it looks like SPAM";}
else
email me (all this is already working)
I only know enough php to alter the sendmail from to my needs so far and can't work out (or find through google) the syntax to write this.
Would really appreciate any help you could offer.
Thanks
I'm trying to combat some SPAM coming through on a booking form. It's all the usual rubbish.
I've been searching to find the php code that would do the following
if ($msg contains http:// or www.) {echo "Please don't put links in the comments - it looks like SPAM";}
else
email me (all this is already working)
I only know enough php to alter the sendmail from to my needs so far and can't work out (or find through google) the syntax to write this.
Would really appreciate any help you could offer.
Thanks
Last edited by webecho; Mar 24th, 2009 at 12:10 am. Reason: clarify and simplify php line i'm looking for
•
•
Join Date: Aug 2006
Posts: 20
Reputation:
Solved Threads: 0
OK
Seem to have solved it
Basically, this just searches for the string www and if it finds it will display the message and warn them their email hasn't been sent.
Seem to have solved it
PHP Syntax (Toggle Plain Text)
elseif (preg_match("/www/", $msg)) { echo "Please don't post links in the questions box - it looks like SPAM and your message has NOT been sent"; }
Basically, this just searches for the string www and if it finds it will display the message and warn them their email hasn't been sent.
that won't stop all urls. http://google.com would work.
for a simple solution, change "/www/" to "/(http:\/\/|www)/"
for a simple solution, change "/www/" to "/(http:\/\/|www)/"
![]() |
Similar Threads
- javascript works in IE but not working in firefox (JavaScript / DHTML / AJAX)
Other Threads in the PHP Forum
- Previous Thread: help with making css/html code be a variable
- Next Thread: How i could check my password
Views: 553 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for PHP
access ajax apache array arrays beginner binary box buttons cakephp cart check checkbox class cms code cookies database date delete directory display download dropdown drupal dynamic echo email error file files form forms function functions header href htaccess html image images include insert ip java javascript joomla jquery limit link list login loop mail menu methods mlm mod_rewrite multiple mysql order output parse password paypal php problem query radio regex remote results script search security select server session soap sort sorting source sql string system table tutorial update updates upload url user validation validator variable video web website wordpress xml






