Reddit, as we all know, allows around 1 vote per ip address per link to avoid issues with spammers. I am working on a Slim application that will have a voting feature and I, quite frankly, have no idea how to implement system like this as I have no experience with cookies and native sessions. Also most of my functions have paths like (example) localhost:8888/myapp/voteup/item-to-vote.
2条回答 默认 最新
- douzi4766 2012-12-29 23:59关注
On my site I allow members to rate some code between 1 and 5 once every 24 hours. I stop spam by adding a hash code and using ajax to submit a vote. I haven't gotten any spam votes since I added it in June 2012. I used to get about 40 votes per day from bots, but now that has been eliminated for now.
For example this is what my link looks like:
http://phpsnips.com/process/vote.php?id=43&vote=3&enc=a560e4320af4e13e4170947cd42de18bWith that, enc is different every time the page loads, and once the vote is submitted it is changed again.
My steps
- Use a session to create an md5 hash
- place the hash on the link or form hidden field
- On the submission page test to make sure the session matches the link/field
- Reset the hash
- Redirect back to the original page (if not using ajax)
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥30 STM32 INMP441无法读取数据
- ¥100 求汇川机器人IRCB300控制器和示教器同版本升级固件文件升级包
- ¥15 用visualstudio2022创建vue项目后无法启动
- ¥15 x趋于0时tanx-sinx极限可以拆开算吗
- ¥500 把面具戴到人脸上,请大家贡献智慧
- ¥15 任意一个散点图自己下载其js脚本文件并做成独立的案例页面,不要作在线的,要离线状态。
- ¥15 各位 帮我看看如何写代码,打出来的图形要和如下图呈现的一样,急
- ¥30 c#打开word开启修订并实时显示批注
- ¥15 如何解决ldsc的这条报错/index error
- ¥15 VS2022+WDK驱动开发环境