PDA

View Full Version : Ban certain words in a web form


luke
06-20-2009, 10:59 AM
Hiya,

Could anyone point me in the right direction to finding a PHP script that when a persons clicks on submit on a form, it checks to see if there is certain words or phrases in it, and it there is, display an error, else continue with the script?

Thanks

MagicPower
06-29-2009, 04:16 AM
for example if there are swear words. the form doesn't get submitted

bee80
06-29-2009, 08:15 PM
are u 2 ppls :) you need to be looking at a string replace script i think

luke
07-01-2009, 05:23 PM
for example if there are swear words. the form doesn't get submitted


Yh, thats wot i were trying to sai :lol:

luke
07-01-2009, 05:25 PM
are u 2 ppls :) you need to be looking at a string replace script i think


Cheers m8 :-D sorted now.

i used
<?php
$dontdisplay = array("....", "..", "whateva u wont to ban", "http://", "www.");
$no = str_replace($dontdisplay, "", $comment);
?>
use http://php.about.com/od/phpfunctions/g/str_replace_php.htm which helps if any one needs this