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


In reply to Re: Preventing multiple votes by same user effeciently by samtregar
in thread Preventing multiple votes by same user effeciently by carthag

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.