NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Record an IP address?

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 05-08-2006, 08:52 AM THREAD STARTER               #1 (permalink)
Senior Member
 
Ringr's Avatar
Join Date: Jul 2004
Posts: 1,383
Ringr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to behold
 



Record an IP address?


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
Ringr is offline  
Old 05-08-2006, 09:01 AM   #2 (permalink)
JFS
NamePros Regular
 
JFS's Avatar
Join Date: Oct 2005
Location: Portugal
Posts: 800
JFS is a name known to allJFS is a name known to allJFS is a name known to allJFS is a name known to allJFS is a name known to allJFS is a name known to allJFS is a name known to allJFS is a name known to all
 



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
__________________
Joćo Fernandes Silva
Last edited by JFS; 05-08-2006 at 09:08 AM.
JFS is offline  
Old 05-08-2006, 09:06 AM   #3 (permalink)
NamePros Member
Join Date: May 2006
Posts: 43
thedeamone is an unknown quantity at this point
 



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,
thedeamone is offline  
Old 05-08-2006, 01:11 PM THREAD STARTER               #4 (permalink)
Senior Member
 
Ringr's Avatar
Join Date: Jul 2004
Posts: 1,383
Ringr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to behold
 



@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.
Ringr is offline  
Old 05-08-2006, 01:59 PM   #5 (permalink)
NamePros Member
Join Date: Apr 2006
Location: Central PA
Posts: 101
NonProphet is on a distinguished road
 



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.
NonProphet is offline  
Old 05-08-2006, 02:04 PM   #6 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
PHP Code:
<?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');
????: NamePros.com http://www.namepros.com/programming/195172-record-an-ip-address.html
  
fwrite($resourcedate('Y/m/d h:i:s').' - visited - '.$visitor."\r\n");
  
fclose($resource);
}

?>
Eric is offline  
Old 05-08-2006, 04:27 PM   #7 (permalink)
Senior Member
 
nasaboy007's Avatar
Join Date: Jul 2005
Location: NJ
Posts: 1,219
nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of
 



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 Code:
<?php

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

if(
$ip == $visitor
????: NamePros.com http://www.namepros.com/showthread.php?t=195172

  
$resource fopen('log.txt''a'); 
  
fwrite($resourcedate('Y/m/d h:i:s').' - visited - '.$visitor."\r\n"); 
  
fclose($resource); 


?>
^^ thnx SV
nasaboy007 is offline  
Old 05-08-2006, 06:01 PM   #8 (permalink)
NamePros Member
Join Date: Apr 2006
Location: Central PA
Posts: 101
NonProphet is on a distinguished road
 



Originally Posted by nasaboy007
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 Code:
<?php
????: NamePros.com http://www.namepros.com/showthread.php?t=195172

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

if(
$ip == $visitor

  
$resource fopen('log.txt''a'); 
  
fwrite($resourcedate('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.
NonProphet is offline  
Old 05-13-2006, 11:01 AM THREAD STARTER               #9 (permalink)
Senior Member
 
Ringr's Avatar
Join Date: Jul 2004
Posts: 1,383
Ringr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to beholdRingr is a splendid one to behold
 



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!
Ringr is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 03:33 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger