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...?
 
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'];
 
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.
 
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...
 
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)
 
<?php
$ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
print "your address is - $ip";
?>

that works...
 
Back
Top Bottom