Professional Web Design, Breathing Life and Beauty back into your Website

Beautifying Your Website

Log IP to Database

Webmaster Community

I found this today,

I ran this query on my Wordpress database.

CREATE TABLE `ip` (
`id` int(5) NOT NULL auto_increment,
`ip` varchar(50) NOT NULL default ”,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;

And placed this php code in my footer.

<?php
$ip = $_SERVER['REMOTE_ADDR'];
$sql = “INSERT INTO `ip` ( `id` , `ip` ) VALUES ( ”, ‘$ip’)”;
$query = mysql_query($sql);

print “Logged: $ip”;
?>

I just like having IP’s logged in my database forever. Maybe you’ll find that handy.

2 Responses to “Log IP to Database”

  1. Technical Related Notes » Blog Archive » links for 2006-11-01 Says:

    [...] Wordpress Themes/Skins » Log IP to Database (tags: wordpress) [...]

  2. Lana Says:

    Dear Kalina,

    I love your web design. It is rich and vibrant.

    Lana

Leave a Reply