Re: Javascript newbie - Please Help
- From: "-Lost" <maventheextrawords@xxxxxxxxxx>
- Date: Sun, 30 Dec 2007 04:33:29 -0600
Response to "StefanoElle" <onde@xxxxxxxxxxxx>:
var BaseURL;
if (ip1 == ip2)
BaseURL = '192.168.1.5'
else
BaseURL = 'www.mysite.com:9000';
Thank you for the answer. How can I get ip1 and ip2 ? I mean, how
to get the ip address of the user and the ipaddress of
www.mysite.com ?
<begin off-topic response>
<script type="text/javascript">
// <![CDATA[
<?php
// User's IP address
print 'var ip1 = ' . $_SERVER['REMOTE_ADDR'] . ';';
// Resolve the IP for the current host
print 'var ip2 = ' . gethostbyname('www.mysite.com') . ';';
?>
// Evertjan's code here...
// ]]>
</script>
If you do not know why you are using:
1. type="text/javascript"
2. // <![CDATA[
3. // ]]>
....then it is a good indication you should not be using them.
I'll not bother debating or arguing why it is or is not good -- I'm
sure someone else will though.
4. See additional caveats for gethostbyname by perusing the manual.
</end off-topic response>
--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
.
- Follow-Ups:
- Re: Javascript newbie - Please Help
- From: stefanoelle
- Re: Javascript newbie - Please Help
- From: Thomas 'PointedEars' Lahn
- Re: Javascript newbie - Please Help
- References:
- Javascript newbie - Please Help
- From: StefanoElle
- Re: Javascript newbie - Please Help
- From: Evertjan.
- Re: Javascript newbie - Please Help
- From: StefanoElle
- Javascript newbie - Please Help
- Prev by Date: Re: Javascript newbie - Please Help
- Next by Date: Re: Adding custom events to widget
- Previous by thread: Re: Javascript newbie - Please Help
- Next by thread: Re: Javascript newbie - Please Help
- Index(es):
Relevant Pages
|