• ip地址查询工具

    Posted on 八月 15th, 2008 inetdemon No comments

    IP地址查询小工具,主要用于搜索IP地址的地理位置,查询的地理位置数据库为QQ所使用的纯真数据库。IP地址到域名可以使用IP反向查询工具
    require_once('qqwry.class.php');

    $ip=trim($_POST['ip']);
    if (empty($ip)){
    $VisitorIP = $_SERVER['REMOTE_ADDR'];
    $VisitorLoc = ip2location($VisitorIP);
    echo "您的IP地址是:$VisitorIP ,所在地为:”.iconv(“GB2312″,”UTF-8″,$VisitorLoc).”
    “;
    }else if(!eregi(“([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})”,$ip)){
    echo “IP地址格式不正确!请重新输入“;
    $ip=”";
    }
    ?>

    onMouseOver=”this.focus()” onFocus=”this.select();this.style.color=’#000000′” onClick=”if (this.value==’输入IP’) this.value=”” onblur=”if(this.value ==”||this.value==’输入IP’){this.value=’输入IP’;this.style.color=’#cccccc’}” style=”width: 100px;color:#999999;”>

    if (!empty($ip)){
    $location=ip2location($ip);
    echo "您输入的IP地址$ip的所在地为:”.iconv(“GB2312″,”UTF-8″,$location).”“;
    }
    ?>



    如发现少量ip地址查询结果不正确,请到官方网站http://www.apnic.net查询,以apnic为准。

    Leave a reply