I am trying to use the time and IP address to generate unique ID for users as they register for the site. The DB I'm using is MySQL
and it comes with auto increment, but it doesn't seem like a practical technique for this. I am having issues with $_SERVER['REMOTE_ADDR']
returning an unreadable address. I'm getting symbols for the value in the firebug console. I tried using inet_ntop
and inet_pton
, neither worked.
$ip_address = $_SERVER['REMOTE_ADDR'];
$test = inet_ntop($ip_address);
echo($test);
Why am I getting symbols instead of readable text?
EDIT:
What I want to store is a combination of the IP and time. I need the IP to show in format of "79.104.97.105" -Niet the Dark Absol, but what I'm getting is ��������������� if I use use inet_ntop or inet_pton or ::1 if I use just $_SERVER['REMOTE_ADDR'].
Two part question: 1) Am I getting the IP address as IPv6 if it returns ::1, 2) How do I convert to 127.0.0.1 which I think is IPv4