Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.
X
Post

How to log someone’s IP Address when submitting a form?

So I need to create the ability for a user to submit a form – and I would like to enable some sort of primitive security system. To that end, I need to work out a way to check IP addresses.  All this while in PERL (it’s pretty damn simple in PHP and Ruby on Rails). Let’s see what I can find (hopefully..)

-edit-

Well that wasn’t so bad.

render_text request.env['REMOTE_HOST'].to_s

-edit-

So it turns out that this doesn’t always work. There is a better way to do so; try this.


render_text request.remote_ip().to_s