Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Hacks and Modifications

Post Reply
 
Thread Tools
  #1  
Old 05-15-2006, 04:43 PM
peppy Offline
forum loafer
 
Join Date: Jan 2006
Location: Germnay / Duisburg
Posts: 6
Send a message via ICQ to peppy
Anti-Spam Addon Modification for Frontend

Hi,

i´m sorry for my english and i hope you understand me.

In the last days i had many spammers that used my comment-formular for commercial comments.

It is easy to kill this comments with the addon Pixelpost Anti-Spam (anti_spam.php - version 2.0). But after some days i hade no fun to kill this comments manual. So i changes the index.php. With this modification the script compares the comment with the spamlist of the Anti-Spam-Addon before the comment will be saved. If there ist more than one word in the spamlist, the script exits.

To use the modification you must use the Pixelpost Anti-Spam-Addon (anti_spam.php - version 2.0)

Than you must insert following code in the index.php

PHP Code:
            // do not insert comments with spam
                
$level_of_spamprotection 1;  //how many words of your spamlist should be in a comment before it is spam
                
$message_temp explode(" ",$message );
                
$spam_i 1;
                
                
// Get the ban list
                
$query "SELECT banlist FROM {$pixelpost_db_prefix}ban LIMIT 1";
                
$result mysql_query($query) or die( mysql_error() );
                if( 
$row mysql_fetch_row($result) ) {
                    
$banlist $row[0];
                    
$banlistarray explode"\n"$banlist );
                } else {
                    
$banlist '';
                    
$banlistarray = array();
                }
                
                
$spam_array $banlistarray;
        
                foreach(
$message_temp as $ti) {
                        if (
in_array($ti$spam_array)) {$spam_i ++;}
                } 
                if (
$spam_i $level_of_spamprotection ) {die ("Your comment contained words which are filtered by my spam list");}
            
// do not insert comments with spam 
Thera are two places where this code must be insertet. First one is bevore this line
PHP Code:
        sql_save("
    insert into "
.$pixelpost_db_prefix."comments(id,parent_id,datetime,ip,message,name,url,email)
               VALUES('NULL','$parent_id','$datetime','$ip','$message','$name','$url','$email')
                    "
); 
Second one is before this line
PHP Code:
if($parent_id == "")    $extra_message "<b>$lang_message_missing_image</b><p />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
Tested with version 1.4.2 of Pixelpost.
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 02:57 PM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs