Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

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

Capturing a visitors IP address


3 Posts   1584 Views


4 May 2009 at 12:15pm Community Member, 108 Posts

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.?




4 May 2009 at 6:09pm Community Member, 127 Posts

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


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.


4 May 2009 at 10:19pm Community Member, 108 Posts

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.