inspired by the letter M: MURAKAMI, MISTS of MOSCHINO and MITSUKO

The MADSTATIC NetworkDuke of NYCReverb

Dig for dirt or gold.

Height: # of Posts | Opacity: # of Comments
Activity: Last 30 Days
CountryUpdate My First Plugin For SlimStat

CountryUpdate My First Plugin For SlimStat

2,261 views Since it was Spewed out 13 years, 11 months ago at 6:34 am

After some inspiration from Tagawa Igirisu’s plugin for SlimStat that creates some basic charts for this great stats script. I decided to give it a go myself. One of the things with the SlimStat script is it only loads the ip-to-country conversion table upon initial setup. Since provides this database free with regular updates, I thought I would attempt to create a plugin that would allow easy updates.

Quick rundown/history of SlimStat: Shaun Inman creates ShortStat (which becomes the basis of Mint). Stephen Wettone evolved ShortStat into something equally simple yet more powerful (in my opinion) named SlimStat.

I found that the free ip-to-country database from is updated on a fairly consistent basis. I also noticed that I was still getting a few “Unknown” countries listed in my stats.

So what I’ve done is simply taken the code from the original setup file and placed it into the menu system to allow for easy updating of the ip-to-country file.


CountryUpdate v1.0 InterfaceAs of version 1.0 what you will initially see upon accessing the CountryUpdate plugin page is a quick status as to the latest version of the ip-to-country database available from compared to the date of your database revision you are using on your site. The main important information is whether your installation is designated “Fresh” or “Stale”. If it is stale you can simply select “Automatic” which will automatically retrieve from the server the appropriate file and insert it into your database. (this process can take a few minutes). An alternative is if you happen to like to go through each step manually, you can go and download the database, and manually upload it in either csv or zip format (zip is the wiser choice as it is a smaller size and quicker upload).

Initial Screen This is the old initial screen prior to v1.0. It is simply a form that allows you to upload the ip-to-country.csv file. There is no upload status indicator, so please be patient when you’re uploading as this file is rather large (if you’re uploading the csv file).

Imported records After the file is completed uploading it will then run through the familiar screen of importing the records required to convert the ip addresses to a country. * Please note it is a known issue that for some users it will simply run through the entire process of importing the records before presenting you with this final screen at once *.

In order for this plugin to work, you must have opted to use the ip-to-country database when you initially installed SlimStat

Installation is extremely easy, simply download the file and unzip the contents into the SlimStat plugin directory. Instructions are also included in the zip file.

Upgrade Information:

v1.0 to v1.1 – you will only need to overwrite the index.php file in your installation.
v0.5 to v1.0 – you will only need to overwrite the index.php file in your installation.
v0.1 to v1.0 – you will need to overwrite all files.

Latest Version:

Download CountryUpdate Version 1.1

Version History:

v1.1 – Dec 9, 2006

  • Minor Update To Ensure Compatibility with PHP 4 & 5

v1.0 – Jun 26, 2006

  • First full version number 1.0 WOOHOO!
  • Enlarged “Freshness” Indicator
  • Automatic vs Manual options of updating database
  • Fully Automatic requiring no user intervention: retrieves file remotely from, unzips file, inserts data into database.

v0.5 – May 16, 2006

  • Ability to upload the Zip file as well as extracted CSV file
  • Status of whether has updated the file

v0.1 – Apr 02, 2006

  • ability to update ip-to-country database
  • initial release

Feedback and Suggestions are welcome and can be left here or in the SlimStat Google Group.

View A Post:

Sponsored Links

13 Comments, Comment or Ping

  1. Thanks for the compliment and the plugin. Works perfectly for me.
    The only improvement I can think of is some kind of alert when there’s a new database available, but as don’t seem to provide an RSS feed or other notification this might not be possible.
    Still a good script, though!

  2. Program looks promising. However, I have been unable to get it functioning. Need some quick advise please.

    Here is my error messages (paths truncated):

    Warning: mkdir(/slimstat/plugins/CountryUpdate/countrydb/): No such file or directory in ///// on line 35

    /slimstat/plugins/CountryUpdate/countrydb/ successfully created

    Warning: chmod(): No such file or directory in ///// on line 41

    /slimstat/plugins/CountryUpdate/countrydb/ successfully modified permisions

    The error seems to come back to the variable definition of $uploaddir which I have changed to read:
    $uploaddir = “/slimstat/plugins/CountryUpdate/countrydb/”;

    All paths seem to be correct, but I am able to update.

    Thanks in advance,

  3. I’ll make note to clarify that variable setting. Anything you specify for $uploaddir is created automatically within the slimstat directory. You can leave it as default and it should pose no problem.

    just change it back to say “countrydb/”

    and it will create the directory in “/slimstat/countrydb/”

    If that’s still giving you issues you’ll just need to create the directory manually and give it permission to write to it eg. chmod 0755

  4. understood and done, no luck unfortunately

    Attempt 1
    Made changes back to initial configuration. Same errors.

    Attempt 2
    created and confirmed permissions within
    folder chmod 0755.
    Warning: chmod(): Operation not permitted in *truncated* ///// on line 41

    Attempt 3
    also chmod “/slimstat/” to 0755
    – original errors

    any further thoughts?

  5. if that is still popping up that means the script is having some issues writing to that directory and is attempting to chmod the directory to be writeable itself.

    i’m wondering if it might have something to do with where the script perceives itself to be located as it is showing your installation with a lot of slashes at the beginning ////

    are you changing the permissions using your shell access or via ftp? sometimes if the server is not allowing you to change the permission via ftp it won’t show any indication of this. can you take a quick view of the permissions of the countryupdate directory again and see what it is default set to?

    it has to have this directory writeable so that it is able to place the ip-to-country db there.

  6. Ghosty,
    Chmodded through web shell. also checked via ftp once I manually created it there.

    I am beginning to think this is a problem due to a shared ip service (thus the /////). I am running 5 sites from here all without a dedicated ip and to date, have had no problems with it.

    It would be nice to get this sorted as all 5 sites are running through the same slimstat database and the more accurate information the better.

    Since I do not have the time to troubleshoot in the next couple of weeks so I will park it for now.

    Later I will changed to a dedicated IP and see if that will make a difference.

    Many thanks!
    Wayne (IntroToTech in the Google Groups)

  7. GravatarBoris

    First of all many thanks for all your plugins. Installed them all with no problems.
    When I had a look through your site I noticed a plugin called page rank on one of the screenshots. I googled for it but didn’t come up with anything. Could you point me in the right direction?
    Cheers, Bo

  8. Sharp eye there! It’s actually a plugin I’m still researching/working on. However there is no Google API for PageRank and I’ve discovered that many of the sites that offer pagerank info are actually violating Google Terms Of Service. New plugins will continue to be announced here and in the Google Groups forum. Cheers!

  9. GravatarXIN

    if someone has problems with updating

    – temporary CHMOD dir “countrydb” to 777
    – run plugin and update
    – and after update change back to previous…

    it worked for me.

  10. GravatarMatthew

    I think also if your hosting server is Windows-based you may have some troubles (ie with the CHMOD commands etc)

    My hosting server is Windows-based and I’m having alot of trouble getting this plugin to work


  11. Hi

    Many thanks for sharing your work.
    I’ll probably come across as a complete idiot so I’ll apologise in advance. I’ve installed some of your other plugins for Slimstat – like the city plugin for example and all work without a problem. This one however, gives a “Couldnt connect to host” message after about 30 secs. The countrydb folder is created and I’ve tried chmodding to 777 but no joy. I suspect a database problem combined with my lack of knowledge in this area.

    Any help would be appreciated

  12. I’m assuming you have the base slimstat program working properly? since this script connects to the server it may be a problem with it retrieving the file. if you’re able to post a more detailed error message I may be able to help. Posting it in the google group may also garner some responses from other users as well.

Reply to “CountryUpdate My First Plugin For SlimStat”

Strangely Interesting

  • Check this out. Someone took the time to draw a pic of Homer Simpson purely in CSS.

  • Not feeling safe at night? How about a table that turns into a shield and bat?

  • Seeing as I will most likely never climb Everest, this will have to do.  Someone has kindly created this 360 Degree panorama of the view from the top.


Some other random sites of mine

Sponsored Links