function DetectAttacks($a_fields) { global $ATTACK_DETECTION_DUPS, $ATTACK_DETECTION_REVERSE_CAPTCHA; $s_info = $s_attack = ""; $b_attacked = false; $s_user_info = ""; if (ATTACK_DETECTION_MIME) { if (DetectMimeAttack($a_fields, $s_attack, $s_info, $s_user_info)) { $b_attacked = true; } } if (!$b_attacked && !empty($ATTACK_DETECTION_DUPS)) { if (DetectDupAttack($a_fields, $s_attack, $s_info, $s_user_info)) { $b_attacked = true; } } if (!$b_attacked && ATTACK_DETECTION_SPECIALS) { if (DetectSpecialsAttack($a_fields, $s_attack, $s_info, $s_user_info)) { $b_attacked = true; } } if (!$b_attacked && (ATTACK_DETECTION_MANY_URLS || ATTACK_DETECTION_MANY_URL_FIELDS)) { if (DetectManyURLsAttack($a_fields, $s_attack, $s_info, $s_user_info)) { $b_attacked = true; } } if (ATTACK_DETECTION_JUNK) { if (DetectJunkAttack($a_fields, $s_attack, $s_info, $s_user_info)) { $b_attacked = true; } } if (!$b_attacked && !empty($ATTACK_DETECTION_REVERSE_CAPTCHA)) { if (DetectRevCaptchaAttack($ATTACK_DETECTION_REVERSE_CAPTCHA, $a_fields, $s_attack, $s_info, $s_user_info)) { $b_attacked = true; } } if ($b_attacked) { if (ALERT_ON_ATTACK_DETECTION) { SendAlert(GetMessage(MSG_ATTACK_DETECTED, array("ATTACK" => $s_attack, "INFO" => $s_info)), false); } if (!IsAjax() && ATTACK_DETECTION_URL !== "") { Redirect(ATTACK_DETECTION_URL, GetMessage(MSG_FORM_ERROR)); } else { global $SERVER; CreatePage(GetMessage(MSG_ATTACK_PAGE, array("SERVER" => $SERVER, "USERINFO" => $s_user_info)), GetMessage(MSG_FORM_ERROR)); } exit; } }
function DetectAttacks($a_fields) { $s_info = $s_attack = ""; $b_attacked = false; $s_user_info = ""; if (Settings::get('ATTACK_DETECTION_MIME')) { if (DetectMimeAttack($a_fields, $s_attack, $s_info, $s_user_info)) { $b_attacked = true; } } if (!$b_attacked && !Settings::isEmpty('ATTACK_DETECTION_DUPS')) { if (DetectDupAttack($a_fields, $s_attack, $s_info, $s_user_info)) { $b_attacked = true; } } if (!$b_attacked && Settings::get('ATTACK_DETECTION_SPECIALS')) { if (DetectSpecialsAttack($a_fields, $s_attack, $s_info, $s_user_info)) { $b_attacked = true; } } if (!$b_attacked && (Settings::get('ATTACK_DETECTION_MANY_URLS') || Settings::get('ATTACK_DETECTION_MANY_URL_FIELDS'))) { if (DetectManyURLsAttack($a_fields, $s_attack, $s_info, $s_user_info)) { $b_attacked = true; } } if (Settings::get('ATTACK_DETECTION_JUNK')) { if (DetectJunkAttack($a_fields, $s_attack, $s_info, $s_user_info)) { $b_attacked = true; } } if (!$b_attacked && !Settings::isEmpty('ATTACK_DETECTION_REVERSE_CAPTCHA')) { if (DetectRevCaptchaAttack(Settings::get('ATTACK_DETECTION_REVERSE_CAPTCHA'), $a_fields, $s_attack, $s_info, $s_user_info)) { $b_attacked = true; } } if ($b_attacked) { if (function_exists('FMHookAttacked')) { FMHookAttacked(''); } /* in the future, pass the type of attack */ if (Settings::get('ALERT_ON_ATTACK_DETECTION')) { SendAlert(GetMessage(MSG_ATTACK_DETECTED, array("ATTACK" => $s_attack, "INFO" => $s_info)), false); } if (!IsAjax() && Settings::get('ATTACK_DETECTION_URL') !== "") { Redirect(Settings::get('ATTACK_DETECTION_URL'), GetMessage(MSG_FORM_ERROR)); } else { global $SERVER; CreatePage(GetMessage(MSG_ATTACK_PAGE, array("SERVER" => $SERVER, "USERINFO" => $s_user_info)), GetMessage(MSG_FORM_ERROR)); } exit; } }