建站铺's Archiver

文人 发表于 2008-4-28 09:13

一个可以显示IP查询位置地图的PHP程序!(网速慢,发重复了,请版主删除这个)

演示:http://www.ipfox.com.cn/
原理:借助google maps显示其IP所在地地图位置。(需要申请个google的key)

文件:你自己的IP查询程序+一个HTML页即可


HTML文件2.htm代码
引用格式:http://www.ipfox.com.cn/2.htm?湖南省株洲市

2.htm代码:
<script src="http://ditu.google.com/maps?file=api&v=2.x&key=ABQIAAAAxrryO9ztNllJV478OHgoUhSldR1ND_txlcuxRl8_AG4iJh50ABTWAsb98SF8PpXkDnxpLXR4LWsFug&hl=zh-CN" type="text/javascript"></script>
    <script type="text/javascript">
    var map = null;
    var geocoder = null;

    function initialize() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
     geocoder = new GClientGeocoder();
           var address;
if (document.location.search == ""){
address= "";
}else{
address= document.location.search.substr(1);
}
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              //alert("不能解析: " + address);
                         document.write("载入地址发生错误!请联系ipfox.com.cn管理员");
            } else {
              map.setCenter(point, 13);
                                                          var icon = new GIcon (G_DEFAULT_ICON, "ipfox.gif");
                                icon.iconSize = new GSize (32, 39);
              var marker = new GMarker(point, icon);
              map.addOverlay(marker);
                          map.enableScrollWheelZoom();
                                map.addControl(new GSmallMapControl());
                                map.addControl(new GScaleControl());
                                //map.addControl(new GMapTypeControl());
                                                                var txt = "<div style=\"font-family:Arial,Helvetica,Sans Serif;font-size:11px;text-align:center\">";
                                txt += "你所查询的IP所在地<br><font color=ff0000>";
                                txt += address+"</font><br>地理位置坐标<br>ipfox.com.cn为您提供"
                                txt += "<" + "/div>";
              marker.openInfoWindowHtml(txt);
            }
          }
        );
      }
        
      
      }
    }


    </script>
  </head>

  <body onLoad="initialize()" onUnload="GUnload()">
      <div id="map_canvas" style="width: 500px; height: 340px">正在载入IP地理位置图...</div>

[local]1[/local][local]2[/local][local]3[/local]

[[i] 本帖最后由 文人 于 2008-4-28 09:15 编辑 [/i]]

20ling08 发表于 2008-5-6 11:52

经典铃声哪个网站有好听的下载?(22)

*** 作者被禁止或删除 内容自动屏蔽 ***

辐射鱼 发表于 2008-5-19 15:47

谢谢,收藏  现在还用不上

jzpwzs 发表于 2008-7-1 09:28

哎呀,这个东东我才发现呀,太爽了.不错.顶一下.

页: [1]
铺子法律顾问:姚文胜律师 熊潇敏律师 本论坛的源码只做研究学习只用,请下载以后24小时内删除,如预时不删除,引起的后果,本论坛 不承担任何责任
本站资源大多来自网络,如原作不希望在本站显示你的软件(文章)请来信,我们将尽快删除。拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论!

Powered by jzpu.com 6.1.0  © 2001-2007 Comsenz Inc.