homepage Welcome to WebmasterWorld Guest from 54.198.148.191
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Tracking IP address Public or Private
Tracking IP address Public or Private
ravi




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

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

 

janharders




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

Exactly what do you mean with public and private IP adress?

ravi




msg:3706171
 12:17 pm on Jul 24, 2008 (gmt 0)

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.

janharders




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

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.

ravi




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

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

JamieBrown




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved