How to get client IP address?

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

    #1

    How to get client IP address?

    How can I get the client's IP address from within an HTML page using embedded JS?

    Thanks for your help,
    Don

    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
  • Don

    #2
    Re: How to get client IP address?

    On Thu, 17 Mar 2005 08:00:17 -0700, Don <no@adr.com> wrote:
    [color=blue]
    >How can I get the client's IP address from within an HTML page using embedded JS?
    >
    >Thanks for your help,
    >Don
    >
    >----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    >http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    >----= East and West-Coast Server Farms - Total Privacy via Encryption =----[/color]
    Sorry, I meant how can I do it using PHP on the server?

    Don

    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

    Comment

    • NSpam

      #3
      Re: How to get client IP address?

      Don wrote:[color=blue]
      > On Thu, 17 Mar 2005 08:00:17 -0700, Don <no@adr.com> wrote:
      >
      >[color=green]
      >>How can I get the client's IP address from within an HTML page using embedded JS?
      >>
      >>Thanks for your help,
      >>Don
      >>
      >>----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
      >>http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
      >>----= East and West-Coast Server Farms - Total Privacy via Encryption =----[/color]
      >
      > Sorry, I meant how can I do it using PHP on the server?
      >
      > Don
      >
      > ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
      > http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
      > ----= East and West-Coast Server Farms - Total Privacy via Encryption =----[/color]
      run phpinfo it gives you, amongst other things the clients IP, Its in an
      environment variable, sorry can't remember which one it is

      Comment

      • Michael Winter

        #4
        Re: How to get client IP address?

        Don wrote:
        [color=blue]
        > On Thu, 17 Mar 2005 08:00:17 -0700, Don <no@adr.com> wrote:
        >[color=green]
        >> How can I get the client's IP address from within an HTML page
        >> using embedded JS?[/color][/color]

        [snip]
        [color=blue]
        > Sorry, I meant how can I do it using PHP on the server?[/color]

        Using the REMOTE_ADDR server variable:

        $_SERVER['REMOTE_ADDR']

        Be aware that the IP address might not be accurate due to proxying. Be
        careful when using it.

        Mike

        --
        Michael Winter
        Replace ".invalid" with ".uk" to reply by e-mail.

        Comment

        • NSpam

          #5
          Re: How to get client IP address?

          Michael Winter wrote:[color=blue]
          > Don wrote:
          >[color=green]
          >> On Thu, 17 Mar 2005 08:00:17 -0700, Don <no@adr.com> wrote:
          >>[color=darkred]
          >>> How can I get the client's IP address from within an HTML page
          >>> using embedded JS?[/color][/color]
          >
          >
          > [snip]
          >[color=green]
          >> Sorry, I meant how can I do it using PHP on the server?[/color]
          >
          >
          > Using the REMOTE_ADDR server variable:
          >
          > $_SERVER['REMOTE_ADDR']
          >
          > Be aware that the IP address might not be accurate due to proxying. Be
          > careful when using it.
          >
          > Mike
          >[/color]
          True, only rely upon the IP for a session, Asychronous fun <g>

          Comment

          • NSpam

            #6
            Re: How to get client IP address?

            Michael Winter wrote:[color=blue]
            > Don wrote:
            >[color=green]
            >> On Thu, 17 Mar 2005 08:00:17 -0700, Don <no@adr.com> wrote:
            >>[color=darkred]
            >>> How can I get the client's IP address from within an HTML page
            >>> using embedded JS?[/color][/color]
            >
            >
            > [snip]
            >[color=green]
            >> Sorry, I meant how can I do it using PHP on the server?[/color]
            >
            >
            > Using the REMOTE_ADDR server variable:
            >
            > $_SERVER['REMOTE_ADDR']
            >
            > Be aware that the IP address might not be accurate due to proxying. Be
            > careful when using it.
            >
            > Mike
            >[/color]
            Hell,

            life is hard, I started off with procedural languages and some clown
            comes up with objects, now the web requires me to go back to
            asynchronous. Thank God my first job was as a sytems programmer, what
            goes around comes around <g>

            Comment

            • Don

              #7
              Re: How to get client IP address?

              On Thu, 17 Mar 2005 15:23:34 GMT, Michael Winter <m.winter@bluey onder.co.invali d> wrote:
              [color=blue]
              >Don wrote:
              >[color=green]
              >> On Thu, 17 Mar 2005 08:00:17 -0700, Don <no@adr.com> wrote:
              >>[color=darkred]
              >>> How can I get the client's IP address from within an HTML page
              >>> using embedded JS?[/color][/color]
              >
              >[snip]
              >[color=green]
              >> Sorry, I meant how can I do it using PHP on the server?[/color]
              >
              >Using the REMOTE_ADDR server variable:
              >
              > $_SERVER['REMOTE_ADDR']
              >
              >Be aware that the IP address might not be accurate due to proxying. Be
              >careful when using it.
              >
              >Mike[/color]
              Thanks for your replies guys. It looks like I've got someone abusing my domain, and I want to ban
              his IP. So, if IP's are changing all the time how can I accomplish this. Suppose maybe, I can ban
              an IP range. Will that work?

              Don

              ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
              http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
              ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

              Comment

              • Bert Melis

                #8
                Re: How to get client IP address?

                Don wrote:[color=blue]
                > On Thu, 17 Mar 2005 15:23:34 GMT, Michael Winter <m.winter@bluey onder.co.invali d> wrote:
                >
                >[color=green]
                >>Don wrote:
                >>
                >>[color=darkred]
                >>>On Thu, 17 Mar 2005 08:00:17 -0700, Don <no@adr.com> wrote:
                >>>
                >>>
                >>>>How can I get the client's IP address from within an HTML page
                >>>>using embedded JS?[/color]
                >>
                >>[snip]
                >>
                >>[color=darkred]
                >>>Sorry, I meant how can I do it using PHP on the server?[/color]
                >>
                >>Using the REMOTE_ADDR server variable:
                >>
                >> $_SERVER['REMOTE_ADDR']
                >>
                >>Be aware that the IP address might not be accurate due to proxying. Be
                >>careful when using it.
                >>
                >>Mike[/color]
                >
                > Thanks for your replies guys. It looks like I've got someone abusing my domain, and I want to ban
                > his IP. So, if IP's are changing all the time how can I accomplish this. Suppose maybe, I can ban
                > an IP range. Will that work?
                >
                > Don
                >
                > ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
                > http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
                > ----= East and West-Coast Server Farms - Total Privacy via Encryption =----[/color]
                Anyone with a dial-up connection (or even broadband) has got a dynamic
                IP. It changes...

                Comment

                • Michael Winter

                  #9
                  Re: How to get client IP address?

                  Don wrote:

                  [snip]
                  [color=blue]
                  > So, if IP's are changing all the time how can I accomplish this.
                  > Suppose maybe, I can ban an IP range. Will that work?[/color]

                  [Conjecture. Practicality not assured. Regulars: feel free to flame away.]

                  In principle, yes. If you can't quite determine the range, you should
                  be able to use a regional registry (like ARIN or RIPE) to determine
                  the range held by the provider.

                  However, there is an obvious risk: if the necessary range involves a
                  major ISP or proxy, you're going to block a *lot* of people. In that
                  case, use the registry information to find the provider and determine
                  if the user's actions violate their terms of service. If so, make sure
                  your server has the correct time (record the discrepancy, if
                  necessary, including timezone) and wait for an attack to appear in
                  your logs. You can then send the record to the provider and they
                  should be able to trace who it is and terminate their account[1].

                  Reporting is probably a better route, assuming the attacker isn't
                  already spoofing their IP. If they find themselves banned, they might
                  then start spoofing and it will be difficult to try reporting then.

                  Good luck,
                  Mike


                  [1] Well, assuming the provider cares about violators. I've
                  encountered false abuse addresses, or at least unmonitored
                  mailboxes. There's not much you can do then unless the
                  provider has been leased their IP range from another
                  company.

                  --
                  Michael Winter
                  Replace ".invalid" with ".uk" to reply by e-mail.

                  Comment

                  • Don

                    #10
                    Re: How to get client IP address?

                    On Thu, 17 Mar 2005 18:16:34 GMT, Michael Winter <m.winter@bluey onder.co.invali d> wrote:
                    [color=blue]
                    >Don wrote:
                    >
                    >[snip]
                    >[color=green]
                    >> So, if IP's are changing all the time how can I accomplish this.
                    >> Suppose maybe, I can ban an IP range. Will that work?[/color]
                    >
                    >[Conjecture. Practicality not assured. Regulars: feel free to flame away.]
                    >
                    >In principle, yes. If you can't quite determine the range, you should
                    >be able to use a regional registry (like ARIN or RIPE) to determine
                    >the range held by the provider.
                    >
                    >However, there is an obvious risk: if the necessary range involves a
                    >major ISP or proxy, you're going to block a *lot* of people. In that
                    >case, use the registry information to find the provider and determine
                    >if the user's actions violate their terms of service. If so, make sure
                    >your server has the correct time (record the discrepancy, if
                    >necessary, including timezone) and wait for an attack to appear in
                    >your logs. You can then send the record to the provider and they
                    >should be able to trace who it is and terminate their account[1].
                    >
                    >Reporting is probably a better route, assuming the attacker isn't
                    >already spoofing their IP. If they find themselves banned, they might
                    >then start spoofing and it will be difficult to try reporting then.
                    >
                    >Good luck,
                    >Mike
                    >
                    >
                    >[1] Well, assuming the provider cares about violators. I've
                    > encountered false abuse addresses, or at least unmonitored
                    > mailboxes. There's not much you can do then unless the
                    > provider has been leased their IP range from another
                    > company.[/color]
                    Thanks Michael and everyone else for your help. I really appreciate your assistance.

                    Regards,
                    Don

                    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
                    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
                    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

                    Comment

                    Working...