From 4477efef71d8ac0109fbd4e0190b9b092a1cde7b Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 24 Jun 2001 11:39:28 +0000 Subject: - Added simple referer module, for sake of fun --- modules/statistics.module | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 modules/statistics.module (limited to 'modules/statistics.module') diff --git a/modules/statistics.module b/modules/statistics.module new file mode 100644 index 000000000..ba578e5b9 --- /dev/null +++ b/modules/statistics.module @@ -0,0 +1,45 @@ + ". variable_get("referer_clear", 604800)); +} + +function statistics_perm() { + return array("access statistics"); +} + +function statistics_conf_options() { + $period = array(3600 => format_interval(3600), 10800 => format_interval(10800), 21600 => format_interval(21600), 32400 => format_interval(32400), 43200 => format_interval(43200), 86400 => format_interval(86400), 172800 => format_interval(172800), 259200 => format_interval(259200), 604800 => format_interval(604800), 1209600 => format_interval(1209600), 2419200 => format_interval(2419200), 1000000000 => t("Never")); + $output .= form_select(t("Track referers"), "referer", variable_get("referer", 0), array("Disabled", "Enabled"), "If enabled, Drupal will count how many times your website is referred to by other websites."); + $output .= form_select(t("Discard referers older than"), "referer_clear", variable_get("referer_clear", 604800), $period, "The time referer entries should be kept. Older entries will be automatically discarded. Requires crontab."); return $output; +} + +function statistics_referer() { + $result = db_query("SELECT url, COUNT(url) AS count FROM referer GROUP BY url ORDER BY count"); + $output .= "\n"; + $output .= " \n"; + while ($referer = db_fetch_object($result)) { + if (!ereg("^http://", $referer->url)) { + $output .= ""; + } + } + $output .= "
URLnumber
url) ."\">". check_output($referer->url) ."". check_output($referer->count) ."
\n"; + + return $output; +} + +function statistics_admin() { + global $user; + + if (user_access($user, "access statistics")) { + print statistics_referer(); + } +} + +?> \ No newline at end of file -- cgit v1.2.3