SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to identifiy individual remote computers on a shared network?

    Hello,

    Usually you use the IP address to identify the users of your site, but if the user is using a shared internet connection through a LAN connection then you'll see the same IP address for all computers connecting to your site from within that LAN.

    The question now is: can I use PHP to identify an individual remote computer connecting to my site through a shared internet connection and so be able to distinguish between different users/computers sharing the same IP address?

    Now who is the first smarta** that's going to ask why would I want to do that?
    JK! LOL!

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Nope, there is no distinction between the two.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Why would you want to?!
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  4. #4
    SitePoint Wizard TheRedDevil's Avatar
    Join Date
    Sep 2004
    Location
    Norway
    Posts
    1,196
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    You can archive it with a java applet. Just force the users to run it before allowing them to login.

    Though again, I do not see why this would be required? After all it would be just as easy for the user to change as their IP if they wanted to fool your system.

  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by spikeZ View Post
    Why would you want to?!
    I want to do that for user tracking and counting the number of individual PC's that visit my site.
    Imagine a LAN (in a student dorm for example) of 30 PC's (each PC for a different student) that share the same internet connection. Now if you identify those visitors by IP address you'd be counting the 30 unique visitors as 1 unique visitor.

    Can't I use connection ports or whatsoever to identify those individual computers?

  6. #6
    Grumpy Minimalist
    Join Date
    Jul 2006
    Location
    Ontario, Canada
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Without an authentication mechanism, there is no way to uniquely identify a visitor. Therefore, this problem has the same solution as "how do I keep a user logged in?" Since tracking means that you're essentially "logging in" anonymous visitors, you can use any solutions from threads addressing that issue to solve your problem.

    Some of those are: Cookies, Flash data, and Java data.

    Ultimately, any number that you get will be a general guess. If a user wishes to be anonymous (by not accepting any of these things) they will be. The only question is how big of a guess you want it to be. Consider using multiple factors to increase accuracy: use tracking cookies as well as IP addresses.

    Quote Originally Posted by AHA7 View Post
    Can't I use connection ports or whatsoever to identify those individual computers?
    I don't think that PHP exposes access to the remote TCP connection port. Even if it did, clients typically randomize their port on each request.

  7. #7
    SitePoint Addict
    Join Date
    Aug 2007
    Posts
    365
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Some Proxy Server fill in the clients IP address in the
    Code:
    $_SERVER["HTTP_X_FORWARDED_FOR"]
    variable

    and sometimes the the IP addresses are in the format of "xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx" one for a proxy and then the client.

    It's not what you wanted but may help a fraction.

  8. #8
    Grumpy Minimalist
    Join Date
    Jul 2006
    Location
    Ontario, Canada
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you do anything with the HTTP_X_FORWARDED_FOR header, make sure you validate it using regex or similar: it's very easy for a client to fill in the header with anything (such as an SQL injection attack).


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •