Reputation: 73
I've never saved IP addresses in a database before, much less used a database with a live site. Right now when I preview my site in my browser, and do something which should collect my IP, it shows my IP address as "::1". I'm using XAMPP as my testing server. For what I'm doing it doesn't matter what format the ip addresses are in my database, as long as they're unique. When this site is live and it collects IP addresses from users will it show up as this or will it appear different? I'm very new (if you couldn't tell). I started looking into writing a bunch of code to convert ip addresses to a certain format, but like I said for what I'm doing format doesn't matter as long as it collects a unique address from each user. Thank you in advance for any advice.
$user = $_SERVER['REMOTE_ADDR'];
Database::ExecuteQuery("INSERT INTO `rating` (`item_name`, `rating`, `ip_address`, `date_rated`) VALUES ('{$varItem}', '{$varRating}', '{$user}', NOW())", "InsertRating");
Database::FetchResults("InsertRating");
Database::FreeResults("InsertRating");
Database::RemoveSavedResults("InsertRating");
Upvotes: 0
Views: 197
Reputation: 6879
::1 is localhost in IPv6 loopback address.
See http://en.wikipedia.org/wiki/Localhost.
Upvotes: 2