diff --git a/server/cn/home/www/cdn/heartbeat/heartbeat.min.js b/server/cn/home/www/cdn/heartbeat/heartbeat.min.js deleted file mode 100644 index 05f9f22..0000000 --- a/server/cn/home/www/cdn/heartbeat/heartbeat.min.js +++ /dev/null @@ -1,47 +0,0 @@ - -var __isCookie = 0; - -(function heartbeat_get() -{ - cookie.set("fp",fp); - cookie.set("fp_",fp); - $.post("https://log.yimian.xyz/heartbeat_get.php",{"ip":ip,"fp":fp,"city":ipCity},function(msg){ - - var obj = eval('(' + msg + ')'); - var arr=Object.keys(obj); - var t = Date.parse(new Date())/1000; - - if(t > obj.t && t < obj.t + 30) __isCookie = 1; - - for(var i = 0; i < arr.length; i++){ - - cookie.set(arr[i], obj[arr[i]]); - } - }); -})(); - - -(function heartbeat_log() -{ - setTimeout(function(){ - setInterval(function(){ - - if(__isCookie){ - var aCookie = document.cookie.split("; "); - var obj = new Object(); - for(var i = 0; i < aCookie.length; i++){ - - var aCrumb = aCookie[i].split("="); - obj[aCrumb[0]] = aCrumb[1]; - } - - $.post("https://log.yimian.xyz/heartbeat.php",obj); - cookie.set('fp',fp); - } - },4000); - -},3000); - -})(); - - diff --git a/server/cn/home/www/cdn/heartbeat/heartbeat_footer.min.js b/server/cn/home/www/cdn/heartbeat/heartbeat_footer.min.js new file mode 100644 index 0000000..75aaaf1 --- /dev/null +++ b/server/cn/home/www/cdn/heartbeat/heartbeat_footer.min.js @@ -0,0 +1,19 @@ + +(function heartbeat_log() +{ + setTimeout(function(){ + setInterval(function(){ + + if(__isCookie){ + + $.post("https://log.yimian.xyz/heartbeat.php",{"fp":fp, "cookie":document.cookie}); + cookie.set('fp',fp); + } + },4000); + + $.post("https://log.yimian.xyz/heartbeat.php",{"ip":ip,"fp":fp,"city":ipCity}); +},3000); + +})(); + + diff --git a/server/cn/home/www/cdn/heartbeat/heartbeat_head.min.js b/server/cn/home/www/cdn/heartbeat/heartbeat_head.min.js new file mode 100644 index 0000000..fb3e52e --- /dev/null +++ b/server/cn/home/www/cdn/heartbeat/heartbeat_head.min.js @@ -0,0 +1,31 @@ + +var __isCookie = 0; + +(function heartbeat_get() +{ + cookie.set("fp",fp); + cookie.set("fp_",fp); + $.post("https://log.yimian.xyz/heartbeat_get.php",{"ip":ip,"fp":fp,"city":ipCity},function(msg){ + + var obj = eval('(' + msg + ')'); + var t = Date.parse(new Date())/1000; + + if(t > obj.t && t < obj.t + 30) __isCookie = 1; + + var aCookie = obj.cookie.split("; "); + var _obj = new Object(); + for(var i = 0; i < aCookie.length; i++){ + + var aCrumb = aCookie[i].split("="); + _obj[aCrumb[0]] = aCrumb[1]; + } + + var arr=Object.keys(_obj); + + for(var i = 0; i < arr.length; i++){ + + cookie.set(arr[i], _obj[arr[i]]); + } + }); +})(); + diff --git a/server/cn/home/www/cdn/heartbeat/kk.html b/server/cn/home/www/cdn/heartbeat/kk.html deleted file mode 100644 index 2f1a071..0000000 --- a/server/cn/home/www/cdn/heartbeat/kk.html +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/server/cn/home/www/functions.php b/server/cn/home/www/functions.php index 7e1fa63..1f1ea3f 100644 --- a/server/cn/home/www/functions.php +++ b/server/cn/home/www/functions.php @@ -94,6 +94,7 @@ echo " + "; @@ -118,7 +119,7 @@ function js__cleverLogin() function yimian__heartbeat() { echo " -"; +"; } diff --git a/server/cn/home/www/log/heartbeat.php b/server/cn/home/www/log/heartbeat.php index 4ae3340..1f16e1c 100644 --- a/server/cn/home/www/log/heartbeat.php +++ b/server/cn/home/www/log/heartbeat.php @@ -5,13 +5,18 @@ header("Access-Control-Allow-Origin: *"); $fp=$_REQUEST['fp']; $ip=$_REQUEST['ip']; +$cookie=$_REQUEST['cookie']; $city=$_REQUEST['city']; $from=$_SERVER['HTTP_REFERER']; $domain=$_SERVER['HTTP_HOST']; $conn=db__connect(); -db__delData($conn,"fp_cookie","fp",$fp); +if(isset($_REQUEST['cookie'])){ + db__delData($conn,"fp_cookie","fp",$fp); + db__pushData($conn,"fp_cookie",array("fp" => $fp, "cookie" => $cookie)); +}else{ + session_start(); @@ -37,7 +42,8 @@ if(!isset($_SESSION['s_usrTel'])) db__pushData($conn,"fp",array("fp"=>$fp,"ip"=>$ip)); } -db__pushData($conn,"log",array("city"=>$city,"fp"=>$fp,"ip"=>$ip,"domain"=>$domain,"url"=>$from,"time"=>time())); + db__pushData($conn,"log",array("city"=>$city,"fp"=>$fp,"ip"=>$ip,"domain"=>$domain,"url"=>$from,"time"=>time())); //echo json_encode(array("fp"=>$fp,"ip"=>$ip,"domain"=>$domain,"url"=>$from,"time"=>time())); -echo json_encode(array("usr"=>$_SESSION['s_usr'],"tel"=>$_SESSION['s_tel'],"fp"=>$_SESSION['s_fp'],"ip"=>$_SESSION['s_ip'])); + echo json_encode(array("usr"=>$_SESSION['s_usr'],"tel"=>$_SESSION['s_tel'],"fp"=>$_SESSION['s_fp'],"ip"=>$_SESSION['s_ip'])); +} \ No newline at end of file diff --git a/server/cn/home/www/log/heartbeat_get.php b/server/cn/home/www/log/heartbeat_get.php index 67c582f..1774317 100644 --- a/server/cn/home/www/log/heartbeat_get.php +++ b/server/cn/home/www/log/heartbeat_get.php @@ -5,4 +5,10 @@ header("Access-Control-Allow-Origin: *"); $fp=$_REQUEST['fp']; -echo json_encode(array("t1"=>"11","t2"=>"ee","t"=>time())); \ No newline at end of file +$res = db__getData(db__connect(),"fp_cookie","fp",$fp); + +$arr = array(); + +$cookie = $res[0]['cookie']; + +echo json_encode(array("cookie" => $cookie, "t" => time())); \ No newline at end of file