-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathid_nave.php
25 lines (24 loc) · 1.04 KB
/
id_nave.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
<?
$useragent = $_SERVER['HTTP_USER_AGENT'];
if (preg_match('|MSIE ([0-9].[0-9]{1,2})|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = '<meta http-equiv="content-type" content="text/html; charset="iso-8859-1">';
} elseif (preg_match( '|Opera/([0-9].[0-9]{1,2})|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = '<meta http-equiv="content-type" content="text/html; charset="utf-8">';
} elseif(preg_match('|Firefox/([0-9\.]+)|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = '<meta http-equiv="content-type" content="text/html; charset="iso-8859-1">';
} elseif(preg_match('|Chrome/([0-9\.]+)|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = '<meta http-equiv="content-type" content="text/html; charset="utf-8">';
} elseif(preg_match('|Safari/([0-9\.]+)|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = 'Safari';
} else {
// browser not recognized!
$browser_version = 0;
$browser= 'other';
}
return $browser;
?>