// get_browser() 함수는 이미 있음
function get_brow($agent)
{
$agent = strtolower($agent);
//echo $agent;
if (preg_match("/msie 5.0[0-9]*/", $agent)) { $s = "MSIE 5.0"; }
else if(preg_match("/msie 5.5[0-9]*/", $agent)) { $s = "MSIE 5.5"; }
else if(preg_match("/msie 6.0[0-9]*/", $agent)) { $s = "MSIE 6.0"; }
else if(preg_match("/msie 7.0[0-9]*/", $agent)) { $s = "MSIE 7.0"; }
else if(preg_match("/msie 8.0[0-9]*/", $agent)) { $s = "MSIE 8.0"; }
else if(preg_match("/msie 9.0[0-9]*/", $agent)) { $s = "MSIE 9.0"; }
else if(preg_match("/msie 10.0[0-9]*/", $agent)) { $s = "MSIE 10.0"; }
else if(preg_match("/msie 4.[0-9]*/", $agent)) { $s = "MSIE 4.x"; }
else if(preg_match("/firefox/", $agent)) { $s = "FireFox"; }
else if(preg_match("/chrome/", $agent)) { $s = "Chrome"; }
else if(preg_match("/x11/", $agent)) { $s = "Netscape"; }
else if(preg_match("/opera/", $agent)) { $s = "Opera"; }
else if(preg_match("/gec/", $agent)) { $s = "Gecko"; }
else if(preg_match("/python/", $agent)) { $s = "Python"; }
else if(preg_match("/bot|slurp|scrap|spider|crawl/", $agent)) { $s = "Robot"; }
else if(preg_match("/internet explorer/", $agent)) { $s = "IE"; }
else if(preg_match("/mozilla/", $agent)) { $s = "Mozilla"; }
else { $s = "기타"; }
return $s;
}
function get_os($agent)
{
$agent = strtolower($agent);
//echo $agent;
if (preg_match("/windows 95/", $agent)) { $s = " Win 95"; }
else if(preg_match("/iphone/", $agent)) { $s = "iPhone"; } //iPhone
else if(preg_match("/ipad/", $agent)) { $s = "iPad"; } //iPad
else if(preg_match("/iPod/", $agent)) { $s = "iPod"; } //iPod
else if(preg_match("/android/", $agent)) { $s = "Android"; } //Android
else if(preg_match("/psp/", $agent)) { $s = "PSP"; } //PSP
else if(preg_match("/playstation/", $agent)) { $s = "PLAYSTATION"; } //PLAYSTATION
else if(preg_match("/berry/", $agent)) { $s = "BlackBerry"; } //BlackBerry
else if(preg_match("/symbian/", $agent)) { $s = "Symbian"; } //Symbian
else if(preg_match("/ericsson/", $agent)) { $s = "SonyEricsson"; } //SonyEricsson
else if(preg_match("/nokia/", $agent)) { $s = "Nokia"; } //Nokia
else if(preg_match("/sph/", $agent)) { $s = "애니콜"; } //삼성폰
else if(preg_match("/sgh/", $agent)) { $s = "옴니아"; } //옴니아
else if(preg_match("/sch/", $agent)) { $s = "T*옴니아"; } //T*옴니아
else if(preg_match("/im-s/", $agent)) { $s = "스카이폰"; } //스카이폰
else if(preg_match("/lgtelecom/", $agent)) { $s = "LG 사이언"; } //LG 사이언
/* Win OS */
else if(preg_match("/windows 98/", $agent)) { $s = "Win 98"; }
else if(preg_match("/windows nt 4\.[0-9]*/", $agent)) { $s = "NT"; }
else if(preg_match("/windows nt 5\.0/", $agent)) { $s = "Win 2000"; }
else if(preg_match("/windows nt 5\.1/", $agent)) { $s = "Win XP"; }
else if(preg_match("/windows nt 5\.2/", $agent)) { $s = "Win 2003"; }
else if(preg_match("/windows nt 6\.0/", $agent)) { $s = "Win Vista"; }
else if(preg_match("/windows nt 6\.1/", $agent)) { $s = "Win 7"; }
else if(preg_match("/windows nt 6\.2/", $agent)) { $s = "Win 8"; }
else if(preg_match("/windows 9x/", $agent)) { $s = "ME"; }
else if(preg_match("/windows ce/", $agent)) { $s = "CE"; }
/* MAC OS X */
else if(preg_match("/mac os x 10.5/", $agent)) { $s = "Mac OS 10.5"; }
else if(preg_match("/mac os x 10_5_1/", $agent)) { $s = "Mac OS 10.5.1"; }
else if(preg_match("/mac os x 10_5_2/", $agent)) { $s = "Mac OS 10.5.2"; }
else if(preg_match("/mac os x 10_5_3/", $agent)) { $s = "Mac OS 10.5.3"; }
else if(preg_match("/mac os x 10_5_4/", $agent)) { $s = "Mac OS 10.5.4"; }
else if(preg_match("/mac os x 10_5_5/", $agent)) { $s = "Mac OS 10.5.5"; }
else if(preg_match("/mac os x 10_5_6/", $agent)) { $s = "Mac OS 10.5.6"; }
else if(preg_match("/mac os x 10_5_7/", $agent)) { $s = "Mac OS 10.5.7"; }
else if(preg_match("/mac os x 10_5_8/", $agent)) { $s = "Mac OS 10.5.8"; }
else if(preg_match("/mac os x 10.6/", $agent)) { $s = "Mac OS 10.6"; }
else if(preg_match("/mac os x 10_6_1/", $agent)) { $s = "Mac OS 10.6.1"; }
else if(preg_match("/mac os x 10_6_2/", $agent)) { $s = "Mac OS 10.6.2"; }
else if(preg_match("/mac os x 10_6_3/", $agent)) { $s = "Mac OS 10.6.3"; }
else if(preg_match("/mac os x 10_6_4/", $agent)) { $s = "Mac OS 10.6.4"; }
else if(preg_match("/mac os x 10_6_5/", $agent)) { $s = "Mac OS 10.6.5"; }
else if(preg_match("/mac os x 10_6_6/", $agent)) { $s = "Mac OS 10.6.6"; }
else if(preg_match("/mac os x 10_6_7/", $agent)) { $s = "Mac OS 10.6.7"; }
else if(preg_match("/mac os x 10_6_8/", $agent)) { $s = "Mac OS 10.6.8"; }
else if(preg_match("/mac os x 10_6_9/", $agent)) { $s = "Mac OS 10.6.9"; }
else if(preg_match("/mac os x 10.7/", $agent)) { $s = "Mac OS 10.7"; }
else if(preg_match("/mac os x 10_7_1/", $agent)) { $s = "Mac OS 10.7.1"; }
else if(preg_match("/mac os x 10_7_2/", $agent)) { $s = "Mac OS 10.7.2"; }
else if(preg_match("/mac os x 10_7_3/", $agent)) { $s = "Mac OS 10.7.3"; }
else if(preg_match("/mac os x 10_7_4/", $agent)) { $s = "Mac OS 10.7.4"; }
else if(preg_match("/mac os x 10.8/", $agent)) { $s = "Mac OS 10.8"; }
else if(preg_match("/linux/", $agent)) { $s = "Linux"; }
else if(preg_match("/sunos/", $agent)) { $s = "sunOS"; }
else if(preg_match("/irix/", $agent)) { $s = "IRIX"; }
else if(preg_match("/phone/", $agent)) { $s = "Phone"; }
else if(preg_match("/internet explorer/", $agent)) { $s = "IE"; }
else if(preg_match("/phone|skt|lge|0450/", $agent)) { $s = "Mobile"; }
else if(preg_match("/yeti/", $agent)) { $s = "NAVER Robot"; } //네이버 로봇
else if(preg_match("/mediapartners/", $agent)) { $s = "Google AdSense"; } //구글 애드센스
else if(preg_match("/google/", $agent)) { $s = "Google Robot"; } //구글 로봇
else if(preg_match("/msn/", $agent)) { $s = "Msn Robot"; } //MSN 로봇
else if(preg_match("/bing/", $agent)) { $s = "Bing Robot"; } //Bing 로봇
else if(preg_match("/yahoo/", $agent)) { $s = "Yahoo! Robot"; } //야후! 로봇
else if(preg_match("/daum/", $agent)) { $s = "DAUM Robot"; } //다음 로봇
else if(preg_match("/empas/", $agent)) { $s = "Empas Robot"; } //네이트 로봇
else if(preg_match("/zum/", $agent)) { $s = "Zum Robot"; } //줌 로봇
else if(preg_match("/baidu/", $agent)) { $s = "Baidu Robot"; } //바이두 로봇
else if(preg_match("/mj12/", $agent)) { $s = "majestic12 Robot"; } //마제스틱12 로봇
else if(preg_match("/yandex/", $agent)) { $s = "YandexBot Robot"; } //Yandex 로봇
else if(preg_match("/ahrefs/", $agent)) { $s = "Ahrefs Robot"; } //Ahrefs 로봇
else if(preg_match("/rss/", $agent)) { $s = "RSS Reader"; } //RSS리더
else if(preg_match("/bot|slurp|scrap|spider|crawl/", $agent)) { $s = "Robot"; } //기타 로봇
else { $s = "기타"; }
return $s;
}
?>
'PHP' 카테고리의 다른 글
숫자를 한글로 바꾸기 (0) | 2013.02.19 |
---|---|
영문 단어의 첫번째 글자 대문자로 (영어 이름) (0) | 2013.02.19 |
XSS 공격 방지 함수 (0) | 2013.02.18 |
파일 사이즈를 Byte별로 구분해주는 함수 (0) | 2013.02.18 |
PHP 날짜 함수 정리 (0) | 2013.02.18 |