<?php
require_once('inc/conn.php');
require_once('inc/ls_pubfunc.php'); //前后台公共函数、类
$opendb=new mydb();

date_default_timezone_set('Asia/Shanghai');//设置时区为中国时间

$gifo = new get_gust_info();
$ip_home = '';
$ipadds = $gifo->Getaddress();
if(is_array($ipadds)){
	foreach($ipadds[0] as $value){
	 $ip_home .= " ".iconv("utf-8","utf-8",$value);    
	}
}
if($ip_home == NULL)
	 $ip_home = "本地";

$insert_sql=sprintf("insert into ls_statistics(date,ip,explorer,home,system) values (%s,%s,%s,%s,%s)",
			GetSQLValueString(date("Y-m-d H:i:s"),"text"),
			GetSQLValueString($gifo->Getip(),"text"),
			GetSQLValueString($gifo->GetBrowser()." - ".$gifo->GetLang(),"text"),
			GetSQLValueString($ip_home,"text"),
			GetSQLValueString($gifo->GetOs(),"text")
			);

if ($opendb->query($insert_sql)){
	echo "success";
}else{
	echo "fail";
}

?>