Home | Scripts | Tutorials | Books | Hosting | Forums | Links|

Navigation:

Home
Source code
Tutorials
RSS feeds
Articles
Wordpress plugins
Books
Sample Chapters
Software
Downloads
Hosting
manuals
Script directory
Training
Our Links






 
 

SPONSORS



 
 

Log IP addresses

submitted by anon

This example shows how to log IP addresses into a MySQL database

<?php

$remoteIP=$REMOTE_ADDR;
$date = date("Y-m-d"); // or change to your liking

$connect = mysql_connect("localhost", "root","password") or die ("Unable to connect to server.<br>");
mysql_select_db ("ipaddress") or die ("Unable to connect to select database.<br>");
mysql_query ("INSERT INTO ipaddress (IP, date) VALUES ('$remoteIP', '$date')") or die ("Unable to connect to insert values into database.<br>");
mysql_close($connect);

?>