PHP OS와 브라우저 체크
log체크 소스에서 가져옴.
####################################################################################
// os+browser체크
####################################################################################
function check_agent()
{
global $HTTP_SERVER_VARS, $os_name, $br_name;
/*-----------------------------------------------------------------
OS Pattern
'keyword' => 'name',
-----------------------------------------------------------------*/
$OS = array(
/* PC */
array('Windows CE', 'Windows CE'),
array('Win98', 'Windows 98'),
array('Windows 9x', 'Windows ME'),
array('Windows me', 'Windows ME'),
array('Windows 98', 'Windows 98'),
array('Windows 95', 'Windows 95'),
array('Windows NT 6.3', 'Windows 8.1'),
array('Windows NT 6.2', 'Windows 8'),
array('Windows NT 6.1', 'Windows 7'),
array('Windows NT 6.0', 'Windows Vista'),
array('Windows NT 5.2', 'Windows 2003/XP x64'),
array('Windows NT 5.01', 'Windows 2000 SP1'),
array('Windows NT 5.1', 'Windows XP'),
array('Windows NT 5', 'Windows 2000'),
array('Windows NT', 'Windows NT'),
array('Macintosh', 'Macintosh'),
array('Mac_PowerPC', 'Mac PowerPC'),
array('Unix', 'Unix'),
array('bsd', 'BSD'),
array('Linux', 'Linux'),
array('Wget', 'Linux'),
array('windows', 'ETC Windows'),
array('mac', 'ETC Mac'),
/* MOBILE */
array('PSP', 'PlayStation Portable'),
array('Symbian', 'Symbian PDA'),
array('Nokia', 'Nokia PDA'),
array('LGT', 'LG Mobile'),
array('mobile', 'ETC Mobile'),
/* WEB ROBOT */
array('Googlebot', 'GoogleBot'),
array('OmniExplorer', 'OmniExplorerBot'),
array('MJ12bot', 'majestic12Bot'),
array('ia_archiver', 'Alexa(IA Archiver)'),
array('Yandex', 'Yandex bot'),
array('Inktomi', 'Inktomi Slurp'),
array('Giga', 'GigaBot'),
array('Jeeves', 'Jeeves bot'),
array('Planetwide', 'IBM Planetwide bot'),
array('bot', 'ETC Robot'),
array('Crawler', 'ETC Robot'),
array('library', 'ETC Robot'),
);
/*-----------------------------------------------------------------
Browser Pattern
'keyword' => 'name',
-----------------------------------------------------------------*/
$BW = array(
/* BROWSER */
array('MSIE 2', 'InternetExplorer 2'),
array('MSIE 3', 'InternetExplorer 3'),
array('MSIE 4', 'InternetExplorer 4'),
array('MSIE 5', 'InternetExplorer 5'),
array('MSIE 6', 'InternetExplorer 6'),
array('MSIE 7', 'InternetExplorer 7'),
array('MSIE 8', 'InternetExplorer 8'),
array('MSIE 9', 'InternetExplorer 9'),
array('MSIE 10', 'InternetExplorer 10'),
array('Trident/7.0', 'InternetExplorer 11'),
array('MSIE', 'ETC InternetExplorer'),
array('Firefox', 'FireFox'),
array('Safari', 'Safari'),
array('Opera', 'Opera'),
array('Lynx', 'Lynx'),
array('LibWWW', 'LibWWW'),
array('Konqueror', 'Konqueror'),
array('Internet Ninja', 'Internet Ninja'),
array('Download Ninja', 'Download Ninja'),
array('WebCapture', 'WebCapture'),
array('LTH', 'LTH Browser'),
array('Gecko', 'Gecko compatible'),
array('Mozilla', 'Mozilla compatible'),
array('wget', 'Wget command'),
/* MOBILE */
array('PSP', 'PlayStation Portable'),
array('Symbian', 'Symbian PDA'),
array('Nokia', 'Nokia PDA'),
array('LGT', 'LG Mobile'),
array('mobile', 'ETC Mobile'),
/* WEB ROBOT */
array('Googlebot', 'GoogleBot'),
array('OmniExplorer', 'OmniExplorerBot'),
array('MJ12bot', 'majestic12Bot'),
array('ia_archiver', 'Alexa(IA Archiver)'),
array('Yandex', 'Yandex bot'),
array('Inktomi', 'Inktomi Slurp'),
array('Giga', 'GigaBot'),
array('Jeeves', 'Jeeves bot'),
array('Planetwide', 'IBM Planetwide bot'),
array('bot', 'ETC Robot'),
array('Crawler', 'ETC Robot'),
);
foreach($OS as $val)
{
if(eregi($val[0], $_SERVER['HTTP_USER_AGENT']))
{
$os_name = $val[1];
break;
}
}
foreach($BW as $val)
{
if(eregi($val[0], $_SERVER['HTTP_USER_AGENT']))
{
$br_name = $val[1];
break;
}
}
}
'웹프로그래밍 > PHP' 카테고리의 다른 글
php 에서 pdf 만들기 (0) | 2014.07.31 |
---|---|
php 문자열 * 처리, 문자 자르기 (2) | 2014.07.23 |
php 현재 폴더이름 알아내기 (0) | 2014.03.12 |
[php] 썸네일 작성시 주의할점. (0) | 2012.11.26 |
[PHP] 컬럼명(필드명) 가져오기 (0) | 2012.04.27 |