Top

IP Logger


PHP Code
+ 1 likes
Please Register to submit score.
Bookmark and Share
Average Score  4.7 (of 3 scores)
Date Added  May 18, 2005
Last Updated  Sep 04, 2008

Introduction

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:
- Create A TXT File Called (ips.txt)
- Upload It To Your Server
- CHMOD The (ips.txt) File To *777*
- The IP's Will Then Be Logged At (http://www.yourdomain.com/ips.txt)

Grab the Code

<?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

  (3)  RSS
Hawkee
Comments: 1,035
 
PHP Snippet:  IP Logger
Posted on May 25, 2005 4:17 am
A more elegant solution to this would be to create a database table and insert each IP address into a mySQL table.
SweeTCooL
Comments: 18
 
PHP Snippet:  IP Logger
Posted on Aug 14, 2008 3:46 am
hmm nice
jonesy44
Comments: 1,853
 
PHP Snippet:  IP Logger
Posted on Aug 14, 2008 8:44 am
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

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom