Gearoid Corcoran . com

This site is dedicated to the work I do.

favicon.ico

I wanted to add that little picture up in the address bar to my site. After a bit of research I found that it is called favicon.ico

To add this icon I created a picture in mspaint and shrunk it down. I then saved it as favicon.ico and placed in the main directory (I’m guessing that it can be placed in the images directory)

The following lines must be added to the header section in the page:

link rel=”shortcut icon” href=”http://example.com/favicon.ico” type=”image/x-icon”

link rel=”icon” href=”http://example.com/favicon.ico” type=”image/x-icon”

And bob’s your uncle! It adds another touch of professionalism to the page.

March 1st, 2007 Posted by Gary Corcoran | | no comments

phpMyAdmin

I always seem to have problems installing this great tool. Basically I have to remember a number of key steps:

1 - Upload phpMyAdmin

2 - Within phpMyAdmin folder create directory config with 777 access

3 - Within config directory create the file config.inc.php with 777 access

4 - Run /phpMyAdmin/scripts/setup.php

5 - When details have been put in, click on the SAVE button

6 - Copy the config.inc.php file into the main directory changing the 777 access

7 - Remove the config directory

The tool should then be up and running.

March 1st, 2007 Posted by Gary Corcoran | | no comments

GeoIP: Getting the location of users via IP addresses

Since I have the locations of most of the oubs throughout Ireland Rate My Pub it would be interesting to be able to show the user where the nearest pub no him is. That is to scan his IP number get the longitude and latitude of this location and calculate the nearest pubs too him.

There are a number of solutions to this problem, the first I saw was hostip.info, which was ok at finding countires but since I am only dealing with one country I needed something with more detail. I needed something with a larger database of IP locations.

Two sites were recommended maxmind.com and ipligence.com, since maxmind offers a “lite” version for free I decided to use this model. The process is simple the GeoLiteCity.dat, and the geoipcity.inc file need to be downloaded from maxmind.com and uploaded to your server. The following code can then be used to calculate data:

include(”geoipcity.inc”);
$gi = geoip_open(”GeoLiteCity.dat”,GEOIP_STANDARD);
$record = geoip_record_by_addr($gi,”159.215.236.21″);
print $record->city . “\n”;
print $record->country_code . ” ” . $record->country_code3 . ” ” . $record->country_name . “\n”;
print $record->region . ” ” . $GEOIP_REGION_NAME[$record->country_code][$record->region] . “\n”;
print $record->postal_code . “\n”;
print $record->latitude . “\n”;
print $record->longitude . “\n”;
print $record->dma_code . “\n”;
print $record->area_code . “\n”;
geoip_close($gi);
?>

Combining this code with the users IP address should give the langitude and latitude of the users location. This Lite version will be tested before a decision about purchasing the full version will be made.

March 1st, 2007 Posted by Gary Corcoran | | no comments