From 345680903afd4e21d77e78adff60d7a859ced4db Mon Sep 17 00:00:00 2001 From: IoTgod Date: Sun, 10 Mar 2019 22:37:31 +0800 Subject: [PATCH] add db__delData --- .../home/www/cdn/heartbeat/heartbeat.min.js | 47 +++++++++++++++++++ server/cn/home/www/cdn/heartbeat/kk.html | 6 +++ server/cn/home/www/functions.php | 11 +++++ server/cn/home/www/log/heartbeat.php | 3 +- server/cn/home/www/log/heartbeat_get.php | 8 ++++ 5 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 server/cn/home/www/cdn/heartbeat/heartbeat.min.js create mode 100644 server/cn/home/www/cdn/heartbeat/kk.html create mode 100644 server/cn/home/www/log/heartbeat_get.php diff --git a/server/cn/home/www/cdn/heartbeat/heartbeat.min.js b/server/cn/home/www/cdn/heartbeat/heartbeat.min.js new file mode 100644 index 0000000..05f9f22 --- /dev/null +++ b/server/cn/home/www/cdn/heartbeat/heartbeat.min.js @@ -0,0 +1,47 @@ + +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/kk.html b/server/cn/home/www/cdn/heartbeat/kk.html new file mode 100644 index 0000000..2f1a071 --- /dev/null +++ b/server/cn/home/www/cdn/heartbeat/kk.html @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/server/cn/home/www/functions.php b/server/cn/home/www/functions.php index b0a10b5..7e1fa63 100644 --- a/server/cn/home/www/functions.php +++ b/server/cn/home/www/functions.php @@ -315,6 +315,17 @@ function db__pushData($conn,$table,$content,$index="",$is_force=1) db__insertData($conn,$table,$content); } + +function db__delData($conn, $table, $clmnName, $value) +{ + $value=db__antisql($value); + $clmnName=db__antisql($clmnName); + + $sql = "DELETE FROM $table WHERE $clmnName = '$value'"; + $conn->query($sql); +} + + //anti sql function db__antisql($str) { diff --git a/server/cn/home/www/log/heartbeat.php b/server/cn/home/www/log/heartbeat.php index 798cd2e..4ae3340 100644 --- a/server/cn/home/www/log/heartbeat.php +++ b/server/cn/home/www/log/heartbeat.php @@ -11,11 +11,12 @@ $domain=$_SERVER['HTTP_HOST']; $conn=db__connect(); +db__delData($conn,"fp_cookie","fp",$fp); + session_start(); $_SESSION['s_fp']=$fp; $_SESSION['s_ip']=$ip; -setcookie("fp", $fp, time()+3600*24*365*15); if(!isset($_SESSION['s_usrTel'])) { diff --git a/server/cn/home/www/log/heartbeat_get.php b/server/cn/home/www/log/heartbeat_get.php new file mode 100644 index 0000000..67c582f --- /dev/null +++ b/server/cn/home/www/log/heartbeat_get.php @@ -0,0 +1,8 @@ +"11","t2"=>"ee","t"=>time())); \ No newline at end of file