get_browser()
weitere Crawler filtern. Das würde aber jetzt zu weit führen.Diese Änderung in der
common.php
ist auch erforderlich. viewtopic.php?p=1414816#p1414816
Code: Alles auswählen
public function add_page_header_links($event)
{
if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) || !isset($_SERVER['HTTP_USER_AGENT']))
return(false);
if (!empty($this->config['allow_visits_counter']))
{
$this->user->add_lang_ext('dmzx/counter', 'common');
$sql = 'SELECT COUNT(uvc_ip) AS visits_counter
FROM ' . $this->visits_counter_table . '
WHERE ' . $this->db->sql_in_set('uvc_ip', $this->user->ip);
$result = $this->db->sql_query($sql);
$visits_counter = (int) $this->db->sql_fetchfield('visits_counter');
$this->db->sql_freeresult($result);
if ($visits_counter == 0)
{
$sql_ary = [
'uvc_ip' => $this->user->ip,
'uvc_timestamp' => time()
];
$sql = 'INSERT INTO ' . $this->visits_counter_table . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
$this->db->sql_query($sql);
$this->config->increment('visits_counter', 1, true);
}
else
{
$timestamp = time() - $this->config['visits_counter_gc'];
$sql_ary = [$timestamp];
$sql = 'DELETE FROM ' . $this->visits_counter_table . '
WHERE uvc_timestamp < ' . (int) $timestamp;
$this->db->sql_query($sql);
}
$sql = 'SELECT COUNT(uvc_ip) AS counter
FROM ' . $this->visits_counter_table;
$result = $this->db->sql_query($sql, 60);
$counter = (int) $this->db->sql_fetchfield('counter');
$this->db->sql_freeresult($result);
$this->template->assign_vars([
'UNIQUE_VISITS_COUNTER' => $this->user->lang('UNIQUE_VISITS_COUNTER', $counter, $this->config['visits_counter']),
'UNIQUE_VISITS_COUNTER_HOUR' => $this->user->lang('UNIQUE_VISITS_COUNTER_HOUR', $this->config['visits_counter_gc'] / 3600, $this->config['visits_counter']),
]);
}
}