diff --git a/Sources/Logging.php b/Sources/Logging.php index c5c20a0c79..713613cfb5 100644 --- a/Sources/Logging.php +++ b/Sources/Logging.php @@ -46,6 +46,10 @@ function writeLog($force = false) logSpider(); } + // Don't log guests anymore - helps during bot attacks. + if (!empty($modSettings['no_guest_logging']) && !empty($user_info['is_guest'])) + return; + // Don't mark them as online more than every so often. if (!empty($_SESSION['log_time']) && $_SESSION['log_time'] >= (time() - 8) && !$force) return; diff --git a/Sources/ManageSettings.php b/Sources/ManageSettings.php index 0016ab1850..4fd953ff43 100644 --- a/Sources/ManageSettings.php +++ b/Sources/ManageSettings.php @@ -219,7 +219,8 @@ function ModifyBasicSettings($return_config = false) array('check', 'hitStats'), '', - // Guest stats. + // Guest stats + array('check', 'no_guest_logging'), array('check', 'no_guest_views'), '', diff --git a/Themes/default/BoardIndex.template.php b/Themes/default/BoardIndex.template.php index 9cc7b30257..74fe030c66 100644 --- a/Themes/default/BoardIndex.template.php +++ b/Themes/default/BoardIndex.template.php @@ -493,7 +493,7 @@ function template_ic_block_online()

- ', $context['show_who'] ? '' : '', '', $txt['online'], ': ', comma_format($context['num_guests']), ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', comma_format($context['num_users_online']), ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users']; + ', $context['show_who'] ? '' : '', '', $txt['online'], ': ', empty($modSettings['no_guest_logging']) ? comma_format($context['num_guests']) . ' ' . ($context['num_guests'] == 1 ? $txt['guest'] : $txt['guests']) . ', ' : '', comma_format($context['num_users_online']), ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users']; // Handle hidden users and buddies. $bracketList = array(); diff --git a/Themes/default/languages/Help.english.php b/Themes/default/languages/Help.english.php index 386dfefcec..fdc37f3fb2 100644 --- a/Themes/default/languages/Help.english.php +++ b/Themes/default/languages/Help.english.php @@ -421,6 +421,7 @@ // argument(s): scripturl $helptxt['who_enabled'] = 'This setting allows you to turn on or off the Who\'s Online page, which shows who is browsing the forum and what they are doing.'; +$helptxt['no_guest_logging'] = 'This setting prevents guests from being included in the Users Online counts. Guest and bot activity can cause excessive IO, so this may help during a bot attack.'; $helptxt['no_guest_views'] = 'This setting disables incrementing views for guests as well as bots. Bot activity can cause excessive IO, and is often disguised as guest activity, so this may help during a bot attack.'; $helptxt['recycle_enable'] = '"Recycles" deleted topics and posts to the specified board.'; diff --git a/Themes/default/languages/ManageSettings.english.php b/Themes/default/languages/ManageSettings.english.php index 7d44d145d7..e2cb867dcd 100755 --- a/Themes/default/languages/ManageSettings.english.php +++ b/Themes/default/languages/ManageSettings.english.php @@ -103,6 +103,7 @@ $txt['timeLoadPageEnable'] = 'Display time taken to create every page'; $txt['disableHostnameLookup'] = 'Disable hostname lookups'; $txt['who_enabled'] = 'Enable who\'s online list'; +$txt['no_guest_logging'] = 'Do not include guests or bots in Users Online stats'; $txt['no_guest_views'] = 'Disable counting views for guests and bots'; $txt['meta_keywords'] = 'Meta keywords associated with forum'; $txt['meta_keywords_note'] = 'For search engines. Leave blank for default.';