PHP Message Help
I'm trying to fend off spammers in my hosting contact form and I have this idea to help stop it.
In these emails they are sending the form with keywords in it like for example: $badwords. And I'm trying to make a code for it to search what they wrote and send and if it finds one of the $badwords that it will die();. What I have is: Code:
$badwords = array(array('sex', 'porn', 'unknown', 'Unkown', 'geocities', 'tripod', 'http://')); |
Re: PHP Message Help
try strstr() function.
|
Re: PHP Message Help
Code:
elseif(stristr($message, array('unknown', 'sex', 'porn', 'some sites', 'community', 'support', 'label', 'tripod', 'geocities', 'yahoo')) === FALSE) It will die weither there is a $badword or not. I have also tried it true, and stristr and they all come back with the die weither the $badword is in it or not. It works for finding something in a subject, but the subject doesn't have an array. Code:
elseif(!stristr($subject, 'unknown') == FALSE) Also if the string is in a certain way it will always die looking in the string or not. |
Re: PHP Message Help
well... just use a for loop then :)
PHP Code:
|
Re: PHP Message Help
Thanks for the loop, runs great when searching a file extension against an extensions array list.
|
Re: PHP Message Help
stristr() will work but the you have to change the condition from == to != . :)
Oh this is old thread, the spam bot had confused me... |
All times are GMT +2. The time now is 13:39. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.