Get client information

xiaoxiao2021-03-06  47

getBrowse (); 2, IP address: $ str = $ code-> getip (); 4, operating system: $ STR = $ code-> getos (); * /

class clientGetObj {function getBrowse () {global $ _SERVER; $ Agent = $ _SERVER [ 'HTTP_USER_AGENT']; $ browser = ''; $ browserver = ''; $ Browser = array ( 'Lynx', 'MOSAIC', 'AOL ',' Opera ',' Java ',' MacWeb ',' WebExplorer ';' OmniWeb '); For ($ I = 0; $ I <= 7; $ i ) {IF (Strpos ($ Agent, $ Browsers [$ I])) {$ Browser = $ Browsers [$ I]; $ browserver = ';}}}}}}}}} &&! EREG (' Msie ', $ Agent) { $ TEMP = EXPLODE ('(', $ agent); $ part = $ TEMP [0]; $ TEMP = EXPLODE ('/', $ part); $ browserver = $ temp [1]; $ TEMP = EXPLODE (' ', $ browserver); $ browserver = $ temp [0]; $ browserver = preg_replace (' / ([d.] ) / ',' / 1 ', $ browserver); $ browserver = $ browserver; $ browser = 'Netscape Navigator';} IF (EREG ('Mozilla', $ Agent && EREG ('Opera', $ Agent) {$ TEMP = EXPLODE ('(', $ Agent); $ Part = $ TEMP [1]; $ TEMP = EXPLODE (')', $ part); $ browserver = $ TEMP [1]; $ TEMP = EXPLODE (', $ browserver); $ browserver = $ temp [2 ]; $ Browserver = preg_replace ('/ ([d.] ) /', '/ 1', $ browserver; $ browserver = $ browserver; $ browser = 'Opera';} if (EREG ('Mozilla', $ Agent &&

EREG ('Msie', $ Agent) {$ TEMP = EXPLODE ('(', $ agent); $ part = $ temp [1]; $ TEMP = EXPLODE (';', $ part); $ part = $ Temp [1]; $ TEMP = EXPLODE (', $ part); $ browserver = $ TEMP [2]; $ browserver = preg_replace (' / ([d.] ) / ',' / 1 ', $ Browserver $ Browserver = $ Browserver; $ browser = 'Internet explorer';} f ($ browser! = ') {$ Browseinfo = $ browser.' '. $ Browserver;} else {$ browseinfo = false;} return browseinfo;} function getIP () {global $ _SERVER; if (getenv ( 'HTTP_CLIENT_IP')) {$ ip = getenv ( 'HTTP_CLIENT_IP');} else if (getenv ( 'HTTP_X_FORWARDED_FOR')) {$ ip = getenv ( ' HTTP_X_FORWARDED_FOR ');} Else IF (GetENV (' remote_addr ')) {$ ip = getENV (' remote_addr ');} else {$ ip = $ _server [' remote_addr '];} returnid;}

Function getos () {Global $ _SERVER; $ agent = $ _server ['http_user_agent']; $ os = false; if (EREGI ('WIN', $ Agent) && Strpos ($ Agent, '95')) {$ OS = 'Windows 95';} else if (EREGI ('WIN 9X', $ Agent && Strpos ($ Agent, '4.90')) {$ OS = 'Windows Me';} Else IF (EREGI ('Win ", $ agent && EREG ('98 ', $ agent)) {$ OS =' windows 98 ';} elseiff (EREGI (' WIN ', $ Agent) && EREGI (' NT 5.1 ', $ Agent) {$ OS = 'Windows XP';} else if (EREGI ('WIN', $ Agent) && EREGI ('NT 5', $ Agent) {$ OS = 'Windows 2000';} elseiff (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 (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 (EREG ('Irix', $ Agent) {$ OS = 'Irix';} Else IF ('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 (EREGI ('Offline', $ Agent) {$ OS = 'offline';} else {$ os = 'unknown';} Return $ OS;}}?>

转载请注明原文地址:https://www.9cbs.com/read-110229.html

New Post(0)