OS별 접속자현황에 모바일 기종 추가 > 그누4 팁자료실

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.

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

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는 답변 부탁드립니다.(__)
추천
10

댓글 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
전체 9 |RSS
그누4 팁자료실 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT