Skip to content

Instantly share code, notes, and snippets.

@0xjams
Created June 8, 2015 18:28
Show Gist options
  • Save 0xjams/f58606a4c6e6b17693f7 to your computer and use it in GitHub Desktop.
Save 0xjams/f58606a4c6e6b17693f7 to your computer and use it in GitHub Desktop.
Validate if the user agent belongs to a desktop client
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