Created
June 8, 2015 18:28
-
-
Save 0xjams/f58606a4c6e6b17693f7 to your computer and use it in GitHub Desktop.
Validate if the user agent belongs to a desktop client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isDesktopBrowser(){ | |
if((strpos(strtolower($_SERVER["HTTP_USER_AGENT"]),"windows")!==false && strpos(strtolower($_SERVER["HTTP_USER_AGENT"]),"windows phone")===false) or (strpos(strtolower($_SERVER["HTTP_USER_AGENT"]),"linux")!==false && strpos(strtolower($_SERVER["HTTP_USER_AGENT"]),"android")===false) or strpos(strtolower($_SERVER["HTTP_USER_AGENT"]),"macintosh")!==false) | |
{ | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment