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
Printable View
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
Grr posted the wrong code hold on
And you would need to code in
try looking at http://www.w3schools.com/PHP/php_mysql_create.asp for more help I learned some stuff that helped meCode:$ip = $_SERVER["REMOTE_ADDR"];
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?
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.
I only wanted the IP recorded. Just so I can track visiting IP's.
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.