.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Programming
General Programming Help others and get yourself helped here!

Reply
 
Thread Tools
PHP Message Help
Old
  (#1)
Ancient
PodBot MM's Laziest Waypointer
 
Ancient's Avatar
 
Status: Offline
Posts: 1,010
Join Date: Jan 2005
Location: Nebraska, United States of America
Default PHP Message Help - 16-06-2007

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://'));
 
if(in_array(array('sex', 'porn', 'unknown', 'Unkown', 'geocities', 'tripod', 'http://'), $badwords));
How can I hook it up to search the $message for $badwords?


[Web Designer][Waypointer][Gamer]
CFE Games Administrator
[CFE]Games.com
[Never Trust the Untrusted]
  
Reply With Quote
Re: PHP Message Help
Old
  (#2)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: PHP Message Help - 16-06-2007

try strstr() function.
  
Reply With Quote
Re: PHP Message Help
Old
  (#3)
Ancient
PodBot MM's Laziest Waypointer
 
Ancient's Avatar
 
Status: Offline
Posts: 1,010
Join Date: Jan 2005
Location: Nebraska, United States of America
Default Re: PHP Message Help - 16-06-2007

Code:
elseif(stristr($message, array('unknown', 'sex', 'porn', 'some sites', 'community', 'support', 'label', 'tripod', 'geocities', 'yahoo')) === FALSE)
 {
  die("there is something bad");
 }
Doesn't work well.

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)
 {
  die("Subject is bad");
 }
I found out when there is more than 1 option to look for it will ignore the script or string and move on.
Also if the string is in a certain way it will always die looking in the string or not.


[Web Designer][Waypointer][Gamer]
CFE Games Administrator
[CFE]Games.com
[Never Trust the Untrusted]

Last edited by Ancient; 16-06-2007 at 20:58..
  
Reply With Quote
Re: PHP Message Help
Old
  (#4)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: PHP Message Help - 17-06-2007

well... just use a for loop then

PHP Code:
for ($i 0$i count ($badwords); $i++)
  {
    if (
strstr ($message$badwords[i]) != FALSE)
      {
        die (
"bad words detected");
      }
  } 
  
Reply With Quote
Re: PHP Message Help
Old
  (#5)
Ancient
PodBot MM's Laziest Waypointer
 
Ancient's Avatar
 
Status: Offline
Posts: 1,010
Join Date: Jan 2005
Location: Nebraska, United States of America
Default Re: PHP Message Help - 02-11-2007

Thanks for the loop, runs great when searching a file extension against an extensions array list.


[Web Designer][Waypointer][Gamer]
CFE Games Administrator
[CFE]Games.com
[Never Trust the Untrusted]
  
Reply With Quote
Re: PHP Message Help
Old
  (#6)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Online
Posts: 1,620
Join Date: Jul 2004
Location: Bulgaria
Default Re: PHP Message Help - 30-01-2011

stristr() will work but the you have to change the condition from == to != .
Oh this is old thread, the spam bot had confused me...
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

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



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com