|
-
Jul 9th, 2008, 01:40 PM
#1
Thread Starter
Lively Member
Recording IP's
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
-
Jul 9th, 2008, 03:15 PM
#2
Lively Member
Re: Recording IP's
Grr posted the wrong code hold on
And you would need to code in
Code:
$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
-
Jul 9th, 2008, 03:16 PM
#3
Thread Starter
Lively Member
Re: Recording IP's
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?
Last edited by syrillia; Jul 9th, 2008 at 05:03 PM.
-
Jul 10th, 2008, 11:40 AM
#4
Re: Recording IP's
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.
-
Jul 10th, 2008, 11:43 AM
#5
Thread Starter
Lively Member
Re: Recording IP's
I only wanted the IP recorded. Just so I can track visiting IP's.
-
Jul 12th, 2008, 02:00 AM
#6
Re: Recording 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.
My usual boring signature: Something
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|