1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Obtaining users IP's with PHP

Discussion in 'PHP' started by Weirfire, Oct 1, 2004.

  1. #1
    I'd like to obtain users IP's so that I can calculate certain statistics on web site activity. Is there a method in PHP to log users IP's?
     
    Weirfire, Oct 1, 2004 IP
  2. TwisterMc

    TwisterMc Mac Guru

    Messages:
    972
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    TwisterMc, Oct 1, 2004 IP
  3. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #3
    Thanks Twister.

    Thats excellent. :)
     
    Weirfire, Oct 1, 2004 IP
  4. TwisterMc

    TwisterMc Mac Guru

    Messages:
    972
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Your welcome. :)
     
    TwisterMc, Oct 1, 2004 IP
  5. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #5
    or you can get it straight from $_SERVER
    eg
    $ip = $_SERVER['REMOTE_ADDR'];

    and then use a database from someone like http://ip-to-country.webhosting.info/ to trace the ip to a country. It's very simple and effective to use. It looks good when someone fills in a form and you already have the country selected.

    Sarah
     
    sarahk, Oct 2, 2004 IP