You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.3 KiB

<?php
/*
*
* @copyright (c) 2009 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
function isSpammer($id){
$result = mysql_fetch_assoc(mysql_query('SELECT TIMESTAMPDIFF(Second,max(bann_until),now()) as anzahl from spammer WHERE userid='.$id.' group by userid'));
if($result['anzahl'] < 0){
return true;
} else{
return false;
}
}
function becomeSpammer($id,$nick,$text){
// Es gibt 2 indikatoren ein Spammer zu sein
// Man schreibt min 10 posts innerhalb von 20 Sekunden
$result1 = mysql_num_rows(mysql_query('SELECT * FROM ag_chat WHERE user=\''.$nick.'\' and TIMESTAMPDIFF(Second,zeit,now()) <= 20'));
// Man schreibt min 30 Posts innerhalb einer Minute
$result2 = mysql_num_rows(mysql_query('SELECT * FROM ag_chat WHERE user=\''.$nick.'\' and TIMESTAMPDIFF(Second,zeit,now()) <= 60'));
// Innerhalb einer halben Minute 4 mal den selben Post!!
$result3 = mysql_num_rows(mysql_query('SELECT * FROM ag_chat WHERE user=\''.$nick.'\' AND TIMESTAMPDIFF(Second,zeit,now()) <= 30 AND nachricht = \''.$text.'\''));
// Und nun noch ein paar Aergernisse
// $a = stripos($text, 'frei') !== FALSE || stripos($text, 'free') !== FALSE || stripos($text, 'offen') !== FALSE || stripos($text, 'open') !== FALSE;
// $b = stripos($text, 'kämpfe') !== FALSE || stripos($text, 'fights') !== FALSE || stripos($text, 'f.') !== FALSE;
// $c = stripos($text, 'spam') !== FALSE;
// if(($a && $b && count(preg_split('# #', $text)) <= 4 ) || ($c && count(preg_split('# #', $text)) <= 1)){
// setSpamblock($id);
// }
if($result1 >= 10 || $result2 >= 30 || $result3 >=4){
// Anzahl eintraege in spamliste
setSpamblock($id);
}
}
function setSpamblock($id){
$anzahl = mysql_num_rows(mysql_query('SELECT * FROM spammer WHERE userid='.$id.' AND TIMESTAMPDIFF(Day,bann_until,now()) <=14'));
$zeit = pow(5,($anzahl+1));
mysql_query('INSERT INTO spammer(userid, bann_until) values('.$id.',TIMESTAMPADD(Minute,'.$zeit.',now()))');
}
function releaseSpamblock($id){
mysql_query('DELETE from spammer where userid='.$id.' and TIMESTAMPDIFF(Second,bann_until,now()) < 0');
}
function bannAccount($id){
mysql_query('UPDATE user SET bann = \'ja\' WHERE id='.$id);
}
function unbannAccount($id){
mysql_query('UPDATE user SET bann = \'nein\' WHERE id='.$id);
}
?>