Welcome to WebmasterWorld Guest from 54.159.179.132

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Tracking IP address Public or Private

Tracking IP address Public or Private

   
5:31 am on Jul 24, 2008 (gmt 0)

5+ Year Member



Hi,

I would like to track the IP address Public one or Private One.I tried by using the $_SERVER["REMOTE_ADDR"].But i couldn't know how to track the IP address public one or Private One.

Can anyone help me to fix this issue?

by
ravi

7:59 am on Jul 24, 2008 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Exactly what do you mean with public and private IP adress?
12:17 pm on Jul 24, 2008 (gmt 0)

5+ Year Member



Thanks janharders,

I would like to track the IP address Public or Private one.

Because in the website one Person should register from one IP address only.

Suppose the person is registering from the Private(Browsing centers or from any other LAN),There is the chance to any other person to register from the same IP address so at that time registration will be denied for the user who have not already registered because of the IP locate at Private one.

So the IP address should be tracked Public or Private one.

12:33 pm on Jul 24, 2008 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



mh, if I understand correctly, private IP would be my local IP in my local LAN, e.g. 192.168.0.105 and what you refer to public IP is the IP I obtain from my ISP, right?

In that case, you can most likely only count on having *some* public IP. It might be the one the user actually uses on the internet, it might be a proxy on the web. If the user has a proxy on his LAN to connect to the internet, said proxy might (but doesn't have to!) share the local IP of the client requesting the page.
If he uses NAT to connect to the web, you're out of luck, there's no way of telling which client instructed the router to connect to your server.

12:49 pm on Jul 24, 2008 (gmt 0)

5+ Year Member



Thanks janharders,

I understand it janharders,after breaking my head i found something

The IP address between these ranges are private one(browsing ceneters,Organisations etc).

The following ones are Private one.


10.0.0.0 10.255.255.255
172.16.0.0 172.31.255.255
192.168.0.0 192.168.255.255

Except all of the above Public ones.

In PHP we can get the IP address by

<?php

echo "IP address".$_SERVER["REMOTE_ADDR"]

echo "LAN Address".$_SERVER["HTTP_X_FORWARDED_FOR"]
?>

This Will Show the Output in the following manner

IP address 122.164.71.238
LAN 192.168.2.18

If the IP address is between the above mentioned Classes it will be Private one otherwise it is Public One.

I didn't know this is reliable one or not.

Can you pls tell me.

Thanks
ravi

1:00 pm on Jul 24, 2008 (gmt 0)

5+ Year Member



Hi Ravi,

I would be very cautious with the way you're heading - the IP address (even a combination of the REMOTE_ADDR and HTTP_X_FORWARDED_FOR variables) will not uniquely identify anyone.

Many ISPs allocate dynamic IP addresses, so a users IP address changes every time they reset their router or dial in. Their old IP is then allocated to another user on the same ISP.

Also many private networks use DHCP so the IP address of a device on the internal network can change every time its started up.

Finally, many ISPs won't forward the HTTP_X_FORWARDED_FOR variable.

I think you're better using a simple username and password combination, and maybe only letting users use their e-mail address once?

Cheers,

Jamie.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month