############################################################## ## MOD Title: Spam Words ## MOD Author: foxumon http://www.contropa.com ## MOD Description: This MOD blocks posts with certain buzz words and will PM ## the post and poster information to an admin account ## MOD Version: 1 ## ## Installation Level: Easy ## Installation Time: 5 Minutes ## Files To Edit: includes/functions_post.php ## ## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 ############################################################# ## Author Notes: ## ## Very simple mod, there is no admin control panel, and ## no edits to the database are required. ## ## Features: ## -Checks if a post includes any designated spam words ## -Set how many times those words need to be found to mark as spam ## -Set how many posts a user needs to have their post checked ## -PM a designated account with details about the post ## ## No guarantee if it is up to date or will work on your system ############################################################## ## MOD History: ## ## 2010-08-10 - Version 1.0.0 ## - Initial Release ## ############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ############################################################## # #-----[ OPEN ]------------------------------------------ # includes/functions_post.php # #-----[ FIND ]------------------------------------------ # // // Handle poll stuff // # #-----[ BEFORE, ADD ]------------------------------------------ # // //spam words for usrs w/ less than 100 posts //notifies admin and prevents posting // if($userdata[user_posts] < 100) { //list of spamwords - seperate by | if(preg_match_all("#nokia|phone|blackberry|sex|free|sale|samsung|apple|porn|xxx|loan|credit|buy|motorola|playstation#i",$message,$m)) { $count = sizeof($m, COUNT_RECURSIVE); //check if words included more than 10 times if($count > 10) { $uid = make_bbcode_uid(); $ip = (!empty($HTTP_SERVER_VARS['REMOTE_ADDR'])) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ((!empty($HTTP_ENV_VARS['REMOTE_ADDR'])) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR')); //create message to admin $msg = 'A user tried to make a post containing spam words at '.$_SERVER['SERVER_NAME'].' [b:'.$uid.']Username:[/b:'.$uid.'] '.$userdata['username'].' [b:'.$uid.']E-mail:[/b:'.$uid.'] '.$userdata['user_email'].' [b:'.$uid.']IP:[/b:'.$uid.'] '.$ip.' [b:'.$uid.']Message:[/b:'.$uid.'] '.$message.' '; //designate user_id to send PM $admin_id = 1; // Send PM to admin $time = time(); mysql_query('INSERT INTO '.PRIVMSGS_TABLE.' (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig) VALUES("5", "Spammer post blocked by spamwords", "'.$userdata['user_id'].'", "'.$admin_id.'", "'.$time.'", "'.$ip.'", 1, 1, 1, 0)'); $privmsg_sent_id = mysql_insert_id(); mysql_query('INSERT INTO '.PRIVMSGS_TEXT_TABLE.' (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text) VALUES ("'.$privmsg_sent_id.'", "'.$uid.'", "'.str_replace("\'", "''", addslashes($msg)).'")'); mysql_query('UPDATE '.USERS_TABLE.' SET user_new_privmsg = user_new_privmsg + 1 WHERE user_id = '.$admin_id); $warning_message = 'Your message included words that are defined as spam on this website.'; $error_msg .= (!empty($error_msg)) ? '
'.$warning_message : $warning_message; } } }