Posts: 36
Threads: 9
Joined: Nov 2010
Commentics has a anti-spam feature, Trap Value
From time to time, as an admin, I get email notification about Banned users due to Trap Value
But, the email does not inform me about the exact value of this Trap Value !! what is the value of this variable? knowing this, I will ensure that script is not misbehaving by banning good comment writers.
I mean, what this banned user had written?
Posts: 2,894
Threads: 59
Joined: Jun 2010
Ok, this is for Commentics v1.3.5
In comments/includes/app/processor.php, replace this:
PHP Code:
<?php
/* Check Trap */
if ($settings->check_trap) {
if (!isset($_POST['fax']) || !isset($_POST['phone'])) { //no trap data submitted
cmtx_ban(CMTX_BAN_REASON_NO_TRAP); //ban user for no trap data
} else { //if trap data submitted
if (!empty($_POST['fax']) || !empty($_POST['phone'])) { //trap data contains value
cmtx_ban(CMTX_BAN_REASON_TRAP_VALUE); //ban user for trap value
}
}
}
With:
PHP Code:
<?php
/* Check Trap */
if ($settings->check_trap) {
global $fax, $phone;
if (!isset($_POST['fax']) || !isset($_POST['phone'])) { //no trap data submitted
cmtx_ban(CMTX_BAN_REASON_NO_TRAP); //ban user for no trap data
} else { //if trap data submitted
if (!empty($_POST['fax']) || !empty($_POST['phone'])) { //trap data contains value
if (!empty($_POST['fax'])) { $fax = $_POST['fax']; }
if (!empty($_POST['phone'])) { $phone = $_POST['phone']; }
cmtx_ban(CMTX_BAN_REASON_TRAP_VALUE); //ban user for trap value
}
}
}
Then, in comments/includes/functions/processor.php, replace this:
PHP Code:
<?php
function cmtx_ban ($reason) { //ban user
global $mysql_table_prefix, $settings, $ip_address, $is_admin; //globalise variables
PHP Code:
<?php
function cmtx_ban ($reason) { //ban user
global $mysql_table_prefix, $settings, $ip_address, $is_admin, $fax, $phone; //globalise variables
if ($reason == CMTX_BAN_REASON_TRAP_VALUE && strlen($fax) < 100 && strlen($phone) < 100) {
$fax = cmtx_sanitize($fax, true, true, true);
$phone = cmtx_sanitize($phone, true, true, true);
$reason .= " Fax: \"" . $fax . "\" Phone: \"" . $phone . "\"";
}