判断用户使用的浏览器和系统

function browinfo($Agent=''){
 if(stripos($Agent, "360SE")){
  $visitor_browser = "360";
 }elseif(stripos($Agent, "TencentTraveler")){
  $visitor_browser = "TT";
 }elseif(stripos($Agent, "Maxthon")){
  $visitor_browser = "Maxthon";
 }elseif(stripos($Agent, "SE 2.X")){
  $visitor_browser = "sogou";
 }elseif(stripos($Agent, "TheWorld")){
  $visitor_browser = "the world";
 }elseif(stripos($Agent, "MSIE 8.0")) {
  $visitor_browser = "IE8";
 }elseif(stripos($Agent, "MSIE 7.0")) {
  $visitor_browser = "Internet Explorer 7.0";
 } elseif(stripos($Agent, "MSIE 6.0")) {
  $visitor_browser = "Internet Explorer 6.0";
 } elseif(stripos($Agent, "MSIE 5.5")) {
  $visitor_browser = "Internet Explorer 5.5";
 } elseif(stripos($Agent, "MSIE 5.0")) {
  $visitor_browser = "Internet Explorer 5.0";
 }elseif(stripos($Agent, "NetCaptor")) {
  $visitor_browser = "NetCaptor";
 } elseif(stripos($Agent, "Netscape")) {
  $visitor_browser = "Netscape";
 } elseif(stripos($Agent, "Lynx")) {
  $visitor_browser = "Lynx";
 } elseif(stripos($Agent, "Opera")) {
  $visitor_browser = "Opera";
 } elseif(stripos($Agent, "Konqueror")) {
  $visitor_browser = "Konqueror";
 } elseif(stripos($Agent, "Safari")) {
  $visitor_browser = "safari";
 }elseif(stripos($Agent, "Chrome")){
  $visitor_browser = "Chrome";
 }elseif(stripos($Agent, "Firefox")){
  $visitor_browser = "Firefox";
 }else {
  $visitor_browser = "others";
 }
 return $visitor_browser;
}
function osinfo($Agent=''){
 $os = false;

 if (eregi('win', $Agent) && stripos($Agent, '95')){
  $os = 'Windows 95';
 }else if (eregi('win 9x', $Agent) && stripos($Agent, '4.90')){
  $os = 'Windows ME';
 }else if (eregi('win', $Agent) && eregi('nt 6.1', $Agent)){
  $os = 'Windows 7';
 }else if (eregi('win', $Agent) && eregi('nt 6', $Agent)){
  $os = 'Windows Vista';
 }else if (eregi('sun', $Agent) && eregi('os', $Agent)){
   $os = 'SunOS';
 }else if (eregi('ibm', $Agent) && eregi('os', $Agent)){
   $os = 'IBM OS/2';
 }else if (eregi('apple', $Agent) ){
   $os = 'Apple PC';
 }else if (eregi('win', $Agent) && ereg('98', $Agent)){
  $os = 'Windows 98';
 }else if (eregi('win', $Agent) && eregi('nt 5.1', $Agent)){
  $os = 'Windows XP';
 }else if (eregi('win', $Agent) && eregi('nt 5', $Agent)){
  $os = 'Windows 2000';
 }else if (eregi('win', $Agent) && eregi('nt', $Agent)){
  $os = 'Windows NT';
 }else if (eregi('win', $Agent) && ereg('32', $Agent)){
  $os = 'Windows 32';
 }else if (eregi('linux', $Agent)){
  $os = 'Linux';
 }else if (eregi('unix', $Agent)){
  $os = 'Unix';
 }else if (eregi('sun', $Agent) && eregi('os', $Agent)){
  $os = 'SunOS';
 }else if (eregi('ibm', $Agent) && eregi('os', $Agent)){
  $os = 'IBM OS/2';
 }else if (eregi('Mac', $Agent) && eregi('PC', $Agent)){
  $os = 'Macintosh';
 }else if (eregi('PowerPC', $Agent)){
  $os = 'PowerPC';
 }else if (eregi('AIX', $Agent)){
  $os = 'AIX';
 }else if (eregi('HPUX', $Agent)){
  $os = 'HPUX';
 }else if (eregi('NetBSD', $Agent)){
  $os = 'NetBSD';
 }else if (eregi('BSD', $Agent)){
  $os = 'BSD';
 }else if (ereg('OSF1', $Agent)){
  $os = 'OSF1';
 }else if (ereg('IRIX', $Agent)){
  $os = 'IRIX';
 }else if (eregi('FreeBSD', $Agent)){
  $os = 'FreeBSD';
 }else if (eregi('teleport', $Agent)){
  $os = 'teleport';
 }else if (eregi('flashget', $Agent)){
  $os = 'flashget';
 }else if (eregi('webzip', $Agent)){
  $os = 'webzip';
 }else if (eregi('offline', $Agent)){
  $os = 'offline';
 }else{
  $os = '没有头信息';
 }
 return $os;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值