Results 1 to 7 of 7

Thread: IP Address

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Posts
    126

    IP Address

    I'm wanting to record the person's IP Address when they register an account on my database (php/mysql). How can I get the users IP Address?

  2. #2
    Lively Member
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    96
    $Hostname = @gethostbyaddr($REMOTE_ADDR);
    http://www.raketje.com coming..............soon................

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Posts
    126
    Thanks. How about the others? This returns blanks.

    Code:
    $RemoteAddress = @gethostbyaddr($REMOTE_ADDR);
    $RemoteHost = @gethostbyaddr($REMOTE_HOST);
    $RemoteUser = @gethostbyaddr($REMOTE_USER);
    $UserAgent = @gethostbyaddr($HTTP_USER_AGENT);
    
    echo $Hostname;
    echo "<br>";
    echo $RemoteHost;
    echo "<br>";
    echo $RemoteUser;
    echo "<br>";
    echo $UserAgent;
    echo "<br>";

  4. #4
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629
    Try

    PHP Code:
    echo $RemoteAddress getenv("REMOTE_ADDR") . "<br>" .
         
    $RemoteHost getenv("REMOTE_HOST") . "<br>" 
         
    $RemoteUser getenv("REMOTE_USER") . "<br>" .
         
    $UserAgent getenv("HTTP_USER_AGENT") . "<br>"
    http://www.complex-sys.com/getenv.php

    If some of them don't return, it's because of your server software. The REMOTE_USER does not return on my IIS server.
    Like Archer? Check out some Sterling Archer quotes.

  5. #5
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by bekkel
    $Hostname = @gethostbyaddr($REMOTE_ADDR);
    $REMOTE_ADDR is deprecated. Use $_SERVER['REMOTE_ADDR'].
    My evil laugh has a squeak in it.

    kristopherwilson.com

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Posts
    126
    Thanks guys

  7. #7
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    not a sure fire way to get it. they can still be blank whateve way you do it. they can be behind a proxy or they can edit it so they don't show it. a lot of things.

Posting Permissions

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



Click Here to Expand Forum to Full Width