Jump to:

23364 Posts in 18142 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » Capturing a visitors IP address

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1543 Views
  • TerryMiddleton
    Avatar
    Community Member
    108 Posts

    Capturing a visitors IP address Link to this post

    Couple of questions.

    1.) Is there a way to capture a visitors IPAddress ?

    2.) Can I store the address in a log file?

    3.) Is there a way to create a unique table in the database that stores more information that the user's login information. Such as name, address, email, etc.?

    Thanks,

    Terry

  • Kalileo
    Avatar
    Community Member
    127 Posts

    Re: Capturing a visitors IP address Link to this post

    About the visitors IPAddress, dunno if SS has a special function, but look at the content of $_SERVER, such as

    $ip = $_SERVER['REMOTE_ADDR'];


    this can be manipulated though, have a look also at 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'HTTP_VIA', 'HTTP_X_COMING_FROM', 'HTTP_COMING_FROM', always as fields of $_SERVER.

  • TerryMiddleton
    Avatar
    Community Member
    108 Posts

    Re: Capturing a visitors IP address Link to this post

    Yeah, I'll give that a whirl.

    I'll create a field in the form and pass it the value of $_SERVER['REMOTE_ADDR']

    Let's see how that works.

    Thanks for the hint. Wasn't thinking clearly and thinking that everything had to be SS specific.

    Terry

    1543 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.