<?
/*
 
 本軟件版權歸作者所有,在投入使用之前注意獲取許可
 作者：程威（wiwiboy）
 項目：PHPStat流量統計 1.0
 電話：13553166317
 郵箱：wiwiboy@126.com
 QQ號：158839753
 網址：http://www.phpstat.net
 phpstat.net保留全部權力，受相關法律和國際		  		
		公約保護，請勿非法修改、轉載、散播，或用於其他贏利行為，		
		並請勿刪除版權聲明。
*/
/*	
	verson:v1.0 20060618
	author:wiwiboy
	last update:2006/06/10
*/


	
	$lang   = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
	$bot    = $_SERVER['HTTP_USER_AGENT'];	
	$cookie = $_SERVER['HTTP_COOKIE'];	

		//網絡蜘蛛
		function GetNapsBot($bot1)
		{
			$useragent = strtolower($bot1);
							
			if (strstr($useragent, 'googlebot')){
					$bot = 'Googlebot';
			}
			
			else if (strstr($useragent, 'msnbot')){
					$bot = 'MSNbot';
			}
			
			else if (strstr($useragent, 'slurp')){
					$bot = 'Yahoobot';
			}
			
			else if (strstr($useragent, 'baiduspider')){
					$bot = 'Baiduspider';
			}
			
			else if (strstr($useragent, 'sohu-search')){
					$bot = 'Sohubot';
			}
			
			else if (strstr($useragent, 'lycos')){
					$bot = 'Lycos';
			}
			
			else if (strstr($useragent, 'robozilla')){
					$bot = 'Robozilla';
			}
			else if (strstr($useragent, 'sphider')){
					$bot = 'Sphider';
			}
			else
				$bot = '0';
			return $bot;
		}

	$bot = GetNapsBot($bot);
	$time = mktime(0,0,0,date('m'),date('d'),date('Y'));
	if (empty($cookie)) 
	{
		if (empty($lang))
		{
			$Conn->Execute( " insert into $TableList[bot](website,bot,times) values ('$website','$bot','$time')" );
		}
	}

?>