Is it possible to obtain clients adress in ruby on rails?
by
TheR
Is it possible to obtain clients adress in ruby on rails?
by
TheR
with request.remote_ip?
http://railsmanual.org/class/ActionController%3A%3AAbstractRequest/remote_ip
request.remote_ip is, as mentioned above, what you’re looking for
within Rails. User agent, referer, etc, can all be gained from the
request object.
hi, i was wondering is this something i would do if for example i have a
rating system on my site and would like to allow the public to rate the
item only once, i can log their ipaddress in a table after they rate?
so if ipaddress is in table for a rating, i do nothing or display a
“thanks for rating” message?
thanks.
reg
Damjan R. <d_rems@…> writes:
Is it possible to obtain clients adress in ruby on rails?
by
TheR
Hi
ipaddress= request.env[‘REMOTE_ADDR’]
you can try all all CGI environment variables
HTTP_USER_AGENT,HTTP_REFERER etc
hope that helps
regards
A.Senthil N.
so i guess the easiest way to get around this is to maintain a
registration table with user/pw like acts_as_authenticated?
Greg D. wrote:
On 12/7/06, mixplate [email protected] wrote:
hi, i was wondering is this something i would do if for example i have a
rating system on my site and would like to allow the public to rate the
item only once, i can log their ipaddress in a table after they rate?so if ipaddress is in table for a rating, i do nothing or display a
“thanks for rating” message?If your app runs proxied under Apache use this:
request.env[ ‘HTTP_X_FORWARDED_FOR’ ]Direct requests:
request.env[ ‘REMOTE_ADDR’ ]You realize most your AOL (and other large ISPs) visitors will appear
to be coming from the same IP addresses right?–
Greg D.
http://destiney.com/
On 12/7/06, mixplate [email protected] wrote:
hi, i was wondering is this something i would do if for example i have a
rating system on my site and would like to allow the public to rate the
item only once, i can log their ipaddress in a table after they rate?so if ipaddress is in table for a rating, i do nothing or display a
“thanks for rating” message?
If your app runs proxied under Apache use this:
request.env[ ‘HTTP_X_FORWARDED_FOR’ ]
Direct requests:
request.env[ ‘REMOTE_ADDR’ ]
You realize most your AOL (and other large ISPs) visitors will appear
to be coming from the same IP addresses right?
–
Greg D.
http://destiney.com/
Hi Greg,
Thanks for the help!
On 12/7/06, mixplate [email protected] wrote:
so i guess the easiest way to get around this is to maintain a
registration table with user/pw like acts_as_authenticated?
You might go ahead and store the IPs but then also take into account
the time span since the last rating was recorded. If it’s less than
24 hours ignore it or whatever.
That’s sorta what I do in my free image rating script:
http://destiney.com/php#Destiney_rated_images
–
Greg D.
http://destiney.com/
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs