This repository has been archived by the owner on Mar 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbroswerchk.php
55 lines (55 loc) · 1.71 KB
/
broswerchk.php
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
52
53
54
55
<?php
function broswerchkto($errurl) {
$broswerck = broswerchk();
if ($broswerck != "") {
// die("抱歉,您的浏览器( ".$broswerck." )不受支持。".$_SERVER["HTTP_USER_AGENT"]);
die('抱歉,您的浏览器( '.$broswerck.' )不受支持。<script language="javascript" type="text/javascript">window.location.href="'.$errurl.$broswerck.'";</script>');
}
}
function broswerchk() {
include_once("ua.php");
$ua = $_SERVER["HTTP_USER_AGENT"];
$broswer = get_broswer($ua);
$os = get_os($ua);
$broswerName = $broswer[0];
$broswerVersion = $broswer[1];
if ($broswerVersion == "") {
$broswerMainVersion = 0;
} else {
$broswerMainVersion = (int)explode(".",$broswerVersion)[0];
}
$isOK = false;
if ($broswerName == "火狐浏览器" && $broswerMainVersion >= 50) {
$isOK = true;
}
else if ($broswerName == "谷歌浏览器" && $broswerMainVersion >= 50) {
$isOK = true;
}
else if ($broswerName == "Safari" && $broswerMainVersion >= 500) {
$isOK = true;
}
else if ($broswerName == "欧朋浏览器" && $broswerMainVersion >= 11) {
$isOK = true;
}
else if ($broswerName == "其他 Gecko 内核浏览器" && $broswerMainVersion >= 50) {
$isOK = true;
}
else if ($broswerName == "其他 Webkit 内核浏览器" && $broswerMainVersion >= 50) {
$isOK = true;
}
else if ($broswerName == "Edge浏览器" || $broswerName == "雅诗浏览器") {
$isOK = true;
}
else if ($os == "Android" || $os == "iOS" || $os == "微信小程序" || $os == "Yashi") {
$isOK = true;
}
if ($broswerMainVersion == 0) {
$broswerMainVersion = "";
}
if ($isOK) {
return "";
} else {
return "#".$broswerName."#".$broswerMainVersion."#".$os;
}
}
?>