Zblog uses the physical plug-in of IP address to implement the method of commenting and displaying IP location (the latest compatible with IPV4/V6)

As mentioned above, I have been studying the scheme of displaying IP address in the comment area recently, but I finally abandoned the scheme of online API interface. Because the cache is not set, and every time I query directly, the feedback information will be much slower. There may be several comments, but

Li Yang's Blog 2022-05-09 9.8 K Reading 39 Comments

Last article updated: April 29, 2024

As mentioned above, I have been studying the scheme of displaying IP addresses in the comment area recently, but finally abandoned the scheme of online API interfaces. Because no cache will be set, and each time I directly query the information returned, it will naturally be much slower. There may be several comments, but if there are dozens or even hundreds of comments in the article, I can imagine how far it will drag, So today we use zblog Application Center plug-in unit "Physical IP address (pure version)" to achieve this function.

 Zblog uses the IP address physicalization plug-in to implement the method of commenting and displaying the IP location (the latest compatible with IPV4/V6) Page 1

I talked with the Tang Dynasty before and also gave some suggestions. It's a great honor to be accepted. More importantly, the plug-in is free, and no extra cost is allowed. As shown in the figure above, the display mode is divided into three types, which directly shows the IP location and the location+IP address, as well as the location and IP alternate display. You can also set the display mode, which can be province+region (Shenyang, Liaoning) or province (Liaoning), according to your own preferences.

The plug-in is very simple and there is nothing superfluous. According to the instructions of the Tang Dynasty, because it is a local query, it is very fast, and there is no drag of the online interface. After testing, it is really fast, the same time as the plug-in was not opened. Of course, my comments are few. If you open the plug-in and the query speed is slow, you can contact me. After installing the plug-in, don't forget to download it“ qqwry.dat ”Pure IP data. This is necessary. After downloading, follow the course The directory upload of can be completed, which is very simple. The method of directly calling the Tang Dynasty is also given:

 {if $zbp->CheckPlugin('ytecn_ipshow')} <span class="interaction area">From {ytecn_ip ($comment. IP)}</span> {/if}

Copy the above code and place it in the location where the IP address needs to be displayed, such as the comment area of the blog. Path:“ /Zb_users/theme/Topic ID/template/comment.php ”After saving, remember to display it on the foreground of "Clear Cache Compilation" on the background home page. After the code makes a judgment, the call will be displayed only after the plug-in is enabled, and no error will be reported if the plug-in is not enabled.

The effect after the plug-in is enabled is probably that of Jamie (taking the theme of hope as an example):

 Zblog uses the IP address physicalization plug-in to implement the method of commenting and displaying the IP location (the latest compatible with IPV4/V6) Page 2

The theme will update the IP location function in succession. The back switch can be turned on or off according to the actual situation. After all, different places have different requirements for websites. It is estimated that personal blog websites will have to force requirements later. Well, the tutorial is completed. I will update the theme template. If you have any questions, please leave a message!

the latest version:

Because the Tang Dynasty bosses are busy, they haven't been updated. I'm looking for Baidu After a variety of methods, I finally came back. Currently, I use the 3. x version (ipv4+ipv6) developed by "Zhao Binyan" to automatically identify IPV4 or IPV6. At present, after testing, I have made plug-ins. The settings are similar according to the version of the Tang Dynasty tycoons, and can't be said to be a dime. Yes, after all, I use the Tang Dynasty plug-in framework directly, but the code is different, as shown in the figure below: Zblog uses the IP address physicalization plug-in to implement the method of commenting and displaying the IP location (the latest compatible with IPV4/V6) Page 3

Code calling method:

 {if ((int)$zbp->Config('iparealee')->Getipon) && ($zbp->CheckPlugin('iparealee'))}     {get_ipaddress($comment.IP)} {/if}

The display after this update is more perfect, for example, the problem that the real IP address cannot be obtained by using CDN is added, The code display is clearer, as shown in the figure:

 Zblog uses the IP address physicalization plug-in to implement the method of commenting and displaying the IP location (the latest compatible with IPV4/V6) Page 4

After obtaining the IP address, different contents can be displayed according to the actual situation. The plug-in background updates three ways: province: Guangdong, province: Shenzhen, Guangdong, province: * * District, Shenzhen, Guangdong (because the IP data comes from free, the district display is not particularly friendly, depending on fate). It is recommended to display the province directly during actual use, which is more accurate, It is not known whether the IP data will be updated later. The plug-in is currently tested, and there is no problem to release it later. Ok, the update article is completed. By the way, the download address of IP data is attached.

PS: The development theme of this website has basically integrated relevant code, which can be achieved only by downloading and enabling the theme. If there is any problem, contact the blogger.

Data download:

Follow the public account to view the verification code (download function test)

 Zblog uses the IP address physicalization plug-in to implement the method of commenting and displaying the IP location (the latest compatible with IPV4/V6) Page 5
Verification Code:

Please follow our WeChat official account and reply Verification code , get the verification code.

Search on WeChat "Li Yang Blog" perhaps “liblogcn” Or WeChat scanning the QR code on the right can follow our WeChat official account.

Article copyright notice: unless otherwise noted Lao Li's Notes For original articles, reprints or copies, please use hyperlinks and indicate the source.

Comment

Quick reply: expression:
 Addoil Applause Badlaugh Bomb Coffee Fabulous Facepalm Feces Frown Heyha Insidious KeepFighting NoProb PigHead Shocked Sinistersmile Slap Social Sweat Tolaugh Watermelon Witty Wow Yeah Yellowdog
Comment List (Yes thirty-nine Comments, nine thousand seven hundred and ninety-six People around)
 Netizen nickname: Muziyu
Muziyu V Iron powder  Google Chrome 121.0.0.0  Android 10 19th floor
02-17 From Guangdong reply
try
 Netizen nickname: Li Yang Blog
Li Yang's Blog V Blogger  Sogou Explorer  Windows 10 x64
02-18 From Liaoning reply
@Muziyu Try it!
 Netizen nickname: TestTTT
TestTTT V Iron powder  Google Chrome 116.0.0.0  Mac OS X 10.15.7 18th floor
2023-11-08 From Sichuan reply
test
 Netizen nickname: 1
one V Iron powder  Google Chrome 114.0.5735.289  Windows 7 x64 17th floor
2023-10-17 From Anhui reply
God, how to call the home page? Press the code above to display the unknown IP. This should not be true. The website reply IP can be displayed normally
 Netizen nickname: Li Yang Blog
Li Yang's Blog V Blogger  Sogou Explorer  Windows 10 x64
2023-10-18 From Liaoning reply
@1 I haven't tried how to call the homepage. I just use it on the comment page, QQ plus me: 229693666, good remarks
 Netizen nickname: Wanfu Blog
Wanfu Blog V Iron powder  Google Chrome 103.0.5060.114  Windows 10 x64 16F
2022-07-22 From Guizhou reply
Take a look at [Fabulous]
 Netizen nickname: Li Yang Blog
Li Yang's Blog V Blogger  Sogou Explorer  Windows 10 x64
2022-07-25 From Liaoning reply
@Wanfu Blog Your station is very beautiful.
 Netizen nickname: cc
cc V Iron powder  Google Chrome 103.0.5060.53  Windows 10 x64 15th floor
2022-06-24 From Henan reply
[Badlaugh] Write a comment plus time article.
 Netizen nickname: Li Yang Blog
Li Yang's Blog V Blogger  Sogou Explorer  Windows 10 x64
2022-06-25 From Liaoning reply
@cc What is a comment plus time article?
 Netizen nickname: LanFeng
LanFeng V Iron powder  Google Chrome 102.0.0.0  Windows 10 x64 14th floor
2022-06-17 From Tianjin reply
After selecting a province or city, all the municipalities directly under the central government are provinces! For example, Hexi District of Tianjin shows Hexi District of Tianjin, Chaoyang District of Beijing shows Chaoyang District of Beijing
 Netizen nickname: Li Yang Blog
Li Yang's Blog V Blogger  Sogou Explorer  Windows 10 x64
2022-06-17 From Liaoning reply
@LanFeng Ok, since then I will delete the provinces and cities, leaving only the first two "provinces" and "provinces and cities".
 Netizen nickname: visitor level one stick
Visitor First Class Stick V Iron powder  Google Chrome 102.0.5005.63  Windows 10 x64 13th floor
2022-06-13 From Henan reply
After setting Province/City, only the provinces are displayed. Is there something wrong
 Netizen nickname: Li Yang Blog
Li Yang's Blog V Blogger  Sogou Explorer  Windows 10 x64
2022-06-13 From Liaoning reply
@Visitor First Class Stick Try to clear the cache for compilation, or check whether the IP display is normal under local test.
 Netizen nickname: Edipse
Edipse V Iron powder  Google Chrome 102.0.5005.63  Windows 7 x64 12th floor
2022-06-08 From Sichuan reply
[Yellowdog]
 Netizen nickname: Li Yang Blog
Li Yang's Blog V Blogger  Sogou Explorer  Windows 10 x64
2022-06-08 From Liaoning reply
@Edipse [Watermelon]
 Nickname of netizen: Xiao Yang Lifeblog
Xiao Yang's Life Record V Iron powder  Sogou Explorer  Windows 10 x64 11th floor
2022-05-26 From Shanghai reply
It's good to use [Badlaugh]. If you can make another judgment, the IP address that does not exist in the IP database will be displayed as unknown. Ha ha
 Netizen nickname: Li Yang Blog
Li Yang's Blog V Blogger  Sogou Explorer  Windows 10 x64
2022-05-27 From Liaoning reply
@Xiao Yang's Life Record Now we have this judgment.
 cancel
 WeChat QR code
 WeChat QR code
 Alipay QR code