修改WP后台IP地址查询链接 - Nicky's blog

February 26th, 2007

修改WP后台IP地址查询链接

Category: WordPress, Author: Nicky, Popularity: 11%

ipcn.png
WordPress后台能显示留言者的IP地址,但默认是链接到ARIN(主要负责北美地区IP地址的管理,4个RIR之一)来查询IP地址的信息,中国是属于“亚太网络信息中心APNIC”(负责分配亚洲太平洋区域的网站IP地址,包含 56 经济区 )管辖范围,所以apnic提供的数据最适合我们。

我是比较喜欢珊瑚虫的东西,所以我把WordPress后台IP地址归属地和Whois信息都链接到ip.cn,它的whois信息使用apnic的数据。

修改方法:

1、用编辑器打开
wp-admin/edit-comments.php

找到152行,把:
http://ws.arin.net/cgi-bin/whois.pl?queryinput=
替换为:
http://www.ip.cn/?q=
然后在本行结束p标签前面,加上(可选):

<a href="http://www.ip.cn/whois.php?q=<?php comment_author_IP() ?>">Whois?</a>

2、用编辑器打开
wp-admin/moderation.php

找到122行,把:
http://ws.arin.net/cgi-bin/whois.pl?queryinput=
替换为:
http://www.ip.cn/?q=
然后在本行结束p标签前面,加上(可选):

<a href="http://www.ip.cn/whois.php?q=<?php comment_author_IP() ?>">Whois?</a>

相关插件:
IP to Nation WordPress Plugin
把留言者的IP地址转换成国家和地区

Tags:, .
评论数量(8) | Add Comments
本文网址:http://www.osxcn.com/wordpress/wordpress-ip-whois.html



8 Comments so far

» You can leave a response or Trackback .

  1. Gravatar Icon xu.hel Says:

    我把你Blog的主题移植到我的Blog上了。

  2. Gravatar Icon Nicky Says:

    已经看见了,你是用的PJblog哦。

  3. Gravatar Icon David Says:

    good, I like it. :mrgreen:

  4. Gravatar Icon kevin Says:

    为什么要加“>Whois?

    还有,加的位置说的也不明确
    后面?到底是谁的后面。

  5. Gravatar Icon Nicky Says:

    当然也可以不加,加的位置是152行或者122行结束p标签前面。

  6. Gravatar Icon Keenzy Says:

    :cool: so nice theme!!!!

  7. Gravatar Icon butter Says:

    nicky,你用的这个ajax的评论插件是什么啊?介绍一下!

  8. Gravatar Icon Nicky Says:

leave a reply