Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Preventing multiple votes by same user effeciently

by samtregar (Abbot)
on Oct 26, 2002 at 19:40 UTC ( [id://208269]=note: print w/replies, xml ) Need Help??


in reply to Preventing multiple votes by same user effeciently

The problem here is basically that identifying a unique individual over the web is not easy. Your best bet is to use an email-based authentication scheme, since most users only have one or two email addresses and don't share them with anyone else. Here's a rough sketch of a scheme I've seen used to good effect:

  1. Ask the user for their email address, which will be their username.
  2. Generate an MD5 hash of their email address and a secret key.
  3. Email this MD5 to the user with instructions to return to the website and enter the code into a text box along with their email address.
  4. Now, when you recieve an email address and code pair you re-MD5 the email address with the secret key. If they match then the user must have recieved the email.
  5. Check the already-voted table. If not found, allow them to vote.
  6. Record their email address in the already-voted table.

Of course, this system is not perfectly secure. A suitably motivated person with control of a domain name could write a script to automate the process of generating valid email address and key pairs. However, it is definitely safe against your average jerk with an LWP script. And it's really not very hard to code. I'd estimate it at around 20-30 lines of code, using all the best that CPAN has to offer.

If you're into security through obscurity, one thing you can do to make script writing much harder is to randomize your form. Just mix up the names of the form parameters and the values that represent to answers. If a script writer has to actually parse the form HTML to figure out what results to send back to the server, they might not bother. Or, they might become inspired and spend all night writing an elaborate hack to show off to their friends. You never know!

-sam

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://208269]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-03-28 19:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found