-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowser.php
30 lines (24 loc) · 990 Bytes
/
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
<?php
class browser {
function is_mobile() {
$iPod = stripos($_SERVER['HTTP_USER_AGENT'], "iPod");
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'], "iPhone");
$iPad = stripos($_SERVER['HTTP_USER_AGENT'], "iPad");
$Android = stripos($_SERVER['HTTP_USER_AGENT'], "Android");
$webOS = stripos($_SERVER['HTTP_USER_AGENT'], "webOS");
if ($iPod || $iPhone || $iPad || $Android || $webOS) {
return true;
}else {
return false;
}
}
/**
* http://ageekandhisblog.com/use-php-to-detect-internet-explorer-11-and-below/
* It’s simple and it works well. The first part targets IE10 and below,
* while the second targets the newer IE11 user agent. Modify as needed.
*/
function is_ie() {
return (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) || (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false)) ? true : false;
}
}
?>