Online Polling, Simplified
By Randal L. Schwartz
I heard about the "Am I Hot or Not?" site a while back. If you're one of the few people who haven't been there yet, check out www.AmIHOTorNOT.com. This site, combined with the bitterness of last November's presidential election, made me decide that it's time to talk about how tough (or easy) it is to write a fair polling script.
Using the DBI module, I quickly hacked up a voting scheme that has a mechanism for rejecting duplicate votes. (Well, at the least, it keeps someone from immediately reloading the page in order to stuff the ballot box.) I also wrote the script in such a way that it's possible to run under mod_perl's Apache::Registry module.
But what to vote on?
Well, let's imagine that you came across a large database of images500 of them, in fact. And let's imagine that these images just happened to be available in five different sizes, each with regular names like, Disk1/Small/005.jpg, for the fifth image on the first disk in its small size. It's not very likely, but let's say you found this repository of images on an arbitrary site like www.forgetmenots.com. How hard would it be to create an "Am I a Forget-me-Not?" poll, using a generic voting scheme?
Pretty durn easy.
Do Not Disturb
We can do this without disturbing the owners of the Forget Me Nots site, as we're just generating the URLs. This all breaks down if the owners move things around, but that's the nature of deep linking.