question REMOTE_ADDR

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jason

    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_ADD R"-->".

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

    How do I fix the problem?
    Thanks.

    Jason


  • Fred Oz

    #2
    Re: question REMOTE_ADDR

    In <ci8opc$72o$1@n ews.seed.net.tw > Jason wrote:[color=blue]
    > Hi,
    >
    > The javascript in my page is not working, itstead of alerting me the
    > ip address, it alerts me with string "<!--#echo var="REMOTE_ADD R"-->".
    >
    > var ip = '<!--#echo var="REMOTE_ADD R"-->';
    > alert("Your IP address is "+ip);
    >
    > How do I fix the problem?
    > Thanks.
    >
    > Jason
    >
    >
    >[/color]

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



    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

    Comment

    • Jason

      #3
      Re: question REMOTE_ADDR

      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" <ozfred@iinet.n et.smudge> ¦b¶l¥ó
      news:2004091518 0412045+1000@fr eenews.iinet.ne t.au ¤¤¼¶¼g...[color=blue]
      > In <ci8opc$72o$1@n ews.seed.net.tw > Jason wrote:[color=green]
      > > Hi,
      > >
      > > The javascript in my page is not working, itstead of alerting me the
      > > ip address, it alerts me with string "<!--#echo var="REMOTE_ADD R"-->".
      > >
      > > var ip = '<!--#echo var="REMOTE_ADD R"-->';
      > > alert("Your IP address is "+ip);
      > >
      > > How do I fix the problem?
      > > Thanks.
      > >
      > > Jason
      > >
      > >
      > >[/color]
      >
      > 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[/color]


      Comment

      • Andrew Thompson

        #4
        Re: question REMOTE_ADDR

        Please do not top-post Jason,
        I find it most confusing..
        <http://www.physci.org/codes/javafaq.jsp#net iquette>

        See further comments in-line..

        On Wed, 15 Sep 2004 16:36:17 +0800, Jason wrote:[color=blue]
        > "Fred Oz" <ozfred@iinet.n et.smudge> ...[color=green]
        >> In <ci8opc$72o$1@n ews.seed.net.tw > Jason wrote:[/color][/color]
        ...[color=blue][color=green][color=darkred]
        >>> The javascript in my page is not working, itstead of alerting me the
        >>> ip address, it alerts me with string "<!--#echo var="REMOTE_ADD R"-->".[/color][/color][/color]
        ...[color=blue][color=green]
        >> http://javascript.internet.com/user-...p-address.html[/color][/color]
        ...[color=blue]
        > I ...visited the site you talked about, but it's
        > just not working.[/color]

        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

        Comment

        • Lee

          #5
          Re: question REMOTE_ADDR

          Jason said:[color=blue]
          >
          >Hi,
          >
          >The javascript in my page is not working, itstead of alerting me the ip
          >address, it alerts me with string "<!--#echo var="REMOTE_ADD R"-->".
          >
          >var ip = '<!--#echo var="REMOTE_ADD R"-->';
          >alert("Your IP address is "+ip);[/color]

          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.

          Comment

          • Fred Oz

            #6
            Re: question REMOTE_ADDR

            In <ci8ujc$8h1$1@n ews.seed.net.tw > Jason wrote:[color=blue]
            > Thanks Fred,
            >
            > I did the same google search and visited the site you talked about,
            > but it's just not working. Thanks anyway.
            >[/color]

            Jason, there's some pointers here:



            Cheers.

            Comment

            • Thomas 'PointedEars' Lahn

              #7
              Re: question REMOTE_ADDR

              Fred Oz wrote:
              [color=blue]
              > In <ci8opc$72o$1@n ews.seed.net.tw > Jason wrote:[color=green]
              >> The javascript in my page is not working, itstead of alerting me the
              >> ip address, it alerts me with string "<!--#echo var="REMOTE_ADD R"-->".
              >>
              >> var ip = '<!--#echo var="REMOTE_ADD R"-->';
              >> alert("Your IP address is "+ip);
              >>
              >> How do I fix the problem?[/color]
              >
              > Your JS is incorrect.[/color]

              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

              Comment

              • Robert

                #8
                Re: question REMOTE_ADDR

                In article <1904929.sbqxbL OMkL@PointedEar s.de>,
                Thomas 'PointedEars' Lahn <PointedEars@we b.de> wrote:
                [color=blue]
                > However, this solution also requires server-side includes which are
                > obviously not working properly.[/color]

                I was wondering how this code worked. Thanks.

                Robert

                Comment

                Working...