Is it possible to obtain clients adress in ruby on rails? by TheR -- Posted via http://www.ruby-forum.com/.
with request.remote_ip? http://railsmanual.org/class/ActionController%3A%3AAbstractRequest/remote_ip> > Is it possible to obtain clients adress in ruby on rails? > > by > > TheR > > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
reg Damjan Rems <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 Nayagam http://senthilnayagam.com
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. On 28/06/06, Senthilnayagam <senthil@senthilnayagam.com> wrote:> > > reg > > Damjan Rems <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 Nayagam > > http://senthilnayagam.com > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 12/7/06, mixplate <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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 Donald http://destiney.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
so i guess the easiest way to get around this is to maintain a registration table with user/pw like acts_as_authenticated? Greg Donald wrote:> On 12/7/06, mixplate <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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 Donald > http://destiney.com/-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 12/7/06, mixplate <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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 Donald http://destiney.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Greg, Thanks for the help! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---