NameSilo

Record an IP address?

Spaceship Spaceship
Watch

Ringr

VIP Member
Impact
45
Is there any way I can record an IP address every time it visits my site and have it log it? Like I wanted to monitor one IP address, and everytime it came on have it record a log of "[Name] visited on May 8, 2006 at 12:06pm CST", and then for everytime they visit, it just keeps adding to the list?

Thank you in advance,
Andy
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
.US domains.US domains
something like this?
Code:
<?php
$resource = fopen("log.txt","a");
  fwrite($resource,date("Y"."/"."m"."/"."d h:i:s")." - visited - $_SERVER[REMOTE_ADDR]\n");
  fclose($resource);
?>
this produces something like:
date server time remote ip
2005/10/13 11:50:20 - visited - 193.136.77.119

this is the basic, it records to a text file
 
Last edited:
1
•••
Hi,

By default exoops hasn't built-in this feature.

But exoops has the code that stores the user ip.

Each message of newbb has ip recorded only visible to moderators, each broken file report, broken file download has this feature.

Look at mydownloads, mylinks, newbb modules.

The store of IP is to help moderators, not used to geoip.

Thanks,
 
0
•••
@JFS: that's kind of what I'm looking for, but how can I make it so it's one specific IP address that is logged, and not all IP addresses that come to my site? Thank you.
 
0
•••
Code:
<?php
$visitor = $_SERVER[REMOTE_ADDR];
$ip = 'PERSONS IP ADDRESS';
if($ip == $visitor)
{
$resource = fopen("log.txt","a");
  fwrite($resource,date("Y"."/"."m"."/"."d h:i:s")." - visited - $_SERVER[REMOTE_ADDR]\n");
  fclose($resource);
}
?>

You could do it with less variables and make it neater, but im feelin lazy at the moment. :hehe:
 
1
•••
PHP:
<?php

$visitor = (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
$ip = 'PERSONS IP ADDRESS';

if($ip == $visitor)
{
  $resource = fopen('log.txt', 'a');
  fwrite($resource, date('Y/m/d h:i:s').' - visited - '.$visitor."\r\n");
  fclose($resource);
}

?>
 
1
•••
yeah secondversions is probably the best bet. i just simplified it a lil, incase u dont need those other vars he had in the first line.
PHP:
<?php

$visitor = $_SERVER['REMOTE_ADDR']; 
$ip = "PERSONS IP ADDRESS"; 

if($ip == $visitor) 
{ 
  $resource = fopen('log.txt', 'a'); 
  fwrite($resource, date('Y/m/d h:i:s').' - visited - '.$visitor."\r\n"); 
  fclose($resource); 
} 

?>
^^ thnx SV
 
0
•••
nasaboy007 said:
yeah secondversions is probably the best bet. i just simplified it a lil, incase u dont need those other vars he had in the first line.
PHP:
<?php

$visitor = $_SERVER['REMOTE_ADDR']; 
$ip = "PERSONS IP ADDRESS"; 

if($ip == $visitor) 
{ 
  $resource = fopen('log.txt', 'a'); 
  fwrite($resource, date('Y/m/d h:i:s').' - visited - '.$visitor."\r\n"); 
  fclose($resource); 
} 

?>
^^ thnx SV


-thats the exact same thing I posted above SV's post.
:hehe:
 
0
•••
Whoops, sorry I forgot about this topic. Thank you all for your efforts and for the coding. I will be putting it in use shortly. Thanks again, I really appreciate it! :)
 
0
•••

We're social

Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back