From 2da18e8d0c1026143b85518f323c26cad55865f0 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 4 Jan 2003 23:38:58 +0000 Subject: [PATCH] - The statistics module would sometimes mistake a non-node ID with that of a node. Thanks David and Jeremy. --- modules/statistics.module | 7 ++++++- modules/statistics/statistics.module | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/statistics.module b/modules/statistics.module index ec27e9eaf04..af63874803d 100644 --- a/modules/statistics.module +++ b/modules/statistics.module @@ -23,7 +23,12 @@ function statistics_init() { $referrer = getenv("HTTP_REFERER"); $hostname = getenv("REMOTE_ADDR"); // log this page access - db_query("INSERT INTO accesslog (nid, url, hostname, uid, timestamp) values('%s', '%s', '%s', '%s', '%s')", $id, $referrer, $hostname, $user->uid, time()); + if (isset($id) && empty($mod)) { + db_query("INSERT INTO accesslog (nid, url, hostname, uid, timestamp) values('%s', '%s', '%s', '%s', '%s')", $id, $referrer, $hostname, $user->uid, time()); + } + else { + db_query("INSERT INTO accesslog (url, hostname, uid, timestamp) values('%s', '%s', '%s', '%s')", $referrer, $hostname, $user->uid, time()); + } } /* diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index ec27e9eaf04..af63874803d 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -23,7 +23,12 @@ function statistics_init() { $referrer = getenv("HTTP_REFERER"); $hostname = getenv("REMOTE_ADDR"); // log this page access - db_query("INSERT INTO accesslog (nid, url, hostname, uid, timestamp) values('%s', '%s', '%s', '%s', '%s')", $id, $referrer, $hostname, $user->uid, time()); + if (isset($id) && empty($mod)) { + db_query("INSERT INTO accesslog (nid, url, hostname, uid, timestamp) values('%s', '%s', '%s', '%s', '%s')", $id, $referrer, $hostname, $user->uid, time()); + } + else { + db_query("INSERT INTO accesslog (url, hostname, uid, timestamp) values('%s', '%s', '%s', '%s')", $referrer, $hostname, $user->uid, time()); + } } /*