operating system - OS detection in php not working accurately / bug in script? -


i used script os detecting php described enter link description here

the code looks this:

function getos() {  global $user_agent; $os_platform    =   "unknown os platform"; $os_array       =   array(                         '/windows nt 6.3/i'     =>  'windows 8.1',                         '/windows nt 6.2/i'     =>  'windows 8',                         '/windows nt 6.1/i'     =>  'windows 7',                         '/windows nt 6.0/i'     =>  'windows vista',                         '/windows nt 5.2/i'     =>  'windows server 2003/xp x64',                         '/windows nt 5.1/i'     =>  'windows xp',                         '/windows xp/i'         =>  'windows xp',                         '/windows nt 5.0/i'     =>  'windows 2000',                         '/windows nt 6.3/i'     =>  'windows 8.1',                         '/windows me/i'         =>  'windows me',                         '/win98/i'              =>  'windows 98',                         '/win95/i'              =>  'windows 95',                         '/win16/i'              =>  'windows 3.11',                         '/macintosh|mac os x/i' =>  'mac os x',                         '/mac_powerpc/i'        =>  'mac os 9',                         '/linux/i'              =>  'linux',                         '/ubuntu/i'             =>  'ubuntu',                         '/iphone/i'             =>  'iphone',                         '/ipod/i'               =>  'ipod',                         '/ipad/i'               =>  'ipad',                         '/android/i'            =>  'android',                         '/blackberry/i'         =>  'blackberry',                         '/webos/i'              =>  'mobile'                     );  foreach ($os_array $regex => $value) {       if (preg_match($regex, $user_agent)) {         $os_platform    =   $value;     } }    return $os_platform; } $user_os        =   getos(); 

i use $user_os send database.

however, returns "unknown os platform" regardless actual os. there error in script, or last part not work accurately? can me this?


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -