<?php
/*============================================================================================
This class is developed by Md. Mahabubur Rahman
For more information contact with me [hide@address.com]
THANKS ALL FOR USING THIS CLASS
==============================================================================================*/
include('database.php');
include('userall.php');
class NTracker {
var $id; // Var that Keeps webid
var $trafficdomain = "domainname.com";
function NTracker(){
$this->id = $_GET['id'];
$status = $this->GetTrack();
if($status)
$this->GetAllInfo();
}
function GetTrack(){
$orgdomain=$this->GetDomain($_SERVER[ "HTTP_REFERER" ]);
if($orgdomain=='') exit;
if(eregi($orgdomain,$this->trafficdomain)){
$this->PrintJavaScript();
//return true;
} else exit;
}
function GetAllInfo(){
global $MySql;
global $userall;
/* Get User Information */
$UserAgent = $_SERVER['HTTP_USER_AGENT'];
$UserIp = $_SERVER['REMOTE_ADDR'];
/* Operatings System */
$Operating_System = $userall->operating_system_detection($UserAgent);
$Operating_System = $userall->kill_special_chars($Operating_System);
$Operating_System = $userall->kill_special_chars_track($Operating_System);
/* Browser */
$Browser = $userall->browser_detection($UserAgent);
$Browser = $userall->kill_special_chars($Browser);
$Browser = $userall->kill_special_chars_track($Browser);
// Insert The Visitors & Get Visitors id
// 0 for not javascript supported
$VisitorID = $MySql->InsertVisitor($this->id,"0");
if($VisitorID!=''){
// insert visitors country
$MySql->InsertCountry($VisitorID,$UserIp,$this->id);
// Insert Additional Details
$MySql->InsertAdditionalDetail($VisitorID,$this->id,$Operating_System,$Browser);
}
}
/* parse url */
function GetDomain($url){
if(filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED) === FALSE){
return false;
}
$parts = parse_url($url);
$domain = trim(str_replace("www.","",$parts['host']));
return $domain;
}
}
$NTracker = new NTracker();
?>