-
Notifications
You must be signed in to change notification settings - Fork 0
/
detect_browser.php
executable file
·114 lines (107 loc) · 2.33 KB
/
detect_browser.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
function is_mobile_browser(){
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$http_accept = $_SERVER['HTTP_ACCEPT'];
if(stristr($user_agent, 'windows') && !stristr($user_agent, 'windows ce'))
return false;
if(eregi('windows ce|iemobile|mobile|symbian|mini|wap|pda|psp|up.browser|up.link|mmp|midp|phone|pocket', $user_agent))
return true;
if(stristr($http_accept, 'text/vnd.wap.wml') || stristr($http_accept, 'application/vnd.wap.xhtml+xml'))
return true;
if(!empty($_SERVER['HTTP_X_WAP_PROFILE']) || !empty($_SERVER['HTTP_PROFILE']) || !empty($_SERVER['X-OperaMini-Features']) || !empty($_SERVER['UA-pixels']))
return true;
$agents = array(
'acs-'=>'acs-',
'alav'=>'alav',
'alca'=>'alca',
'amoi'=>'amoi',
'audi'=>'audi',
'aste'=>'aste',
'avan'=>'avan',
'benq'=>'benq',
'bird'=>'bird',
'blac'=>'blac',
'blaz'=>'blaz',
'brew'=>'brew',
'cell'=>'cell',
'cldc'=>'cldc',
'cmd-'=>'cmd-',
'dang'=>'dang',
'doco'=>'doco',
'eric'=>'eric',
'hipt'=>'hipt',
'inno'=>'inno',
'ipaq'=>'ipaq',
'java'=>'java',
'jigs'=>'jigs',
'kddi'=>'kddi',
'keji'=>'keji',
'leno'=>'leno',
'lg-c'=>'lg-c',
'lg-d'=>'lg-d',
'lg-g'=>'lg-g',
'lge-'=>'lge-',
'maui'=>'maui',
'maxo'=>'maxo',
'midp'=>'midp',
'mits'=>'mits',
'mmef'=>'mmef',
'mobi'=>'mobi',
'mot-'=>'mot-',
'moto'=>'moto',
'mwbp'=>'mwbp',
'nec-'=>'nec-',
'newt'=>'newt',
'noki'=>'noki',
'opwv'=>'opwv',
'palm'=>'palm',
'pana'=>'pana',
'pant'=>'pant',
'pdxg'=>'pdxg',
'phil'=>'phil',
'play'=>'play',
'pluc'=>'pluc',
'port'=>'port',
'prox'=>'prox',
'qtek'=>'qtek',
'qwap'=>'qwap',
'sage'=>'sage',
'sams'=>'sams',
'sany'=>'sany',
'sch-'=>'sch-',
'sec-'=>'sec-',
'send'=>'send',
'seri'=>'seri',
'sgh-'=>'sgh-',
'shar'=>'shar',
'sie-'=>'sie-',
'siem'=>'siem',
'smal'=>'smal',
'smar'=>'smar',
'sony'=>'sony',
'sph-'=>'sph-',
'symb'=>'symb',
't-mo'=>'t-mo',
'teli'=>'teli',
'tim-'=>'tim-',
'tosh'=>'tosh',
'treo'=>'treo',
'tsm-'=>'tsm-',
'upg1'=>'upg1',
'upsi'=>'upsi',
'vk-v'=>'vk-v',
'voda'=>'voda',
'wap-'=>'wap-',
'wapa'=>'wapa',
'wapi'=>'wapi',
'wapp'=>'wapp',
'wapr'=>'wapr',
'webc'=>'webc',
'winw'=>'winw',
'winw'=>'winw',
'xda-'=>'xda-'
);
if(!empty($agents[substr($_SERVER['HTTP_USER_AGENT'], 0, 4)]))
return true;
}
?>