Few IP related questions.

Dr.Jack

That's Cap'n to you!
Reaction score
108
Hello, I'm currently working on a site (only to get better with my programming, nothing fancy) and I'm having few problems. I got the basics down, HTML, PHP, etc. however I'm trying to find a way to interact with the user's computer. Now, I understand in order to do that I need to use IP addresses. I read a bit about them and I understand that each computer gets his own IP. Every IP address is unique and permanent(?), using it we can identify different computers.

Questions:

1) Is there anyway to get a computer's IP address and restore it using PHP or HTML?
2) Does networks or routers affect IP addresses? If so, how?
3) Are IP addresses really permanent? If not how can I deal with it, is there any way to trace the previous IP address?
4) What are local IP addresses exactly?

Any answer would be much appreciated.
 

enouwee

Non ex transverso sed deorsum
Reaction score
239
1) Is there anyway to get a computer's IP address and restore it using PHP or HTML?
Restore it? No. Get it? Use: $_SERVER['REMOTE_ADDR'] . But that IP may as well be a proxy server a few thousand other persons are using at the same time.

2) Does networks or routers affect IP addresses? If so, how?
Maybe you should find out what these things do? One possible starting point : http://en.wikipedia.org/wiki/IP

3) Are IP addresses really permanent? If not how can I deal with it, is there any way to trace the previous IP address?
No. Address ranges may change their owner.
There is no reliable way to identify addresses. You can store the information "pair" user login / IP address or use cookies (or similar) to help identify a returning visitor. But cookies may be cleared.

4) What are local IP addresses exactly?
IANA non routable address ranges (as well as their friends):
10.0.0.0/8 , 172.16.0.0/12 , 192.168.0.0/16
 

duyen

New Member
Reaction score
214
And if you want to echo "the person's" IP just use this:
PHP:
<?php
$var = $_SERVER['REMOTE_ADDR'];
echo $var;
?>

Probably a useless post but I like examples :p
 

Dr.Jack

That's Cap'n to you!
Reaction score
108
Thanks as lot for detailed answers, obviously I misunderstood a few details. :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top