<?
/*
 
 本软件版权归作者所有,在投入使用之前注意获取许可
 作者：程威（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')" );
		}
	}

?>