2026, 새로운 도약을 시작합니다.

OS별 접속자현황에 모바일 기종 추가

/lib/visit.lib.php의 os부분을 아래걸로 교체해주시면 됩니다.

=====================================================================
function get_os($agent)
{
    $agent = strtolower($agent);

    //echo $agent; echo "<br/>";

    if (preg_match("/windows 98/", $agent))                 { $s = "98"; }
    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 사이언
    else if(preg_match("/windows 95/", $agent))             { $s = "95"; }
    else if(preg_match("/windows nt 4\.[0-9]*/", $agent))   { $s = "NT"; }
    else if(preg_match("/windows nt 5\.0/", $agent))        { $s = "2000"; }
    else if(preg_match("/windows nt 5\.1/", $agent))        { $s = "XP"; }
    else if(preg_match("/windows nt 5\.2/", $agent))        { $s = "2003"; }
    else if(preg_match("/windows nt 6\.0/", $agent))        { $s = "Vista"; }
    else if(preg_match("/windows nt 6\.1/", $agent))        { $s = "Windows7"; }
    else if(preg_match("/windows 9x/", $agent))             { $s = "ME"; }
    else if(preg_match("/windows ce/", $agent))             { $s = "CE"; }
    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("/bot|slurp/", $agent))              { $s = "Robot"; }
    else if(preg_match("/internet explorer/", $agent))      { $s = "IE"; }
    else if(preg_match("/mozilla/", $agent))                { $s = "Mozilla"; }
    else if(preg_match("/macintosh/", $agent))              { $s = "Mac"; }
    else { $s = "기타"; }

    return $s;
}
=====================================================================

USER_AGENT는 이곳을 참조하였습니다.
http://coffeenix.net/board_view.php?bd_code=1668

적용결과 대충 이정도로 나오네요.



아직 기타가 너무 많네요.
수정할 부분이나 기타 AGENT는 답변 부탁드립니다.(__)
|

댓글 11개

로봇도 추가합니다. 다음로봇같은 경우는 agent에 bot이라는 단어가 없어서 안걸리네요.
폰 같은 경우는
0106CSK76401124029627141894252311;131;0;14;5;0450
0108CLGE1501124032036221652972847;2;0;13;05;0450
라는 식의 agent도 있어서
몇종류 추가하고 phone이라는 단어는 iphone과 혼동되니 mobile로 변경해봤습니다.

else if(preg_match("/phone|skt|lge|0450/", $agent)) { $s = "Mobile"; }
else if(preg_match("/naver|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 = "Microsoft Robot"; } //MSN로봇
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("/rss/", $agent)) { $s = "RSS Reader"; } //RSS리더
else if(preg_match("/bot|slurp|scrap|spider|crawl/", $agent)) { $s = "Robot"; } //기타로봇
다음 그누보드 업데이트에 포함되기를 기대합니다. 추천^^
감사합니다^^추천
감사드립니다.
해외 모바일 일부추가
else if(preg_match("/lg/", $agent)) { $s = "LG mobiles"; } //LG mobiles
else if(preg_match("/mot/", $agent)) { $s = "Motorola mobiles"; } //Motorola mobiles
//else if(preg_match("/sie /", $agent)) { $s = "Siemens BenQ mobiles"; } //Siemens BenQ mobiles //XP가 이걸로 나오네요
else if(preg_match("/kddi-/", $agent)) { $s = " Samsung mobiles"; } // Samsung mobiles
else if(preg_match("/blackberry/", $agent)) { $s = " Samsung mobiles"; } // Samsung mobiles
감사합니다. 루시올라 님 팁포함하여 2010.5월27일 적용하였습니다.
OS별 접속자현황에 모바일 기종 추가
와우..요즘 모바일웹 준비중인데 유용한 팁입니다.감사합니다.!!

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.
번호 제목 글쓴이 날짜 조회
3309 3년 전 조회 2,014
3308 11년 전 조회 2,333
3307 6년 전 조회 5,023
3306 6년 전 조회 3,495
3305 6년 전 조회 1.3만
3304 7년 전 조회 3,974
3303 7년 전 조회 3,954
3302 7년 전 조회 1.4만
3301 8년 전 조회 5,099
3300 8년 전 조회 6,191
3299 8년 전 조회 1.1만
3298 8년 전 조회 4,234
3297 8년 전 조회 4,659
3296 8년 전 조회 1.2만
3295 8년 전 조회 1.5만
3294 8년 전 조회 6,243
3293 8년 전 조회 5,862
3292 9년 전 조회 5,514
3291 9년 전 조회 1.4만
3290 9년 전 조회 5,270
🐛 버그신고