Feb 08 24
As a supplement of WordPress IP to Country Plugin created by Priyadi Iman Nurcahyo, I created a very simple WordPress plugin named IPCT Plugin. This plugin detects the city name of the visitors based on their IP number. I use the GeoLiteCity database to translate IP number into the city name.
Requirement
- WordPress 2.0 or newer
- Basic knowledge of PHP
Installation
- Download the latest GeoLiteCity binary format.
- Unzip the file to get GeoLiteCity.dat
- Download GeoIP PHP API Module. You need to download geoip.inc, geoipcity.inc, and geoipregionvars.php.
- Rename geoip.inc into geoip.inc.php.
- Rename geoipcity.inc into geoipcity.inc.php.
- Open geoipcity.inc.php and change the line “require_once ‘geoip.inc’;” into “require_once ‘geoip.inc.php’;”
- Download ipct.txt and rename it into ipct.php.
- Create new directory named ipct inside your wp-content/plugins directory.
- Upload geoip.inc.php, geoipcity.inc.php, geoipregionvars.php, ipct.php, and GeoLiteCity.dat into your wp-content/plugins/ipct directory.
- Activate the plugin from your Wordpress plugin menu.
Usage
- Open your theme comments.php file with a text editor.
- Use the function yahya_print_city($comment->comment_author_IP) inside the comment loop.
That’s all.
If you want to see the result, just put a comment here ![]()
wah berhasil !!!
Using
hm.. kok yang muncul Semarang ya pak?
Padahal saya dari Solo lho…
Yang salah siapa ya pak?
Using
#2
Yang salah databasenya
Soalnya aku pake yang versi free, yang keakuratannya kurang
Using
Mas, ajarin dong yang bikin avatar di comment box itu.. plus kok bisa ya ada “USING MOZILLA FIREFOX” and bla bla bla.. itu..
Using
wak keren..!!! ini dia yang kucari
Using
GeoLiteCity.dat … 26 MB!?
Using
Lha… klo aku gimana hasilnya? test ah
Using
Leave a Reply