From 22761a80803463782e202c2371494ab20c725a92 Mon Sep 17 00:00:00 2001 From: Christian Fowler Date: Tue, 8 Sep 2009 22:14:50 +0000 Subject: URL might have been malformed so check for proper scheme --- Statistics.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Statistics.php b/Statistics.php index 79d7f12..c3dc49c 100644 --- a/Statistics.php +++ b/Statistics.php @@ -1,8 +1,8 @@ getUTCTime(); + if( !empty( $parsed['scheme'] ) ) { + $now = $gBitSystem->getUTCTime(); - $store = $parsed['scheme'].'://'.$parsed['host']; + $store = $parsed['scheme'].'://'.$parsed['host']; - $query = "UPDATE `".BIT_DB_PREFIX."stats_referers` SET `hits`=`hits`+1,`last`=? WHERE `referer`=?"; - $this->mDb->query( $query, array( $now, $store )); + $query = "UPDATE `".BIT_DB_PREFIX."stats_referers` SET `hits`=`hits`+1,`last`=? WHERE `referer`=?"; + $this->mDb->query( $query, array( $now, $store )); - // if the above didn't affect the db, we know that the entry doesn't exist yet. - if( !$this->mDb->mDb->Affected_Rows() ) { - $query = "INSERT INTO `".BIT_DB_PREFIX."stats_referers`( `last`, `referer`, `hits` ) VALUES( ?, ?, ? )"; - $this->mDb->query( $query, array( $now, $store, 1 )); + // if the above didn't affect the db, we know that the entry doesn't exist yet. + if( !$this->mDb->mDb->Affected_Rows() ) { + $query = "INSERT INTO `".BIT_DB_PREFIX."stats_referers`( `last`, `referer`, `hits` ) VALUES( ?, ?, ? )"; + $this->mDb->query( $query, array( $now, $store, 1 )); + } } } } -- cgit v1.3