www.webdeveloper.com
Results 1 to 10 of 10

Thread: sender's ip address

  1. #1
    Join Date
    Dec 2007
    Posts
    129

    sender's ip address

    IN PHP:
    PHP Code:
    $useripaddy $_SERVER['REMOTE_ADDR']; 
    Very simple form email. When we receive it, we would like to show the ip address of the sender, to keep for our records. The above is not working, it show's our ip address instead of the sender. How do I fix this? It's on a secure https, it make a difference?

    Thank you

  2. #2
    Join Date
    May 2004
    Location
    FL
    Posts
    3,447
    Try this:
    PHP Code:
    $useripaddy getenv("REMOTE_ADDR"); 
    Lee

    ""Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."" -- Sir Winston Churchill

  3. #3
    Join Date
    Dec 2007
    Posts
    129
    Thank you Lee but it's not working, giving me the same results.


  4. #4
    Join Date
    May 2004
    Location
    FL
    Posts
    3,447
    Can you post the entire code?
    Lee

    ""Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."" -- Sir Winston Churchill

  5. #5
    Join Date
    Jan 2008
    Location
    ON CA
    Posts
    58
    Hi,

    This will work:
    PHP Code:
    $useripaddy $_SERVER[REMOTE_ADDR]; 

  6. #6
    Join Date
    Dec 2007
    Posts
    129
    same thing



    this is frustrating.

    i have read other posts that worked, how come mines don't

  7. #7
    Join Date
    Jan 2008
    Location
    ON CA
    Posts
    58
    What version of PHP are you running? If earlier than 4.1 try this:
    PHP Code:
    $useripaddy $HTTP_SERVER_VARS['REMOTE_ADDR']; 

  8. #8
    Join Date
    Dec 2007
    Posts
    129
    I tried that does not work either.

    I just called our provider and they said php version 4.4.2.

    Thanks so much, hope this gets resolved soon.

  9. #9
    Join Date
    Jan 2008
    Location
    ON CA
    Posts
    58
    This might be a configuration issue. Contact your hosting provider's tech support and ask them.
    PHP Code:
    $_SERVER[REMOTE_ADDR
    is correct and should work.

  10. #10
    Join Date
    Jan 2005
    Posts
    45
    hex1a4 is correct.

    $_SERVER['REMOTE_ADDR'] should work.

    If you are testing it yourself, then it will, of course, show your IP address.

    Make sure that you are using this within a script that is being requested by the client (user's browser) and not a script being initiated by the server.

    $_SERVER['REMOTE_ADDR'] is the IP address of the entity running the script.
    Last edited by TechEvangelist; 01-27-2008 at 08:53 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles