473,609 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Php: getting local IP

Jezternz
145 New Member
Easy to get the external ip adress, using the $SERVER var, but I want the local ip.
My situation isnt normal by the way. Basicly im building simple intranet ( i want to run this on a local area network (will be hundreds of people) not on the web, so for logins im gonna be using local ip's, is there any way I can get them easily?
$HTTP_SERVER_VA RS['HTTP_X_FORWARD ED_FOR'] <- people have said this would work.. but would it actually work in a lan invroment, im not so sure.

Thanks, Josh
Jun 7 '08 #1
3 2754
Atli
5,058 Recognized Expert Expert
Hi.

Even when connecting from a LAN, "$_SERVER['REMOTE_ADDR']" should give you the local IP of the computer that sent the request.

I doubt "$HTTP_SERVER_V ARS['HTTP_X_FORWARD ED_FOR']" works, as it is on of a few non-standard headers, sent by some proxy servers in an attempt to reveal the actual IP of users trying to hide their identity by going through a proxy.
Jun 7 '08 #2
Jezternz
145 New Member
oh ok cool thanks heaps.
So how do you tell pc's apart on the internt if they are shareing the same internet connection? I remember having this problem at school, you log in on one pc, and it logs in on all pcs, because all the pc's had the same external ip? is there any way of getting local ips in that example?

cheers, Josh
Jun 7 '08 #3
Atli
5,058 Recognized Expert Expert
When you connect to the internet via a router, the router is essentially working as a proxy server. It makes the request for you and redirects any response to you.

As such, there is really no way to differentiate between the local machines, as the IP will just point back to the router.
Unless it explicitly set a header with the local IP address, which I find unlikely due to security reasons.
Not to mention that a local IP address is useless to anybody outside the LAN.

If you want to find out, just do a "print_r($_SERV ER)" and see if your local IP is in there somewhere. You would obviously have to try this from a remote computer.
Jun 7 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2702
by: Patrick Saunders | last post by:
I have been trying to GD working on HPUX for about, oh 2 months now, and have come across something that was interesting. I have this configuration: HPUX 11 Bundled Apache 2.0/PHP 4.3.4 Basically, the reason GD is so hard to get to work, is that it has hard coded dependencies on libraries.
4
1630
by: petermichaux | last post by:
Hi, I have installed PHP 5.0.3 for OS X. I have read in several places that PEAR is included in recent installations of PHP. I'm having trouble getting PEAR DB working. How would I know or test to see if it was included in my installation? Just in case it helps I've attached the phpinfo() configure line below Thanks,
8
6282
by: lawrence k | last post by:
I've installed Apache 1.3.36 on my Redhat EL 3 machine. Now I'm trying to install PHP 5.1.4. I can not get the ./configure command to work. I keep getting this error: configure: error: Invalid Apache directory - unable to find httpd.h under /usr/local/apache/include So then I run this command: find / -name httpd.h
1
12346
by: browntown | last post by:
I'm trying to install the Image_Color pear package. I keep getting the following error: "'gd' PHP extension is not installed" phpinfo on my web server indicates that gd is enabled. when I try to get info from my command line interface I don't see anything where it was compiled with gd. Am I right in assuming there are two ini files? One for the command
3
5607
by: sunbeam | last post by:
Short Description of the Project: we developed a e-learning system for our students. each student has a unique username/password to view the modules he/she should view and nothing more. since we want to give them the opportunity to run these modules from home as well, we are trying to get the USERNAME/COMPUTERNAME as well, so the students, when they sign up for the modules, they can ONLY run the modules fromhome PC. We found a nice...
0
8067
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8215
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8398
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5509
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4015
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2529
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.