Click to See Complete Forum and Search --> : Recording IP's
syrillia
Jul 9th, 2008, 01:40 PM
I'm having a bit of a problem. I've been looking for a tutorial that will record my visitors IP addresses when they open up my page. But all the ones I find and try don't work. I'm using mySQL. Could anyone help me out?
Syrillia
BlackMagic
Jul 9th, 2008, 03:15 PM
Grr posted the wrong code hold on
And you would need to code in
$ip = $_SERVER["REMOTE_ADDR"];
try looking at http://www.w3schools.com/PHP/php_mysql_create.asp for more help I learned some stuff that helped me
syrillia
Jul 9th, 2008, 03:16 PM
I have this;
$ip = getenv('REMOTE_ADDR');
$query = "INSERT INTO iptable (ipaddress) VALUES ('$ip')";
mysql_query ($query)
or die ("Query failed: " . mysql_error() . " Actual query: " . $query);
How would I make it only record the IP adress once?
visualAd
Jul 10th, 2008, 11:40 AM
Its a little pointless recording only an IP address. If you wanted anything meaningful you should record the IP address and the time at the very least. If this is the case it might be better having a table of IP addresses and linking this to a table of additional information such as date/time, URI and action.
syrillia
Jul 10th, 2008, 11:43 AM
I only wanted the IP recorded. Just so I can track visiting IP's.
dclamp
Jul 12th, 2008, 02:00 AM
well if you are tracking IP's you are still going to want to know the time, so you know when they were visiting.
there is a link in my sig about MySQL Help, that should...help.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.