473,325 Members | 2,792 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

question REMOTE_ADDR

Hi,

The javascript in my page is not working, itstead of alerting me the ip
address, it alerts me with string "<!--#echo var="REMOTE_ADDR"-->".

var ip = '<!--#echo var="REMOTE_ADDR"-->';
alert("Your IP address is "+ip);

How do I fix the problem?
Thanks.

Jason
Jul 23 '05 #1
7 14723
In <ci**********@news.seed.net.tw> Jason wrote:
Hi,

The javascript in my page is not working, itstead of alerting me the
ip address, it alerts me with string "<!--#echo var="REMOTE_ADDR"-->".

var ip = '<!--#echo var="REMOTE_ADDR"-->';
alert("Your IP address is "+ip);

How do I fix the problem?
Thanks.

Jason


Your JS is incorrect. Try here for an example of how to do what you
want:

http://javascript.internet.com/user-...p-address.html

As a tip for the future, if you want to do anything in JavaScript, go to
Google and put in something like:

javascript get IP address

That's exactly what I did to get the above. Then, when you have
something that is nearly working, come here and you will get very good
advice.

Cheers, Fred
Jul 23 '05 #2
Thanks Fred,

I did the same google search and visited the site you talked about, but it's
just not working.
Thanks anyway.

Jason

"Fred Oz" <oz****@iinet.net.smudge> ¦b¶l¥ó
news:20********************@freenews.iinet.net.au ¤¤¼¶¼g...
In <ci**********@news.seed.net.tw> Jason wrote:
Hi,

The javascript in my page is not working, itstead of alerting me the
ip address, it alerts me with string "<!--#echo var="REMOTE_ADDR"-->".

var ip = '<!--#echo var="REMOTE_ADDR"-->';
alert("Your IP address is "+ip);

How do I fix the problem?
Thanks.

Jason


Your JS is incorrect. Try here for an example of how to do what you
want:

http://javascript.internet.com/user-...p-address.html

As a tip for the future, if you want to do anything in JavaScript, go to
Google and put in something like:

javascript get IP address

That's exactly what I did to get the above. Then, when you have
something that is nearly working, come here and you will get very good
advice.

Cheers, Fred

Jul 23 '05 #3
Please do not top-post Jason,
I find it most confusing..
<http://www.physci.org/codes/javafaq.jsp#netiquette>

See further comments in-line..

On Wed, 15 Sep 2004 16:36:17 +0800, Jason wrote:
"Fred Oz" <oz****@iinet.net.smudge> ...
In <ci**********@news.seed.net.tw> Jason wrote: ...
The javascript in my page is not working, itstead of alerting me the
ip address, it alerts me with string "<!--#echo var="REMOTE_ADDR"-->".
... http://javascript.internet.com/user-...p-address.html
... I ...visited the site you talked about, but it's
just not working.


Did you try flogging it Jason?
It may just be lazy.

Or to put that another way, what the heck
is 'just not working' supposed to mean?

Did you get an error page? A blank
browser window with no further information?
A web-page with text that seemed unrelated?

I tried the page myself. It popped up an
alert when arriving at the page that read
'Your IP address is nnn.nn.nn.nn'
Where all the 'n's were digits.

Once I dismissed the alert, I saw the page itself,
which has a text area with a script in it.

Did you get those?

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #4
Lee
Jason said:

Hi,

The javascript in my page is not working, itstead of alerting me the ip
address, it alerts me with string "<!--#echo var="REMOTE_ADDR"-->".

var ip = '<!--#echo var="REMOTE_ADDR"-->';
alert("Your IP address is "+ip);


That's not a Javascript problem. That script relies upon your web
server being configured to replace the text inside the single-quotes
with the user's IP address.

Even when that "works", it doesn't provide useful information in
many cases, because dial-up users may have a different IP address
each time they connect, and many other users may be behind proxies
so that hundreds of machines will all report the same IP address.

Jul 23 '05 #5
In <ci**********@news.seed.net.tw> Jason wrote:
Thanks Fred,

I did the same google search and visited the site you talked about,
but it's just not working. Thanks anyway.


Jason, there's some pointers here:

http://reglos.de/myaddress/MyAddress.html

Cheers.
Jul 23 '05 #6
Fred Oz wrote:
In <ci**********@news.seed.net.tw> Jason wrote:
The javascript in my page is not working, itstead of alerting me the
ip address, it alerts me with string "<!--#echo var="REMOTE_ADDR"-->".

var ip = '<!--#echo var="REMOTE_ADDR"-->';
alert("Your IP address is "+ip);

How do I fix the problem?


Your JS is incorrect.


Nonsense. The client-side JS code is syntactically absolutely correct.
However, this solution also requires server-side includes which are
obviously not working properly.

And please trim your quotes to the absolute necessary.
PointedEars
Jul 23 '05 #7
In article <19****************@PointedEars.de>,
Thomas 'PointedEars' Lahn <Po*********@web.de> wrote:
However, this solution also requires server-side includes which are
obviously not working properly.


I was wondering how this code worked. Thanks.

Robert
Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stefan | last post by:
Hi, Just set up PHP (PHP Version 4.3.3) as a CGI on a WIN2k server and tried this: <?php echo $REMOTE_ADDR;
7
by: deko | last post by:
Why is $_SERVER returning multiple IP Addresses? Actually, I'm not sure if it's $_SERVER -- or which if/else statement -- that's the problem, but what I'm getting as a value for $visip looks...
3
by: Savas Ates | last post by:
i have a banner for example at www.xx.com and my site is www.yy.com.. banner has a link www.yy .com .. directed to my site.. when a user click banner and i use this method...
6
by: aabrahao | last post by:
Hi, In IIS 6, windows 2003 with php 4.3.11, the code REMOTE_ADDR does not show the IP, but the same page in apache2triad shows the IP. I tried <? $ip = getenv("REMOTE_ADDR"); print $ip; ?>...
11
by: nishant | last post by:
I've a structure: struct msghdr { //some goes here struct iovec *msg_iov; //some more --- }
3
by: Charles Stanley | last post by:
Hi all, I'm new to C#, and have two pretty simple questions: I have a class, in a .cs file by itself. I need to make use of the sole function in this class in another .cs file. Here's the...
4
by: ojorus | last post by:
Hi. I have a problem when I use the $_SERVER. I'm testing a script, and the strange thing is that remote_addr returns an ip-address only sometimes, and not always. Why can that be? Are there any...
3
by: Frank Moyles | last post by:
What is the equivalent for retrieving server side variables? For example in PHP, one such predefined variable is: $_SERVER
2
by: Henry Stock | last post by:
I don't seem to understand how to use the value: Request.ServerVariables("remote_addr") I am trying to pass the ip address of a sending web client in the body of an email message. When I...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.