Function getIP() {
If (! Empty ($ _ SERVER[\ "HTTP _ CLIENT _ IP \ "]){
$ CIP = $ _ SERVER[\ " HTTP _ CLIENT _ IP \ "];
} else if(! Empty ($ _ server [\ "http _ x _ forwarded _ for \"]) {
$ CIP = $ _ SERVER[\ " HTTP _ X _ FORWARDED _ FOR \ "];
} else if(! Empty ($_SERVER [\ "remote _ ADDR \ "]){
$cip = $_SERVER [\ "remote _ addr \"];
} Otherwise {
$ CIP =“”;
}
preg_match ( \"/[\d\。 ]{7, 15}/\ ",$cip,$ CIPS);
$cip = isset ( $cips [0])? $cips [0]:' unknown';
unset(CIPS);
Return to $ cip
}