• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net

IP Logger Please (basic one)

Anayet

New Member
Hi there.
I am looking for a IP Logging script - but the ones i have come across have too much things in them to configure as they usually have more features.

I am looking for a very very basic script that will log an IP adress of someone that visits a certain page, and what time/day they visited.

Does anyone know of one thats very basic?


Thanks in advance:)
 
PHP:
[i]add.php[/i]
<? 
$open = fopen( "stats.txt", "a" ) or die ( "Operation Failed!" );
while ( ! feof( $open )
fputs( $open, "$REMOTE_ADDR\n" );
fclose( $open );
?>
ez

use this in all of your pages

Your pages
PHP:
<?
include( "add.php" );
?>
 
Here, I made another logger just for you

PHP:
[i]iplogger.php[/i]
<?
$file = "stats.txt";
$open = fopen( $file, "a" ) or die ( "Operation Failed!" );
fputs( $open, "<tr><td><font size=1 face=\"Verdana\">$HTTP_USER_AGENT</font></td><td><font size=1 face=\"Verdana\">$REMOTE_ADDR</font></td><td><font size=1 face=\"Verdana\">$HTTP_REFERER</font></td>\n" );
fclose( $open );
?>
PHP:
[i]view_stats.php[/i]
<html><head><title>View Stats</title>
</style>
<!--
.tabletext {
text-size:11;
font-family:Verdana;
}
-->
</style>
</head>
<body bgcolor=#e8e8e8>
<center>
<table cellpadding=2 bgcolor=white border=0 style="border:1px solid black">
<tr><th width=200><font size=2 face="Verdana">Browser</font></th><th width=100><font size=2 face="Verdana">IP Address</font></th><th width=200><font size=2 face="Verdana">Reffer Address</font></th>
<tr>
<?php
// Declare file
$file = "stats.txt";

// Open and check file
$open = fopen( $file, "r" ) or die ( "Operation Failed!" );

// For each line..
while ( ! feof( $open ) ) {

// Seperate Values
$line = fgets( $open, 1024 );
print $line;
}
fclose( $open );
?>
</table>
<br><font face="Verdana" size=1>Powered by IP Logger 1.0</font>
</body></html>

PHP:
[i]stats.txt[/i]
Code:
README.txt

Kalibers IP Logger
------------------

++License
This script is provided free of charge to anyone under the GNU General Public License ([url]http://www.gnu.org/licenses/gpl.html[/url]) which basicly means you can use it but you must keep all the files together (including this one).

++Features
This is a very simple script, all it does it track the IP address, the browser and the Refferring web page.

++How to use
To use this script upload all files to your web server, you will need PHP. CHMOD stats.txt to 777 (full properties). include the iplogger.php file in all your pages you want to track, use this code at the top of your page (the page must have a .php extension).

==============

<?php
include("iplogger.php");
?>

==============

NOTE: Make sure the logger files are in the same directory as the home page, other wise you may want to create its own directory and have a code something like this, assuming the directory is called logger

==============
<?php
include("/logger/iplogger.php");
?>
==============

And thats all there is to it, simple eh?




++Contact
[email]stuck_in_a_cave@hotmail.com[/email] is my email and MSNM

there.. stupid FWS.net won't let me upload .zips
 
Hi, thanks for the help, thats exactly what i need:)


Would i be pushing it if asked how i'd log the date with each IP address:eek:


Thanks again
 
Just replace these files, have fun :)
PHP:
[i]new iplogger.php[/i]
<?
$file = "stats.txt";
$date = date("D d M Y");
$open = fopen( $file, "a" ) or die ( "Operation Failed!" );
fputs( $open, "<tr><td><font size=1 face=\"Verdana\">$HTTP_USER_AGENT</font></td><td><font size=1 

face=\"Verdana\">$REMOTE_ADDR</font></td><td><font size=1 face=\"Verdana\">$HTTP_REFERER</font></td><td><font size=1 

face=\"Verdana\"><Center>$date</center></font></td>\n" );
fclose( $open );
?>

PHP:
[i]new view_ip.php[/i]
<html><head><title>View Stats</title>
</style>
<!--
.tabletext {
text-size:11;
font-family:Verdana;
}
-->
</style>
</head>
<body bgcolor=#e8e8e8>
<center>
<table cellpadding=2 bgcolor=white border=0 style="border:1px solid black">
<tr><th width=200><font size=2 face="Verdana">Browser</font></th><th width=100><font size=2 face="Verdana">IP Address</font></th><th width=200><font size=2 face="Verdana">Reffer Address</font></th><th width=200><font size=2 face="Verdana">Date</font></th>
<tr>
<?php
// Declare file
$file = "stats.txt";

// Open and check file
$open = fopen( $file, "r" ) or die ( "Operation Failed!" );

// For each line..
while ( ! feof( $open ) ) {

// Seperate Values
$line = fgets( $open, 1024 );
print $line;
}
fclose( $open );
?>
</table>
<br><font face="Verdana" size=1>Powered by IP Logger 1.0</font>
</body></html>
 
Back
Top