$pattern )
{
//store the result in array
$ipInfo[$key] = preg_match( $pattern, $response, $value ) && !empty( $value[1] ) ? $value[1] : '*';
}
$koor = $ipInfo["latitude"]. ",".$ipInfo["longitude"];
$ipdata = $ipInfo["town"]. ", ".$ipInfo["state"].", ".$ipInfo["country"];
return $ipdata."||".$koor;
}
if (empty($_GET['impression'])) {
if ($_GET['url']) {
//$location = geoCheckIP($_SERVER['REMOTE_ADDR']);
$loc = explode("||",$location);
$sql = "INSERT INTO access_log (postdate,referer_url,target_url,user_agent,ipaddress,location,param1) VALUES (NOW(),'".$_SERVER['HTTP_REFERER']."','".$_GET['url']."','".$_SERVER['HTTP_USER_AGENT']."','".$_SERVER['REMOTE_ADDR']."','".$loc[0]."','".$loc[1]."') ";
mysql_query($sql);
header("Location:".$_GET['url']);
}
} else {
if ($_GET['dat']) {
$rs = explode("|",$_GET['dat']);
$url = $rs[0];
$referer = $rs[1];
$user_agent = $rs[2];
$ip = $rs[3];
//echo $_GET['dat'];
//$location = geoCheckIP($ip);
$loc = explode("||",$location);
$sql = "INSERT INTO impression_log (postdate,referer_url,target_url,user_agent,ipaddress,location,param1) VALUES (NOW(),'".$referer."','".$url."','".$user_agent."','".$ip."','".$loc[0]."','".$loc[1]."') ";
echo $sql;
mysql_query($sql);
}
}
?>