Location: PHPKode > projects > Inspirado > plugins/statistics/regstat.php
<?php

if (!function_exists("doNothing"))
	die("Hacking attempt!");

function plugin_statistics_insertVisit() {
	
	$ipaddress = $_SERVER["REMOTE_ADDR"];
	$visitdate = date("Y-m-d H:i:s");
	$referrer = $_SERVER["HTTP_REFERER"];
	$osagent = "a".$_SERVER["HTTP_USER_AGENT"];
	
	if (strpos($osagent,"Linux")) {
		$os = "Linux";
	} else if (strpos($osagent,"Win")) {
		$os = "Windows";
	} else if (strpos($osagent,"Mac")) {
		$os = "Macintosh";
	}
	
	if (strpos($osagent,"Opera")) {
		$nav = "Opera";
	} else if (strpos($osagent,"Firefox")) {
		$nav = "Firefox";
	} else if (strpos($osagent,"Safari")) {
		$nav = "Safari";
	} else if (strpos($osagent,"MSIE")) {
		$nav = "IExplorer";
	} else if (strpos($osagent,"Flock")) {
		$nav = "Flock";
	} else if (strpos($osagent,"Firebird")) {
		$nav = "Firebird";
	} else if (strpos($osagent,"Phoenix")) {
		$nav = "Phoenix";
	} else if (strpos($osagent,"Camino")) {
		$nav = "Camino";
	} else if (strpos($osagent,"Netscape")) {
		$nav = "Netscape";
	} else if (strpos($osagent,"Chimera")) {
		$nav = "Chimera";
	} else if (strpos($osagent,"Konqueror")) {
		$nav = "Konqueror";
	} else if (strpos($osagent,"Lynx")) {
		$nav = "Lynx";
	} else if (strpos($osagent,"Links")) {
		$nav = "Links";
	} else if (strpos($osagent,"OmniWeb")) {
		$nav = "OmniWeb";
	} else {
		$nav = "Unknown";
	}
	
	dbQuery("INSERT INTO ".DBPREFIX."plugin_statistics (ipaddress,referrer,navigator,operatingsystem,visitdate) VALUES ('".$ipaddress."','".(dbSecVars($referrer,0,1,0,1))."','".$nav."','".$os."','".$visitdate."')");
	
}

$state = dbQuery("SELECT state FROM ".DBPREFIX."plugins WHERE name='statistics'");
$state = mysql_fetch_array($state,MYSQL_ASSOC);
$state = $state["state"];

if ($state==1) {
	plugin_statistics_insertVisit();
}

?>
Return current item: Inspirado