View previous topic :: View next topic |
Author |
Message |
Mecctro_ -
Joined: 09 Mar 2006 Posts: 18
|
Posted: Mon May 08, 2006 2:54 am Post subject: Display servers current ip in page... possible? |
|
|
Is there a script that can display the current ip adress of the server that changes cuz i have dynamic ip?
thnx for your help. |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Mon May 08, 2006 3:10 am Post subject: |
|
|
You can only view the correct IP if you're not in the same network. You should
use Dynamic IP Update client in order to update your IP when it changes. A few
of the DNS services that offer this, are listed below.
http://www.no-ip.com
http://www.dyndns.org |
|
Back to top |
|
 |
Mecctro_ -
Joined: 09 Mar 2006 Posts: 18
|
Posted: Mon May 08, 2006 3:42 am Post subject: |
|
|
sorry I think I need to correctly specify....
I need a webpage to display my servers current ip adress so that people on the internet can view it.
I dont know if there is a way that i can use a tool similar to the no-ip updater tool to make a webpage do this but if i could it would be greatly appreciated.
Hopefully you understand what exactly im asking for... i dont need a dns updater i need a webpage.
Thak you in advance
Mecctro |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Mon May 08, 2006 10:04 am Post subject: |
|
|
The SERVER_ADDR environment variable holds the address of the server machine. Try that. _________________
 |
|
Back to top |
 |
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Mon May 08, 2006 10:36 am Post subject: |
|
|
MonkeyNation wrote: | The SERVER_ADDR environment variable holds the address of the server machine. Try that. |
This Environment variable doesn't exist (Tested with PHP). :/
Code: | <?php
echo $_SERVER['SERVER_ADDR'];
?>
|
Last edited by TRUSTAbyss on Mon May 08, 2006 10:45 am; edited 1 time in total |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Mon May 08, 2006 10:44 am Post subject: |
|
|
TRUSTAbyss wrote: | This Environment variable doesn't exist (Tested with PHP). :/ |
Perhaps it isn't available in Abyss then, although I doubt it.
<?=$_SERVER['SERVER_ADDR']?> gives me 62.193.234.112. _________________
 |
|
Back to top |
 |
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Mon May 08, 2006 10:46 am Post subject: |
|
|
I tried mine using localhost, which didn't return 127.0.0.1 as the server IP. |
|
Back to top |
|
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Tue May 09, 2006 10:12 am Post subject: |
|
|
TRUSTAbyss wrote: | MonkeyNation wrote: | The SERVER_ADDR environment variable holds the address of the server machine. Try that. |
This Environment variable doesn't exist (Tested with PHP). :/
Code: | <?php
echo $_SERVER['SERVER_ADDR'];
?>
|
|
The information that should go in this variable is not very useful. First of all, your computer can have 2 or more IP addresses. To which IP SERVER_ADDR should be set?
Second, if you are behind a router, all you can get are your local and LAN IP addresses, which are useless for the outside visitors. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
abyssisthebest -
Joined: 30 Jun 2005 Posts: 319 Location: Boston, UK
|
Posted: Tue May 09, 2006 3:01 pm Post subject: |
|
|
what you could do is get a mate to host a script:
Code: |
<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo $ip;
?>
|
I think :D
Then all you need to do to get your IP is include("http://thedomain.com/script.php") this should then echo your IP _________________ My online Portfolio |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Tue May 09, 2006 3:21 pm Post subject: |
|
|
aprelium wrote: | The information that should go in this variable is not very useful. First of all, your computer can have 2 or more IP addresses. To which IP SERVER_ADDR should be set?
Second, if you are behind a router, all you can get are your local and LAN IP addresses, which are useless for the outside visitors. |
I've never looked through the apache httpd source code (Which I assume is the best idea.), but off the top of my head, resolve the HTTP_HOST header, if possible?
Likewise, you could do this in PHP by using gethostbyname($_SERVER['HTTP_HOST']). _________________
 |
|
Back to top |
 |
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Wed May 10, 2006 10:40 am Post subject: |
|
|
MonkeyNation wrote: | aprelium wrote: | The information that should go in this variable is not very useful. First of all, your computer can have 2 or more IP addresses. To which IP SERVER_ADDR should be set?
Second, if you are behind a router, all you can get are your local and LAN IP addresses, which are useless for the outside visitors. |
I've never looked through the apache httpd source code (Which I assume is the best idea.), but off the top of my head, resolve the HTTP_HOST header, if possible?
Likewise, you could do this in PHP by using gethostbyname($_SERVER['HTTP_HOST']). |
Apache fills this variable with the local IP address that was contacted to process the request. So it will contain your LAN IP if you're behind a router. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
Tom Chapman -
Joined: 09 Jul 2005 Posts: 933 Location: Australia
|
Posted: Wed May 10, 2006 10:49 am Post subject: |
|
|
What is all the trouble about?
It's really quite simple any of the methods that show a local IP will work for people outside of the Server's LAN, will they not? |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Wed May 10, 2006 5:44 pm Post subject: |
|
|
aprelium wrote: | Apache fills this variable with the local IP address that was contacted to process the request. So it will contain your LAN IP if you're behind a router. |
What, like the address of the network interface?
I haven't ever used this variable to my knowlage so I don't really know.
MrWiseOne: If my assumption is correct, then no, it will show the IP of the network adaptor, and will be of no use to most home users. _________________
 |
|
Back to top |
 |
 |
Tom Chapman -
Joined: 09 Jul 2005 Posts: 933 Location: Australia
|
Posted: Wed May 10, 2006 9:56 pm Post subject: |
|
|
I must not fully understand the parametres of this problem. May someone please restate them? |
|
Back to top |
|
 |
Anonymoose -
Joined: 09 Sep 2003 Posts: 2192
|
Posted: Wed May 10, 2006 10:27 pm Post subject: |
|
|
Problem : You are attempting to answer questions well beyond your skill and experience level.
Solution : Stop.
Clear enough? :roll: _________________
"Invent an idiot proof webserver and they'll invent a better idiot..." |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Wed May 10, 2006 10:40 pm Post subject: |
|
|
Anonymoose wrote: | Problem : You are attempting to answer questions well beyond your skill and experience level.
Solution : Stop.
Clear enough? :roll: |
I agree. If you have no feasable answer because you cant understand it, do not post to begin with. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Thu May 11, 2006 10:05 am Post subject: |
|
|
MonkeyNation wrote: | aprelium wrote: | Apache fills this variable with the local IP address that was contacted to process the request. So it will contain your LAN IP if you're behind a router. |
What, like the address of the network interface?
I haven't ever used this variable to my knowlage so I don't really know.
MrWiseOne: If my assumption is correct, then no, it will show the IP of the network adaptor, and will be of no use to most home users. |
Yes, it's the network interface IP address. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
Mecctro_ -
Joined: 09 Mar 2006 Posts: 18
|
Posted: Sun May 14, 2006 2:20 am Post subject: |
|
|
I need it to display the ip Outside of my network to ppl looking at my server as long as it does that i could care less if it works for me on this computer. |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Sun May 14, 2006 5:22 am Post subject: |
|
|
Code: | gethostbyname($_SERVER['HTTP_HOST']); # This work? |
_________________
 |
|
Back to top |
 |
 |
|