Is there a functiaon to take the IP address of person who submits to a form example: <input id="user_ip" name="user[ip]" type="hidden" value="<%= some_ip_call %>" /> -- Posted via http://www.ruby-forum.com/.
On 4/26/06, Mohammad <name.goes.here44@gmail.com> wrote:> Is there a functiaon to take the IP address of person who submits to a > form > example: > <input id="user_ip" name="user[ip]" type="hidden" value="<%> some_ip_call %>" /> >In your controller action, you can invoke: request.remote_ip You don''t need a field on the form.
Wilson Bilkovich wrote:> On 4/26/06, Mohammad <name.goes.here44@gmail.com> wrote: >> Is there a functiaon to take the IP address of person who submits to a >> form >> example: >> <input id="user_ip" name="user[ip]" type="hidden" value="<%>> some_ip_call %>" /> >> > > In your controller action, you can invoke: > request.remote_ip > > You don''t need a field on the form.I got this error undefined local variable or method `request'' for ApplicationController:Class -- Posted via http://www.ruby-forum.com/.
On Apr 26, 2006, at 8:50 PM, Mohammad wrote:> Wilson Bilkovich wrote: >> On 4/26/06, Mohammad <name.goes.here44@gmail.com> wrote: >>> Is there a functiaon to take the IP address of person who submits >>> to a >>> form >>> example: >>> <input id="user_ip" name="user[ip]" type="hidden" value="<%>>> some_ip_call %>" /> >>> >> >> In your controller action, you can invoke: >> request.remote_ip >> >> You don''t need a field on the form. > I got this error > undefined local variable or method `request'' for > ApplicationController:ClassWhat version of Rails are you running? Robby Robby Russell Founder & Executive Director PLANET ARGON, LLC Ruby on Rails Development, Consulting & Hosting www.planetargon.com www.robbyonrails.com +1 503 445 2457 +1 877 55 ARGON [toll free] +1 815 642 4968 [fax]
Robby Russell wrote:> On Apr 26, 2006, at 8:50 PM, Mohammad wrote: > >>> In your controller action, you can invoke: >>> request.remote_ip >>> >>> You don''t need a field on the form. >> I got this error >> undefined local variable or method `request'' for >> ApplicationController:Class > > > What version of Rails are you running? > > Robby > > Robby Russell > Founder & Executive Director > > PLANET ARGON, LLC > Ruby on Rails Development, Consulting & Hosting > > www.planetargon.com > www.robbyonrails.com > > +1 503 445 2457 > +1 877 55 ARGON [toll free] > +1 815 642 4968 [fax]Ruby version 1.8.4 (i386-mswin32) RubyGems version 0.8.11 Rails version 1.1.2 Active Record version 1.14.2 Action Pack version 1.12.1 Action Web Service version 1.1.2 Action Mailer version 1.2.1 Active Support version 1.3.1 -- Posted via http://www.ruby-forum.com/.
Just making sure you know... the IP address is a very unreliable piece of information. It changes all the time for most users. AOL users have a different IP address for every request, for example, and for dial-up and most DSL users, it changes every time they connect. It can be useful sometimes for trying to spot trends in usage, or, to an extent, finding out where someone is from On 27/04/06, Mohammad <name.goes.here44@gmail.com> wrote:> Robby Russell wrote: > > On Apr 26, 2006, at 8:50 PM, Mohammad wrote: > > > >>> In your controller action, you can invoke: > >>> request.remote_ip > >>> > >>> You don''t need a field on the form. > >> I got this error > >> undefined local variable or method `request'' for > >> ApplicationController:Class > > > > > > What version of Rails are you running? > > > > Robby > > > > Robby Russell > > Founder & Executive Director > > > > PLANET ARGON, LLC > > Ruby on Rails Development, Consulting & Hosting > > > > www.planetargon.com > > www.robbyonrails.com > > > > +1 503 445 2457 > > +1 877 55 ARGON [toll free] > > +1 815 642 4968 [fax] > > Ruby version 1.8.4 (i386-mswin32) > RubyGems version 0.8.11 > Rails version 1.1.2 > Active Record version 1.14.2 > Action Pack version 1.12.1 > Action Web Service version 1.1.2 > Action Mailer version 1.2.1 > Active Support version 1.3.1 > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
unknown wrote:> Just making sure you know... the IP address is a very unreliable piece > of information. It changes all the time for most users. AOL users have > a different IP address for every request, for example, and for dial-up > and most DSL users, it changes every time they connect. It can be > useful sometimes for trying to spot trends in usage, or, to an extent, > finding out where someone is fromSo is there an efficent way to ban someone from my site? -- Posted via http://www.ruby-forum.com/.
The best way I''ve found, although still reasonably easy to get around, is to use a combination of a cookie and an IP address. If either is matched to a banned list, they don''t get in. Also, depending on the nature of the site, it can be possible to have fake site features for banned users to hide the fact that they have been banned. It will fool some, believe me. -Nathan On 27/04/06, Mohammad <name.goes.here44@gmail.com> wrote:> unknown wrote: > > Just making sure you know... the IP address is a very unreliable piece > > of information. It changes all the time for most users. AOL users have > > a different IP address for every request, for example, and for dial-up > > and most DSL users, it changes every time they connect. It can be > > useful sometimes for trying to spot trends in usage, or, to an extent, > > finding out where someone is from > > So is there an efficent way to ban someone from my site? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Oh, and just to clarify, the point of hiding from users that they''ve been banned is so that they deliberately don''t try to get around your banning method. On 27/04/06, njmacinnes@gmail.com <njmacinnes@gmail.com> wrote:> The best way I''ve found, although still reasonably easy to get around, > is to use a combination of a cookie and an IP address. If either is > matched to a banned list, they don''t get in. > > Also, depending on the nature of the site, it can be possible to have > fake site features for banned users to hide the fact that they have > been banned. It will fool some, believe me. > > -Nathan > > On 27/04/06, Mohammad <name.goes.here44@gmail.com> wrote: > > unknown wrote: > > > Just making sure you know... the IP address is a very unreliable piece > > > of information. It changes all the time for most users. AOL users have > > > a different IP address for every request, for example, and for dial-up > > > and most DSL users, it changes every time they connect. It can be > > > useful sometimes for trying to spot trends in usage, or, to an extent, > > > finding out where someone is from > > > > So is there an efficent way to ban someone from my site? > > > > -- > > Posted via http://www.ruby-forum.com/. > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Hey, I really like that idea :) On 4/27/06, njmacinnes@gmail.com <njmacinnes@gmail.com> wrote:> > Oh, and just to clarify, the point of hiding from users that they''ve > been banned is so that they deliberately don''t try to get around your > banning method. > > On 27/04/06, njmacinnes@gmail.com <njmacinnes@gmail.com> wrote: > > The best way I''ve found, although still reasonably easy to get around, > > is to use a combination of a cookie and an IP address. If either is > > matched to a banned list, they don''t get in. > > > > Also, depending on the nature of the site, it can be possible to have > > fake site features for banned users to hide the fact that they have > > been banned. It will fool some, believe me. > > > > -Nathan > > > > On 27/04/06, Mohammad <name.goes.here44@gmail.com> wrote: > > > unknown wrote: > > > > Just making sure you know... the IP address is a very unreliable > piece > > > > of information. It changes all the time for most users. AOL users > have > > > > a different IP address for every request, for example, and for > dial-up > > > > and most DSL users, it changes every time they connect. It can be > > > > useful sometimes for trying to spot trends in usage, or, to an > extent, > > > > finding out where someone is from > > > > > > So is there an efficent way to ban someone from my site? > > > > > > -- > > > Posted via http://www.ruby-forum.com/. > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060427/ae955389/attachment.html
It''s good isn''t it. There are parts of my site which anyone can edit, and I''m working out how to set it up so that when a blocked user edits something, their changes come up for them once they submit (using ajax) just as if they were a normal user. If they were to refresh the page, however, they would notice that their changes haven''t actually had any effect at all. Cool, huh? -Nathan On 27/04/06, Brian Hogan <bphogan@gmail.com> wrote:> Hey, I really like that idea :) > > > On 4/27/06, njmacinnes@gmail.com <njmacinnes@gmail.com > wrote: > > Oh, and just to clarify, the point of hiding from users that they''ve > > been banned is so that they deliberately don''t try to get around your > > banning method. > > > > On 27/04/06, njmacinnes@gmail.com <njmacinnes@gmail.com > wrote: > > > The best way I''ve found, although still reasonably easy to get around, > > > is to use a combination of a cookie and an IP address. If either is > > > matched to a banned list, they don''t get in. > > > > > > Also, depending on the nature of the site, it can be possible to have > > > fake site features for banned users to hide the fact that they have > > > been banned. It will fool some, believe me. > > > > > > -Nathan > > > > > > On 27/04/06, Mohammad <name.goes.here44@gmail.com> wrote: > > > > unknown wrote: > > > > > Just making sure you know... the IP address is a very unreliable > piece > > > > > of information. It changes all the time for most users. AOL users > have > > > > > a different IP address for every request, for example, and for > dial-up > > > > > and most DSL users, it changes every time they connect. It can be > > > > > useful sometimes for trying to spot trends in usage, or, to an > extent, > > > > > finding out where someone is from > > > > > > > > So is there an efficent way to ban someone from my site? > > > > > > > > -- > > > > Posted via http://www.ruby-forum.com/. > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails@lists.rubyonrails.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
On 27/04/06 15:16 +0100, njmacinnes@gmail.com wrote:> It''s good isn''t it. There are parts of my site which anyone can edit, > and I''m working out how to set it up so that when a blocked user edits > something, their changes come up for them once they submit (using > ajax) just as if they were a normal user. If they were to refresh the > page, however, they would notice that their changes haven''t actually > had any effect at all. Cool, huh? > -NathanThat''s a really neat idea. Sounds like a good candidate for a plugin or generator. Jason
On 4/26/06, Mohammad <name.goes.here44@gmail.com> wrote:> Wilson Bilkovich wrote: > > On 4/26/06, Mohammad <name.goes.here44@gmail.com> wrote: > >> Is there a functiaon to take the IP address of person who submits to a > >> form > >> example: > >> <input id="user_ip" name="user[ip]" type="hidden" value="<%> >> some_ip_call %>" /> > >> > > > > In your controller action, you can invoke: > > request.remote_ip > > > > You don''t need a field on the form. > I got this error > undefined local variable or method `request'' for > ApplicationController:ClassCould you paste the function that you''re using the request in?