Results from the most recent live auction are here .
21 members in the live chat room. Join Chat !
03-29-2005, 09:57 PM
· #1 NamePros Regular
Join Date: Dec 2004
Posts: 290
NP$: 38.45 (
Donate )
Another Way to Display the IP Address on a HTML Page
http://sendmyip.com/ipjava.htm
Source code for the about \/ \/ \/ \/
<script src="http://sendmyip.com/ipjs.php" </script></script>
<p><font face="Arial Narrow">Your IP is </font>
<SCRIPT LANGUAGE="JavaScript">
document.title = "Your IP is "+ip;
document.write(ip)
</script>
</p>
Last edited by 111111z : 04-08-2005 at 09:20 AM .
Reason: addition
04-16-2005, 06:11 PM
· #3 Senior Member
Location: UK
Join Date: Jun 2003
Posts: 3,758
NP$: 15.00 (
Donate )
And for anyone who wants the code for PHP....
PHP Code:
<?php
echo 'Your IP is: ' . $_SERVER [ 'REMOTE_ADDR' ];
?>
-or-
PHP Code:
<?php
echo 'Your IP is: ' . getenv ( 'REMOTE_ADDR' );
?>
06-03-2005, 03:50 AM
· #4 NamePros Member
Name: James
Location: Huddersfield, England
Join Date: May 2005
Posts: 179
NP$: 361.00 (
Donate )
very simple, but very affective
06-03-2005, 03:56 AM
· #5 NamePros Regular
Name: Peter
Location: England
Join Date: Apr 2005
Thanks! I may use that!
06-25-2005, 10:42 AM
· #6 A Wealth of Knowledge
Join Date: Aug 2004
Posts: 3,784
NP$: 17620.20 (
Donate )
I do appreciate this.
Javascript is good for client execution, but PHP is taking over....
Originally Posted by Scott And for anyone who wants the code for PHP....
PHP Code:
<?php
echo 'Your IP is: ' . $_SERVER [ 'REMOTE_ADDR' ];
?>
-or-
PHP Code:
<?php
echo 'Your IP is: ' . getenv ( 'REMOTE_ADDR' );
?>
-Steve
06-25-2005, 02:58 PM
· #7 NamePros Regular
Yeah, I believe PHP has the most popular it ever has been just after its 10th Birthday and it will always get bigger I think.
The Javascript is good for peps on geocities and stuff.
PJ
06-26-2005, 08:03 AM
· #8 Soon to be RICHdoggie!
Name: Tom
Location: UK
Join Date: Jan 2005
Posts: 2,390
NP$: 300.50 (
Donate )
PHP i the best, but that javascript was very handy!
thanks
06-29-2005, 01:24 AM
· #9 NamePros Member
Join Date: Oct 2003
Posts: 126
NP$: 182.00 (
Donate )
Just a note on using $_SERVER: Your server may not support that. I *always* use $HTTP_SERVER_VARS, $HTTP_POST_VARS, $HTTP_GET_VARS, etc.
06-29-2005, 05:06 AM
· #10 A Wealth of Knowledge
Join Date: Aug 2004
Posts: 3,784
NP$: 17620.20 (
Donate )
Originally Posted by EKukiela101 Just a note on using $_SERVER: Your server may not support that. I *always* use $HTTP_SERVER_VARS, $HTTP_POST_VARS, $HTTP_GET_VARS, etc.
this is a good point - depends on your version of php
-Steve
06-29-2005, 06:20 AM
· #11 Account Closed
Name: Hasif Ahmed
Location: NY, USA
Join Date: May 2005
Posts: 285
NP$: 45.00 (
Donate )
Originally Posted by 111111z http://sendmyip.com/ipjava.htm
Source code for the about \/ \/ \/ \/
<script src="http://sendmyip.com/ipjs.php" </script></script>
<p><font face="Arial Narrow">Your IP is </font>
<SCRIPT LANGUAGE="JavaScript">
document.title = "Your IP is "+ip;
document.write(ip)
</script>
</p>
thanx for the scripts.
06-29-2005, 06:23 AM
· #12 Soon to be RICHdoggie!
Name: Tom
Location: UK
Join Date: Jan 2005
Posts: 2,390
NP$: 300.50 (
Donate )
Originally Posted by EKukiela101 Just a note on using $_SERVER: Your server may not support that. I *always* use $HTTP_SERVER_VARS, $HTTP_POST_VARS, $HTTP_GET_VARS, etc.
very helpful. I knew about $_SERVER, but will learn the alternatives for when I script php for my clients!
Thanks
07-08-2005, 08:55 PM
· #13 NamePros Member
Join Date: Oct 2003
Posts: 126
NP$: 182.00 (
Donate )
$HTTP_SERVER_VARS
$HTTP_POST_VARS
$HTTP_GET_VARS
$HTTP_ENV_VARS
$HTTP_COOKIE_VARS
$HTTP_POST_FILES
$HTTP_SESSION_VARS
To use the same behavior as $_SERVER, $_POST, $_FILES, $_SESSION, $_GET, $_COOKIE, and $_ENV on older versions of PHP, you can use:
$GLOBALS['HTTP_SERVER_VARS']
$GLOBALS['HTTP_POST_VARS']
$GLOBALS['HTTP_GET_VARS']
$GLOBALS['HTTP_ENV_VARS']
$GLOBALS['HTTP_COOKIE_VARS']
$GLOBALS['HTTP_POST_FILES']
$GLOBALS['HTTP_SESSION_VARS']
The pre-defined variable list is available at:
http://us2.php.net/reserved.variables
08-20-2005, 11:43 PM
· #14 Senior Member
Name: Bharat Balegere
Location: Bangalore
Join Date: Jul 2005
Posts: 1,179
NP$: 10.25 (
Donate )
Thankx a lot for the code.
10-09-2005, 06:16 PM
· #15 NamePros Regular
Name: Pete
Location: U.S.A.
Join Date: Jul 2005
Posts: 648
NP$: 67.00 (
Donate )
Yeah nice JS script i use PHP though.
-Coolprogram
__________________
Your Link Here 10np$ a month Please PM me if you want theses spaces
' '
' '
ProTechGFX.com
10-17-2005, 07:40 PM
· #16 NamePros Member
Name: Ryan
Location: USA
Join Date: Oct 2005
Thanks for the hint on $server. I never knew that
__________________
Freelance Graphic Designer for Hire Portfolio
Contact info
here .
10-17-2005, 08:04 PM
· #17 NamePros Regular
Name: Christopher Cunningham
Location: Wisconsin
Join Date: Sep 2005
Posts: 445
NP$: 69.10 (
Donate )
Originally Posted by Scott And for anyone who wants the code for PHP....
PHP Code:
<?php
echo 'Your IP is: ' . $_SERVER [ 'REMOTE_ADDR' ];
?>
-or-
PHP Code:
<?php
echo 'Your IP is: ' . getenv ( 'REMOTE_ADDR' );
?>
dosnt work always if your behind a router...
__________________
Daily Domainer -
FREE real-time domain news and
commentary !
10-18-2005, 10:20 AM
· #18 Senior Member
Location: UK
Join Date: Jun 2003
Posts: 3,758
NP$: 15.00 (
Donate )
Originally Posted by 0xide dosnt work always if your behind a router...
It works fine if you're behind a router. It won't return the correct IP if you're behind a proxy, however neither will JS. The best you can try is $_SERVER['HTTP_X_FORWARDED_FOR'] and hope they're using a non-anonymous (transparent) proxy server.
That is unless you want to try circumventing the proxy by using a java applet.
-Scott
10-18-2005, 02:11 PM
· #19 Eating Pie
Name: Steve
Location: Canada
Join Date: Nov 2004
Posts: 2,282
NP$: 91.30 (
Donate )
Originally Posted by Scott It works fine if you're behind a router. It won't return the correct IP if you're behind a proxy, however neither will JS. The best you can try is $_SERVER['HTTP_X_FORWARDED_FOR'] and hope they're using a non-anonymous (transparent) proxy server.
That is unless you want to try circumventing the proxy by using a java applet.
-Scott
That is true.
Here is a function for this (off php.net)
PHP Code:
<?php
function getIP ( $ip ) {
if ( getenv ( "HTTP_CLIENT_IP" )) $ip = getenv ( "HTTP_CLIENT_IP" );
else if( getenv ( "HTTP_X_FORWARDED_FOR)) $ip = getenv(" HTTP_X_FORWARDED_FOR ");
else if(getenv(" REMOTE_ADDR ")) $ip = getenv(" REMOTE_ADDR ");
else $ip = " UNKNOWN ";
return $ip;
}
?>
Just call function getIP($ip);
And set IP with $_REMOTE_ADDR;
This is the best method there really is. Unless you wish to use C++ which you can easly get the IP. (In PHP)
iNod
11-25-2005, 01:29 AM
· #20 NP Twin™
Name: Joe
Location: Kent ~ U.K.
Join Date: Oct 2005
Posts: 2,989
NP$: 1432.87 (
Donate )
cool thanks for that iNod!
12-09-2005, 07:45 AM
· #21 NamePros Regular
Name: Jamie Watson
Location: Midlands, England
Join Date: Oct 2005
Posts: 309
NP$: 25.00 (
Donate )
I like it, i am new - ish to javascript and want to learn how to mix PHP and JS together
its cool lol
12-09-2005, 05:04 PM
· #22 NamePros Regular
Location: EU
Join Date: Nov 2005
Posts: 248
NP$: 50.00 (
Donate )
Quote: Javascript is good for client execution, but PHP is taking over....
Quote: The Javascript is good for peps on geocities and stuff.
Come on guys, how in the heck could you compare PHP and JS? Two different worlds. PHP is server side, JS is client side, each has it's own purpose.
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off