Log IP to Database
Thursday, June 1st, 2006I 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.


