<?php
class CB_statistic {
var $noEntry = "false";
var $statTable, $statInfo, $statInfoID;
var $statInsertTime, $statUserID, $statUserHost,
$statUserIP, $statUserReferrer, $statUserAgent;
function CB_statistic() {
$this->statUserIP = $_SERVER['REMOTE_ADDR'];
$this->statUserHost = $_SERVER['REMOTE_HOST'];
$this->statUserReferer = $_SERVER['HTTP_REFERER'];
$this->statUserAgent = $_SERVER['HTTP_USER_AGENT'];
$this->statInsertTime = time();
$this->statUserID = md5($_SERVER['REMOTE_ADDR'] . date("Ymd H:i:s"));
}
function setStatInfo($type, $id) {
if(!empty($type)) {
$this->statInfo = $type;
$this->statInfoID = $id;
} else {
$this->noEntry = "true";
}
}
function reloadCheck() {
$check = mysql_query("SELECT * FROM ".TABLE."_sext_statistik WHERE userHost = '$this->statUserHost' AND userIP = '$this->statUserIP'");
while($checkRow = mysql_fetch_array($check)) {
if(($checkRow['statInfo'] == $this->statInfo) AND ($checkRow['statInfoID'] == $this->statInfoID)) {
$this->noEntry = "true";
}
}
}
function logInfo() {
if($this->noEntry == "false") {
$entry = mysql_query("INSERT INTO ".TABLE."_sext_statistik ( statID, datetime, statInfo, statInfoID, userIP, userHost, userAgent, userReferer) VALUES ( '$this->statUserID', NOW(), '$this->statInfo', '$this->statInfoID', '$this->statUserIP', '$this->statUserHost', '$this->statUserAgent', '$this->statUserReferer')");
if($entry) {$insert = "true";}
} else {
$insert = "false";
}
return $insert;
}
}
?>