}
// Inserts given array, if IP/check_get combination was not found
-function crackerTrackerInsertArray ($table, $rowData) {
+function crackerTrackerInsertArray ($table, array $rowData) {
// Is there a link up?
if (!isCrackerTrackerDatabaseLinkUp()) {
// Abort silently here
}
// Updates a given entry by just counting it up
-function updateCrackerTrackerEntry (array $rowData) {
+function updateCrackerTrackerEntry (array $rowData, $countColumn = 'count') {
// Construct the SELECT query
- $sqlString = 'UPDATE `ctracker_data` SET `count`=`count`+1 WHERE (`remote_addr`="' . crackerTrackerEscapeString($rowData['remote_addr']) . '" OR `proxy_addr`="' . crackerTrackerEscapeString($rowData['proxy_addr']) . '") AND `` = "' . crackerTrackerEscapeString($rowData['']) . '" LIMIT 1';
+ $sqlString = 'UPDATE `ctracker_data` SET `' . $countColumn . '`=`' . $countColumn . '`+1 WHERE (`remote_addr`="' . crackerTrackerEscapeString($rowData['remote_addr']) . '" OR `proxy_addr`="' . crackerTrackerEscapeString($rowData['proxy_addr']) . '") LIMIT 1';
// Run the SQL and check if we have one line
runCrackerTrackerSql($sqlString, __FUNCTION__, __LINE__);
crackerTrackerInsertArray('ctracker_data', $rowData);
}
+function ctrackerIncreaseAntiSpambotCount () {
+ // Init row data
+ $rowData = [
+ 'remote_addr' => determineCrackerTrackerRealRemoteAddress(),
+ 'proxy_addr' => getenv('REMOTE_ADDR'),
+ ];
+
+ // Update count
+ updateCrackerTrackerEntry($rowData, 'spam_bot_dectections');
+}
+
// Alerts the current user about malicious/suspicious traffic
function crackerTrackerAlertCurrentUser () {
// Is there some data?
if (isset($GLOBALS['ctracker_last_suspicious_entry'])) {
// Does the user have a ticket?
if (ifCtrackerTrackerAntiSpamFieldGiven()) {
- // Spam-bot filled out anti-spam field
+ // Spam-bot filled out anti-spam field, register count
+ ctrackerIncreaseAntiSpambotCount();
+
+ // Output message to spammer
ctrackerTrackerLoadTemplate('bot_captured');
} elseif (ifCrackerTrackerIpHasTicket()) {
// Load "Thank you" template
FROM `ctracker_data`
GROUP BY `request_method`'
],
+
+ // Anti-spambot field
+ [
+ "ALTER TABLE `ctracker_data` CHANGE `proxy_addr` `proxy_addr` varchar(15) COLLATE 'latin1_swedish_ci' NULL COMMENT 'Detected proxy address' AFTER `count`",
+ "ALTER TABLE `ctracker_data` ADD `spam_bot_dectections` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'Spam-bot attempts'",
+ ],
];
}