Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

RE: RE: Quick and easy way to prevent multiple votes?

by chromatic (Archbishop)
on Jun 09, 2000 at 03:00 UTC ( [id://17242] : note . print w/replies, xml ) Need Help??


in reply to RE: Quick and easy way to prevent multiple votes?
in thread Quick and easy way to prevent multiple votes?

Yeah, there are simpler ways to keep a list of IPs. As the list grows, time to check them increases tremendously.

If you really must do it this way, use a database. Even something simple like DBD::CSV would help immensely.

Specific things in your code that I'd do differently are:

  • Error checking (always check the return value of open calls!)
  • Open the IP list for appending, at least. ">> listofips.txt". That way, you don't have to write the whole thing at once.
  • Setting $/ to undef and slurping the whole file into a scalar instaed of using read.
But tracking IP addresses really isn't the way to go here, as merlyn and others have pointed out.
  • Comment on RE: RE: Quick and easy way to prevent multiple votes?