IP Logger

By KuruptUK on May 18, 2005

With this PHP IP Logging Snippet, it allows you to LOG the visitors IP address's which visit your website, and all you have to do is the following:

<?php

$v_ip = $REMOTE_ADDR;
$v_date = date("l d F H:i:s");

$fp = fopen("ips.txt", "a");
fputs($fp, "IP: $v_ip - DATE: $v_date\n\n");
fclose($fp);

?>

Comments

Sign in to comment.
Jonesy44   -  Aug 14, 2008

Good if your host doesn\'t supply SQL. But not very usefull if you want to display the data + it isn\'t very secure. but good work anyways. I like the use of sockets in PHP :] 6/10

 Respond  
SweeTCooL   -  Aug 14, 2008

hmm nice

 Respond  
Hawkee   -  May 25, 2005

A more elegant solution to this would be to create a database table and insert each IP address into a mySQL table.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.