$ismobile=false;
$ua=$_SERVER['HTTP_USER_AGENT'];
if (stripos($ua, 'Apple-iP') || stripos($ua, 'mobi') || stripos($ua, 'Symbian')
|| stripos($ua, 'Windows CE') || stripos($ua, 'PPC') || stripos($ua, 'CLDC')
|| stripos($ua, 'Windows Phone')
|| stripos($ua, 'UP.Browser')
|| stripos($ua, 'portalmmm')
|| stripos($ua, 'Nintendo Wii')
|| stripos($ua, 'compatible; MSIE 6.0; Nitro')
|| stripos($ua, 'Linux armv')
|| stripos($ua, 'PalmSource')
|| stripos($ua, 'PalmOS')
|| stripos($ua, 'EPOC')
|| stripos($ua, 'Android')
|| stripos($ua, 'netfront')
|| stripos($ua, 'ucweb')
|| strpos($ua, 'SEC-')
|| stripos($ua, 'j2me')
|| stripos($ua, 'ReqwirelessWeb')
|| stripos($ua, 'Opera Mini')
|| stripos($ua, 'PlayStation')
|| stripos($ua, 'ProxiNet')
|| stripos($ua, 'Elaine')
) $ismobile=true;