Exciting New Weblog Feature
Feb 16th, 2003 by Nate
I implemented a simple little voting feature in my weblog. Go to the entry entitled “War Protests” and try it out. It even has a primitive scheme for stopping people from voting twice, although I’m sure Steve will be able to figure out what I’m doing pretty quickly, and proceed to vote 50 billion times. Some of the techniques I’ve used to implement this will be used to build my wedding RSVP page in a few months.






Wow, I didn’t know you knew about cookies.
Bast! I didn’t think you’d find my deadly secret so quickly! I may try to do an IP address thingy next time around, that may work marginally better, but I think for most people using yummy cookies will work just fine.
Added some new stuff.. No longer using cookies, now I’m grabbing whatever IP address you are using and matching that against previous votes.. I also added percentages in red next to the count, and also notice that if there is only 1 vote it says “Vote” not “Votes”
As a side note, cookies in php are really easy to work with, much more intuitive than .NET’s handling of cookies.
Going by IP now? That’s good, now I can vote each time I log on (I get a new IP via DHCP).
And it means that people behind firewalls get only one vote for the entire company.
Cookies is better.
Ha! No way.. Didn’t even think about stupid dynamic IP’s and firewalls and stuff. Back to cookies! I’m still going to store the IP’s of who votes.. Is there any way to do a reverse IPAddress lookup, to get a domain from an IP or is that damn near impossible? Btw, how did you find out it was cookies? A good guess? Or did something tip you off?
In Mozilla, go to Tools|Cookie Manager… you can see the list of all cookies that all websites have set. The cookie from suver.com called VoteCookie, set to VOTED was pretty obvious.
In many cases you can get a hostname from an IP address. You’ll find most of the domain names are totally uninteresting though, like 172.182.252.64.snet.net (my current hostname). But some will be cool, like secret.dangerous.milnet.mil or whatever.
Here’s a site with lots of DNS tools, including “Reverse Lookup” which is what you want. There’s probably a function in PHP to do it too.
http://www.dnsstuff.com/
Yeah I used the mozilla cookie manager in testing (for deleting the cookie). I wish it had a better lookup feature though, cause I have like 5000 cookies on my machine and sometimes it was a pain in the ass to find.