[advanced search]
Results from the most recent live auction are here.
21 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming > CODE
User Name
Password

Old 03-29-2005, 09:57 PM   · #1
111111z
NamePros Regular
 
Trader Rating: (2)
Join Date: Dec 2004
Posts: 290
NP$: 38.45 (Donate)
111111z will become famous soon enough111111z will become famous soon enough
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>


Please register or log-in into NamePros to hide ads

Last edited by 111111z : 04-08-2005 at 09:20 AM. Reason: addition
111111z is offline   Reply With Quote
Old 03-31-2005, 10:07 AM   · #2
.PJ
NamePros Regular
 
.PJ's Avatar
 
Trader Rating: (5)
Join Date: Aug 2004
Posts: 369
NP$: 0.00 (Donate)
.PJ is on a distinguished road
Thanks handy if you use a free hosting service like goeocities :P

But I dont so I can stick with PHP

PJ
__________________
L33TSig.net
.PJ is offline   Reply With Quote
Old 04-16-2005, 06:11 PM   · #3
Scott
Senior Member
 
Scott's Avatar
 
Location: UK
Trader Rating: (180)
Join Date: Jun 2003
Posts: 3,758
NP$: 15.00 (Donate)
Scott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond repute
Member of the Month
February 2005 Save The Children Save The Children Save The Children Save The Children Save The Children
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');

?>
Scott is offline   Reply With Quote
Old 06-03-2005, 03:50 AM   · #4
J_Ronaldo_19
NamePros Member
 
Name: James
Location: Huddersfield, England
Trader Rating: (3)
Join Date: May 2005
Posts: 179
NP$: 361.00 (Donate)
J_Ronaldo_19 is on a distinguished road
very simple, but very affective
J_Ronaldo_19 is offline   Reply With Quote
Old 06-03-2005, 03:56 AM   · #5
simpsons
NamePros Regular
 
simpsons's Avatar
 
Name: Peter
Location: England
Trader Rating: (15)
Join Date: Apr 2005
Posts: 581
NP$: 3.50 (Donate)
simpsons has a spectacular aura aboutsimpsons has a spectacular aura about
Thanks! I may use that!
simpsons is offline   Reply With Quote
Old 06-25-2005, 10:42 AM   · #6
stscac
A Wealth of Knowledge
 
stscac's Avatar
 
Trader Rating: (44)
Join Date: Aug 2004
Posts: 3,784
NP$: 17620.20 (Donate)
stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of
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
stscac is offline   Reply With Quote
Old 06-25-2005, 02:58 PM   · #7
.PJ
NamePros Regular
 
.PJ's Avatar
 
Trader Rating: (5)
Join Date: Aug 2004
Posts: 369
NP$: 0.00 (Donate)
.PJ is on a distinguished road
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
__________________
L33TSig.net
.PJ is offline   Reply With Quote
Old 06-26-2005, 08:03 AM   · #8
PoorDoggie
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
 
Name: Tom
Location: UK
Trader Rating: (36)
Join Date: Jan 2005
Posts: 2,390
NP$: 300.50 (Donate)
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
PHP i the best, but that javascript was very handy! thanks
PoorDoggie is offline   Reply With Quote
Old 06-29-2005, 01:24 AM   · #9
i386
NamePros Member
 
Trader Rating: (3)
Join Date: Oct 2003
Posts: 126
NP$: 182.00 (Donate)
i386 is an unknown quantity at this point
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.
i386 is offline   Reply With Quote
Old 06-29-2005, 05:06 AM   · #10
stscac
A Wealth of Knowledge
 
stscac's Avatar
 
Trader Rating: (44)
Join Date: Aug 2004
Posts: 3,784
NP$: 17620.20 (Donate)
stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of
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
stscac is offline   Reply With Quote
Old 06-29-2005, 06:20 AM   · #11
hasif
Account Closed
 
Name: Hasif Ahmed
Location: NY, USA
Trader Rating: (12)
Join Date: May 2005
Posts: 285
NP$: 45.00 (Donate)
hasif has a spectacular aura abouthasif has a spectacular aura about
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.
hasif is offline   Reply With Quote
Old 06-29-2005, 06:23 AM   · #12
PoorDoggie
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
 
Name: Tom
Location: UK
Trader Rating: (36)
Join Date: Jan 2005
Posts: 2,390
NP$: 300.50 (Donate)
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
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
PoorDoggie is offline   Reply With Quote
Old 07-08-2005, 08:55 PM   · #13
i386
NamePros Member
 
Trader Rating: (3)
Join Date: Oct 2003
Posts: 126
NP$: 182.00 (Donate)
i386 is an unknown quantity at this point
$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
i386 is offline   Reply With Quote
Old 08-20-2005, 11:43 PM   · #14
bbalegere
Senior Member
 
Name: Bharat Balegere
Location: Bangalore
Trader Rating: (15)
Join Date: Jul 2005
Posts: 1,179
NP$: 10.25 (Donate)
bbalegere is just really nicebbalegere is just really nicebbalegere is just really nicebbalegere is just really nice
Thankx a lot for the code.
bbalegere is offline   Reply With Quote
Old 10-09-2005, 06:16 PM   · #15
Coolprogram
NamePros Regular
 
Name: Pete
Location: U.S.A.
Trader Rating: (12)
Join Date: Jul 2005
Posts: 648
NP$: 67.00 (Donate)
Coolprogram has a spectacular aura aboutCoolprogram has a spectacular aura about
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
Coolprogram is offline   Reply With Quote
Old 10-17-2005, 07:40 PM   · #16
ralxz
NamePros Member
 
Name: Ryan
Location: USA
Trader Rating: (2)
Join Date: Oct 2005
Posts: 196
NP$: 4.00 (Donate)
ralxz is an unknown quantity at this point
Thanks for the hint on $server. I never knew that
__________________
Freelance Graphic Designer for Hire
Portfolio

Contact info here.
ralxz is offline   Reply With Quote
Old 10-17-2005, 08:04 PM   · #17
0xide
NamePros Regular
 
0xide's Avatar
 
Name: Christopher Cunningham
Location: Wisconsin
Trader Rating: (12)
Join Date: Sep 2005
Posts: 445
NP$: 69.10 (Donate)
0xide has a spectacular aura about0xide has a spectacular aura about
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!
0xide is online now   Reply With Quote
Old 10-18-2005, 10:20 AM   · #18
Scott
Senior Member
 
Scott's Avatar
 
Location: UK
Trader Rating: (180)
Join Date: Jun 2003
Posts: 3,758
NP$: 15.00 (Donate)
Scott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond reputeScott has a reputation beyond repute
Member of the Month
February 2005 Save The Children Save The Children Save The Children Save The Children Save The Children
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
Scott is offline   Reply With Quote
Old 10-18-2005, 02:11 PM   · #19
iNod
Eating Pie
 
iNod's Avatar
 
Name: Steve
Location: Canada
Trader Rating: (66)
Join Date: Nov 2004
Posts: 2,282
NP$: 91.30 (Donate)
iNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud of
Special Olympics AIDS/HIV Cystic Fibrosis Save The Children Baby Health Cystic Fibrosis
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
__________________
RegisterDub.com - 200th Customer Milestone
ZuneParts.net - International Zune Parts and Accessories
FeaturedFont.com - One Top Free Font a Day!
iNod is offline   Reply With Quote
Old 12-09-2005, 07:45 AM   · #21
.:Mammoth261:.
NamePros Regular
 
.:Mammoth261:.'s Avatar
 
Name: Jamie Watson
Location: Midlands, England
Trader Rating: (4)
Join Date: Oct 2005
Posts: 309
NP$: 25.00 (Donate)
.:Mammoth261:. will become famous soon enough.:Mammoth261:. will become famous soon enough
I like it, i am new - ish to javascript and want to learn how to mix PHP and JS together its cool lol
.:Mammoth261:. is offline   Reply With Quote
Old 12-09-2005, 05:04 PM   · #22
mch
NamePros Regular
 
Location: EU
Trader Rating: (1)
Join Date: Nov 2005
Posts: 248
NP$: 50.00 (Donate)
mch is on a distinguished road
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.
mch is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


Site Sponsors
Domain Tasting Special Offer NameChatter
Advertise your business at NamePros
All times are GMT -7. The time now is 06:58 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0