1. Obtain the Internet IP Address Code
Function get_online_ip (){
$ Onlineip = ''; If (getenv ('HTTP _ client_ip ') & strcasecmp (getenv ('HTTP _ client_ip'), 'unknown ')) {$ onlineip = getenv ('HTTP _ client_ip ');} elseif (getenv ('HTTP _ x_forwarded_for') & strcasecmp (getenv ('HTTP _ x_forwarded_for '), 'unknon') {$ onlineip = getenv ('HTTP _ x_forwarded_for ');} elseif (getenv ('remote _ ADDR ') & strcasecmp (getenv ('remote _ ADDR '), 'unknown') {$ onlineip = getenv ('remote _ ADDR ');} elseif (isset ($ _ server ['remote _ ADDR ']) & $ _ server ['remote _ ADDR '] & strcasecmp ($ _ server ['remote _ ADDR'], 'unknown ')) {$ onlineip = $ _ server ['remote _ ADDR '];} return $ onlineip ;}
2. Obtain the code of the Intranet IP Address
Function getclientip ()
{$ Client_ip = NULL;
If (getenv ("http_client_client_ip") {$ client_ip = getenv ("http_client_client_ip");} else if (getenv ("http_x_forwarded_for ")) {$ client_ip = getenv ("http_x_forwarded_for");} else if (getenv ("remote_addr") {$ client_ip = getenv ("remote_addr ");} else {$ client_ip = NULL ;}
Return $ client_ip ;}
Obtain the client's intranet and Internet IP addresses