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.

Get ip from contact us form?

Discussion in 'HTML & Website Design' started by jpoke5, Jan 14, 2010.

  1. #1
    hello, Wondering how i can get a users ip address from the contact us form i use on my hosting site? this is a cgi formmail in html. I would like to get the ip sent along with the mail without the user knowing it but cant seem to find this info on dp or google????
    can anyone provide me the code for this or point me in the right direction on how to do this?

    Im getting some spammers and I want to block them from the server and my contact us form.

    Thanks much!!

    Jeff
     
    jpoke5, Jan 14, 2010 IP
  2. harrierdh

    harrierdh Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can do this server side by getting the http header parameter referrer. Depending on what server language you are using you should ask in that forum. Go take a look here.

    http://web-sniffer.net/
     
    harrierdh, Jan 14, 2010 IP
  3. jpoke5

    jpoke5 Active Member

    Messages:
    222
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #3
    this is the tag that can be used in formmail to get a users ip.
    <input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT,AUTH_TYPE,REMOTE_USER">
    
    Code (markup):
     
    jpoke5, Jan 14, 2010 IP
  4. Twity

    Twity Peon

    Messages:
    91
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    In PHP you can do this:

    echo $_SERVER['REMOTE_ADDR'];
     
    Twity, Jan 15, 2010 IP
    Kerosene likes this.