Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 11-10-2005, 10:54 PM   #1
Fully Optimized
 
-Paul-'s Avatar
 
Join Date: Jun 2005
Posts: 2,242
Send a message via AIM to -Paul- Send a message via MSN to -Paul-
Default code to display ip

ok when you go to www.whatismyip.com it tells you your ip address, i need an html or javascript code that will do that on my site, does anybody know of one?
__________________

-Paul- is offline   Reply With Quote
Old 11-11-2005, 01:01 AM   #2
In Runtime
 
outlawstar4761's Avatar
 
Join Date: Jan 2005
Posts: 186
Default Re: code to display ip

<SCRIPT TYPE="text/javascript"><!--
bm();
//--></SCRIPT>
</TD>
<TD>
<TABLE width="100%" align="center" border="0" cellpadding="5">
<TR>
<TD CLASS="ip">
<h1>Your IP Is </h1>

<script type="text/javascript"><!--
displaycopy('');
//--></script>
</TD>
</TR>
<TR>
<TD CLASS="body">
<H3></H3>
<P></P>
<P><SCRIPT TYPE="text/javascript"><!--
doad3();
//--></SCRIPT></P>


Try that and see if it works. I kind of plucked it from their source...I hope that's not bad...?
__________________

outlawstar4761 is offline   Reply With Quote
Old 11-11-2005, 05:21 AM   #3
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: code to display ip

No no...

sorry, but your javascript client just can't get that info...
the IP addres posted there is your own... (you might like to edit that?)

to display the IP address you need to use the server side variables.

in PHP it's
$ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 11-11-2005, 09:24 AM   #4
Fully Optimized
 
-Paul-'s Avatar
 
Join Date: Jun 2005
Posts: 2,242
Send a message via AIM to -Paul- Send a message via MSN to -Paul-
Default Re: code to display ip

actually i found one that is javascript, and it is working fine, PLEASE CHECK IT OUT AT www.geocities.com/ipaddressfinder
-Paul- is offline   Reply With Quote
Old 11-11-2005, 11:59 AM   #5
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: code to display ip

Indeed.
but I didn't say it couldn't be done in javascript, I said it couldn't be done with outlawstars javascript.


there is a big difference.
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 11-11-2005, 03:24 PM   #6
Fully Optimized
 
-Paul-'s Avatar
 
Join Date: Jun 2005
Posts: 2,242
Send a message via AIM to -Paul- Send a message via MSN to -Paul-
Default Re: code to display ip

oh sorry
-Paul- is offline   Reply With Quote
Old 11-14-2005, 05:13 AM   #7
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: code to display ip

ever have something bother you???

well I was wondering how on earth can this javascript client get the IP address of the router...


so I had a look at the code...

Code:
<script language="JavaScript" src="<A href="http://www.hashemian.com/js/visitorIPHOST.js.php"></script>">http://www.hashemian.com/js/visitorIPHOST.js.php"></script>
that explains it, It can't be done with javascript at all...
all the javascript in the example does is reference a PHP page that generates script specifically for that page with the IP address...


so outlaws code doesn't get it with javascript, and nor does that one...
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 11-14-2005, 02:12 PM   #8
In Runtime
 
outlawstar4761's Avatar
 
Join Date: Jan 2005
Posts: 186
Default Re: code to display ip

ok ok I think we've all established that my code was poop. I just thought I'd try and help.

But we still havn't figured out on a specific code block that will generate the ip have we? (I'm also interested in using this)
outlawstar4761 is offline   Reply With Quote
Old 11-14-2005, 02:59 PM   #9
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: code to display ip

<?php
$ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
print "your address is - $ip";
?>

that works...
__________________

__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 09:27 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0