Commit: def044bbda998a9dce27d4ddd75af445367a9039 Author: Derick Rethans <[email protected]> Tue, 28 May 2019 13:18:28 +0100 Parents: fd1338e3de54fd96b6cdaeb08508b4a5ba84f67a Branches: master
Link: http://git.php.net/?p=web/bugs.git;a=commitdiff;h=def044bbda998a9dce27d4ddd75af445367a9039 Log: stop spammy users Changed paths: M include/functions.php M www/bug.php Diff: diff --git a/include/functions.php b/include/functions.php index a4e3a0c..dfca900 100644 --- a/include/functions.php +++ b/include/functions.php @@ -244,6 +244,14 @@ function is_spam($string) return false; } +/* Primitive check for SPAMmy user. Add more later. */ +function is_spam_user($email) +{ + if (preg_match("/(rhsoft)/i", $email)) { + return true; + } + return false; +} /** * Obfuscates email addresses to hinder spammer's spiders diff --git a/www/bug.php b/www/bug.php index 76abf0c..c49f69f 100644 --- a/www/bug.php +++ b/www/bug.php @@ -227,10 +227,12 @@ if (isset($_POST['ncomment']) && !isset($_POST['preview']) && $edit == 3) { if (is_spam($ncomment)) { $errors[] = SPAM_REJECT_MESSAGE; } - if (is_spam($_POST['in']['commentemail'])) { $errors[] = "Please do not SPAM our bug system."; } + if (is_spam_user($_POST['in']['commentemail'])) { + $errors[] = "Please do not SPAM our bug system."; + } if (!$errors) { do { @@ -267,6 +269,9 @@ if (isset($_POST['ncomment']) && !isset($_POST['preview']) && $edit == 3) { } $from = $_POST['in']['commentemail']; + if (is_spam_user($from)) { + $errors[] = "Please do not SPAM our bug system."; + } } elseif (isset($_POST['in']) && !isset($_POST['preview']) && $edit == 2) { // Edits submitted by original reporter for old bugs @@ -324,6 +329,10 @@ if (isset($_POST['ncomment']) && !isset($_POST['preview']) && $edit == 3) { $from = $bug['email']; } + if (is_spam_user($from)) { + $errors[] = "Please do not SPAM our bug system."; + } + if (!$errors && !($errors = incoming_details_are_valid($_POST['in'], false))) { // Allow the reporter to change the bug type to 'Security', hence mark // the report as private @@ -382,6 +391,9 @@ if (isset($_POST['ncomment']) && !isset($_POST['preview']) && $edit == 3) { if (is_spam($ncomment)) { $errors[] = SPAM_REJECT_MESSAGE; } + if (is_spam_user($from)) { + $errors[] = "Please do not SPAM our bug system."; + } } elseif (isset($_POST['in']) && is_array($_POST['in']) && !isset($_POST['preview']) && $edit == 1) { // Edits submitted by developer -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
