
|
View Full Version : what is my ip address tool
Ferman 03-04-2005, 01:38 PM | Hi,
if you are running a phpbb board, here is a useful hack to give a whatismyip dot com like service
search at phpbbhacks dot com website
"what is my ip address"
Regards,
Ferman |
HostingInsider 03-04-2005, 03:08 PM Or just use PHP, so much easier, just a line of code.... |
PinkFloydWS 03-04-2005, 03:36 PM | <b>IP Address is:</b></h2><H1>
<?php
//Obtain IP Address
$ipaddr = getenv("REMOTE_ADDR");
echo $ipaddr;
?> |
Georgecooldude 03-04-2005, 07:23 PM start, run, cmd, "ipconfig /all"
Or
start, run, cmd, "ipconfig /all >C:\Documents and Settings\%username%\desktop\MY IP.txt"
The file will appear on your desktop as a text file :) |
error404 03-04-2005, 07:42 PM Originally posted by RealtorHost
<b>IP Address is:</b></h2><H1>
<?php
//Obtain IP Address
$ipaddr = getenv("REMOTE_ADDR");
echo $ipaddr;
?>
Or...
<h2><strong>IP Address is: </strong></h2><h1><?= $_SERVER['REMOTE_ADDR'] ?></h1> |
HostingInsider 03-06-2005, 02:19 AM Originally posted by Georgecooldude
start, run, cmd, "ipconfig /all"
Or
start, run, cmd, "ipconfig /all >C:\Documents and Settings\%username%\desktop\MY IP.txt"
The file will appear on your desktop as a text file :)
We're talking about displaying it on websites.... |
mfonda 03-07-2005, 02:50 PM The PHP super global $_SERVER['REMOTE_ADDR'] contains a visitors IP address, so it is very easy just to use it. Works very well. |
Fisher R 03-07-2005, 03:08 PM REMOTE_ADDR will work unless the visitor's ISP puts them behind a proxy. If that's the case you might have to use HTTP_X_FORWARDED_FOR to get their true IP. |
Ferman 03-07-2005, 03:46 PM Originally posted by Fisher R
REMOTE_ADDR will work unless the visitor's ISP puts them behind a proxy. If that's the case you might have to use HTTP_X_FORWARDED_FOR to get their true IP.
in that case, what is the full code to check it? |
Fisher R 03-07-2005, 10:29 PM If a user isn't behind a proxy I don't think you get anything from HTTP_X_FORWARDED_FOR so it might be best to do something like:
if there is an HTTP_X_FORWARDED_FOR
echo HTTP_X_FORWARDED_FOR
else echo REMOTE_ADDR
Maybe someone can put that into PHP code for you. |
w3needs 03-07-2005, 11:40 PM This covers all bases:
function GetUserIP()
{
if (isset($_SERVER))
{
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
{
$ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
}
elseif(isset($_SERVER["HTTP_CLIENT_IP"]))
{
$ip = $_SERVER["HTTP_CLIENT_IP"];
} else
{
$ip = $_SERVER["REMOTE_ADDR"];
}
}
else
{
if ( getenv( 'HTTP_X_FORWARDED_FOR' ) )
{
$ip = getenv( 'HTTP_X_FORWARDED_FOR' );
}
elseif ( getenv( 'HTTP_CLIENT_IP' ) )
{
$ip = getenv( 'HTTP_CLIENT_IP' );
}
else
{
$ip = getenv( 'REMOTE_ADDR' );
}
}
return $ip;
}
Hope it helps!
Jim |
|