Jump to content

how to get an ip in wan


sanprince

Recommended Posts

I have created a form in php whch can be obtained from different locations in a WAN network. and the data submitted in a mysql database which is then displayed in output.For eg:- systems in diff. ip range -- (192.168.10.xxx , 192.168.20.xxx, 192.168.30.xx ..etc) is it possible to get from which exat ip or atleast from which range the form is submitted"thanks

Link to comment
Share on other sites

Do those networks have access to each other? If 192.168.10.xxx types 192.168.20.xxx, assuming there's a web server at the 192.168.20.xxx IP, would it get to see the web page? Or is each subnet guarded by a different public IP?If each subnet is guarded by a different public IP, there's no way to get the private IP. If your server is at one of those private IP ranges (say, 192.168.20.xxx), you can detect if the client is someone from the same range by checking their public IP. If it's the same as yours, then they are someone from your private range, though there's no way to find out which one from the range they are.If those subnets have direct access to each other, then you should be able to use PHP's $_SERVER['REMOTE_ADDR'] to get the private IP of people within the ranges.

Link to comment
Share on other sites

Do those networks have access to each other? If 192.168.10.xxx types 192.168.20.xxx, assuming there's a web server at the 192.168.20.xxx IP, would it get to see the web page? Or is each subnet guarded by a different public IP?..............................................If those subnets have direct access to each other, then you should be able to use PHP's $_SERVER['REMOTE_ADDR'] to get the private IP of people within the ranges.
thank you for your reply... let me give u the scenario at present -- there are 3 offices - A, B and C with 10 computers each and having ip's as 192.168.10.xxx, 192.168.20.xxx, 192.168.30.xxx respectively.in one of the systems at office a i have installed xammp, and created a simple form with an option of drop down box to select the name of office (A,B,C) . when the user submits the form in database the respective data is stored in the table. but sometimes the user forgets to change the name of the office in the drop down(i.e A,b,C) and enters the data is the wrong office options.so as a solution for this if I am able to print out from which ip or ip range the following data was submitted i could correct the mistakes. all the systems in the WAN, i.e those different ip range systems are able to access the webpage.IF i could get the exact ip of the machine then it was really helpful then it would be easier to track the exact user, OR ELSE at least getting the ip range too would be very useful.
Link to comment
Share on other sites

"In the WAN" is too abstract of a term.... what do you get with $_SERVER['REMOTE_ADDR'] from each office's computer(s)? Try it with 2 of each office, and see what you get. If it's the exact IP (it should be, if I understand you correctly), you're set.If you don't have direct access yourself, log this value in a file or something, and ask some people in the different offices to just open the page (so that you log their IP).

Link to comment
Share on other sites

Like any other string that's about to enter MySQL:

$ip = mysql_real_escape_string($_SERVER['REMOTE_ADDR']);$query = "INSERT INTO iplist (ip) VALUES ('$ip')";

(This example of course assumes you have a table called "iplist" with a column of type VARCHAR that is called "ip". Alter accordingly.)

Link to comment
Share on other sites

Told you so... "from the WAN" is a very abstract term in your case.Is it separate networks, separate subnets where your server is accessible with the public IP, or separate subnets where your server is accessible with its private IP?In the first case, $_SERVER['REMOTE_ADDR'] should give you the public IP of the network (the ones on "LAN Card 1"... the 12* ones).In the second case, you'll only get the public IP of your network (the only one in the picture).In the third case, you'll get the private IP of the computers on the local network (all but the one public IP on the picture).If you're currently in the second case, as it appears to be the case, you need to either:1. Get a router that supports DNS if yours doesn't, and add your server's private IP to it (as in the third case).2. Add your private IP to your public DNS entry. In this case, your site will not be accessible outside the intranet.3. Force users to access the site by typing your private IP address.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...