Ec (2); include_once (. qqwry. php tutorial); $ QQWrynewQQWry; functionget_real_ip () {$ ipfalse; if (! Empty ($ _ SERVER [& quot; HTTP_CLIENT_IP & quot;]) {$ ip $ _ SERVER [& quot; HTTP_CLIENT_IP & quot;] ;}if (! Emp script ec (2); script
Include_once ('./qqwry. php tutorial ');
$ QQWry = new QQWry;
Function get_real_ip (){
$ Ip = false;
If (! Empty ($ _ SERVER ["HTTP_CLIENT_IP"]) {
$ Ip = $ _ SERVER ["HTTP_CLIENT_IP"];
}
If (! Empty ($ _ SERVER ['HTTP _ X_FORWARDED_FOR ']) {
$ Ips tutorial = explode (",", $ _ SERVER ['HTTP _ X_FORWARDED_FOR ']);
If ($ ip) {array_unshift ($ ips, $ ip); $ ip = FALSE ;}
For ($ I = 0; $ I <count ($ ips); $ I ++ ){
If (! Eregi ("^ (10 | 172.16 | 192.168).", $ ips [$ I]) {
$ Ip = $ ips [$ I];
Break;
}
}
}
Return $ ip;
}
Function is_ip ($ str ){
$ Ip = explode (".", $ str );
If (count ($ ip) <4 | count ($ ip)> 4) return 0;
Foreach ($ ip as $ ip_addr ){
If (! Is_numeric ($ ip_addr) return 0;
If ($ ip_addr <0 | $ ip_addr> 255) return 0;
}
Return 1;
}
If ($ _ POST ['IP']) {
$ Ip = $ _ POST ['IP'];
Preg_match ('/(w |-) +.) + [a-z] {2, 4}/I', $ ip )? $ Ip = gethostbyname ($ ip): $ ip;
If (is_ip ($ ip )){
$ IfErr = $ QQWry-> QQWry ($ ip );
Echo "IP address you queried:". $ ip ."
IP Address: ". $ QQWry-> Country. $ QQWry-> Local ."
";
$ Ipl = $ QQWry-> Country;
} Else
{
Echo "you entered a Mars IP address, which cannot be queried on this site .";
}
} Else {
$ Ip = get_real_ip ();
If ($ _ SERVER ["HTTP_CLIENT_IP"]) or ($ _ SERVER ['HTTP _ X_FORWARDED_FOR ']) {
$ IfErr = $ QQWry-> QQWry ($ ip );
Echo "your real P is". $ ip. "from". $ QQWry-> Country. $ QQWry-> Local ."
";
$ Ipl = $ QQWry-> Country;
$ Ip = $ _ SERVER ['remote _ ADDR '];
$ IfErr = $ QQWry-> QQWry ($ ip );
Echo "your proxy IP address is". $ ip. "from". $ QQWry-> Country. $ QQWry-> Local;
}
Else {
$ Ip = $ _ SERVER ['remote _ ADDR '];
$ IfErr = $ QQWry-> QQWry ($ ip );
Echo "your IP address is". $ ip. "from". $ QQWry-> Country. $ QQWry-> Local;
$ Ipl = $ QQWry-> Country;
}
}