ua = strtolower($_SERVER['HTTP_USER_AGENT']); $this->ua_raw = $_SERVER['HTTP_USER_AGENT']; if(ereg('macintosh|mac_powerpc',$this->ua) == 1){ //Macintosh $this->career = 'macintosh'; if(ereg('safari',$this->ua) == 1){ $this->deviceid = 'safari'; }else if(ereg('firefox',$this->ua) == 1){ $this->deviceid = 'firefox'; }else if(ereg('opera',$this->ua) == 1){ $this->deviceid = 'opera'; }else if(ereg('camino',$this->ua) == 1){ $this->deviceid = 'camino'; }else if(ereg('netscape/7',$this->ua) == 1){ $this->deviceid = 'nn7'; }else if(ereg('msie',$this->ua) == 1){ $this->deviceid = 'ie'; }else{ $this->deviceid = 'etc'; } $this->flash = NULL; }else if(ereg('windows',$this->ua) == 1){ //Windows $this->career = 'windows'; if(ereg('firefox',$this->ua) == 1){ $this->deviceid = 'firefox'; }else if(ereg('opera',$this->ua) == 1){ $this->deviceid = 'opera'; }else if(ereg('netscape/7',$this->ua) == 1){ $this->deviceid = 'nn7'; }else if(ereg('msie',$this->ua) == 1){ $this->deviceid = 'ie'; }else{ $this->deviceid = 'etc'; } $this->flash = NULL; }else if(ereg('docomo',$this->ua) == 1){ //DoCoMo $this->career = 'docomo'; if(ereg('docomo/1.0',$this->ua) == 1){ $ualine = ereg_replace('DoCoMo/1.0/','',$this->ua_raw); $uaarr = split('/',$ualine); $this->deviceid = $uaarr[0]; }else if(ereg('docomo/2.0',$this->ua) == 1){ $ualine = ereg_replace('DoCoMo/2.0 ','',$this->ua_raw); $this->deviceid = ereg_replace('[(]+[a-zA-Z0-9\;]+[)]','',$ualine); } }else if(ereg('up.browser',$this->ua) == 1 && ereg('j-phone|vodafone|softbank',$this->ua) == false){ //AU //}else if(ereg('up.browser',$this->ua) == 1){ //AU $this->career = 'au'; if(ereg('kddi',$this->ua) == 1){ $uaarr = split(' ',$this->ua_raw); $this->deviceid = ereg_replace('KDDI-','',$uaarr[0]); }else{ $ualine = ereg_replace('UP.Browser/[a-zA-Z0-9]+[\.]+[a-zA-Z0-9]+[-]','',$this->ua_raw); $uaarr = split(' ',$ualine); $this->deviceid = $uaarr[0]; } }else if(ereg('j-phone|vodafone|softbank',$this->ua) == 1){ //J-PHONE $this->career = 'softbank'; $uaarr = split('/',$this->ua_raw); $this->deviceid = $uaarr[2]; }else if(ereg('mot',$this->ua) == 1){ //J-PHONE $this->career = 'softbank'; if(ereg('mot-v980',$this->ua)){ $this->deviceid = 'V702MO'; }else if(ereg('mot-c980',$this->ua)){ $this->deviceid = 'V702sMO'; } }else{ $this->career = 'etc'; $this->deviceid = 'etc'; } //デバイスIDから情報を取得 /* $di = $this->select('useragent'," WHERE `deviceid`='" . $this->deviceid . "'"); if($di){ $deviceinfo = $di[0]; $this->flash = $deviceinfo['flash']; $this->browser = $deviceinfo['browser']; } */ //mobile if(ereg('docomo|au|softbank',$this->career)){ $this->platform = 'mobile'; }else{ $this->platform = 'PC'; } /* if($this->deviceid){ if(!$this->select('useragent',' WHERE `deviceid`="' . $this->deviceid . '"')){ $insert = array(); $insert['deviceid'] = $this->deviceid; $insert['career'] = $this->career; $insert['platform'] = $this->platform; $insert['date'] = date('Y-m-d H:i:s'); $insert['added'] = 1; $meta = $this->metadata('useragent'); foreach($insert as $key => $value){ if(isset($meta[$key]) !== true){ unset($insert[$key]); } } $this->insert('useragent',$insert); } } */ } } ?>