网站。 VoteUp或VoteDown影片。如何限制用户投票多次?影片、用户、网站、VoteDown

2023-09-10 19:10:40 作者:心若浮沉,浅笑安然

进出口工作在网站上(HTML,CSS,JavaScript中,阿贾克斯,PHP和MySQL),我想限制的时间特定的用户投票数特定的视频。

它类似于YouTube的系统,您可以voteUp或voteDown特定视频。

每个表决包括添加一行到video.votes表,它记录的时间,投票方向(向上或向下),客户端ip地址(使用PHP:$ IP = $ _ SERVER ['REMOTE_ADDR']),以及相关视频的过程中ID。

添加票就是这么简单; (伪code):JavaScript的:的onClick(票(A,B,C,D)),它通过AJAX将变量传递到PHP插入脚本,最后我们更换voteing按钮用谢谢你投票消息

问题:

免登录 免安装 不限速,打开网页直接下载百度云

如果您重新加载/刷新投票页面后,您可以再次投票,又一次,又一次,你明白了吧。

我的问题:

你如何限制次数的特定用户票用于特定视频的量Δθ

我的想法:

你使用cookie,并添加一个新的cookie与视频的ID。并检查一个cookie你插入一个新的投票之前?

在你插入的票,你使用的ip地址和VIDEOID,看看这同一个用户(IP)投票支持在过去的24小时(mktime)同样的视频(vidID),以及允许或dissallow的voteInsertion基于此查询?

你只是不关心吗?以大多数用户是明智的,并且有更好的事情做的比刷新页面,并重复投票的假设。??

任何建议或想法表示欢迎。

解决方案   

你使用cookie,并添加一个新的cookie与视频的ID。并检查一个cookie你插入一个新的投票之前。?

缓存可以很容易地禁用或很快被清除。保存投票的cookie是不可靠的,票可以毫无问题地耍花招。

  

在你插入的票,你使用的ip地址和VIDEOID,看看这同一个用户(IP)投票支持在过去的24小时(mktime)同样的视频(vidID),以及允许或dissallow的voteInsertion基于此查询?

许多用户可以使用相同的路由器,有效地具有相同的IP。通过这样做,你可能会通过表决阻止他们刺激性的用户,因为另一个人来自同一个办公室/家庭向他们发送链接之前已经投票的视频。

  

你只是不关心吗?以大多数用户是明智的,并且有更好的事情做的比刷新页面,并重复投票的假设。?

这完全是主观的,依赖的选票的重要性。如果投票是网站的重要组成部分,这是最好的关心我,你所能。举例来说,如果视频被排序的收视率最高的,一些用户可能会投很多次,以增加他们的个人/最喜欢的视频的普及,给人气,吸引更多的意见IM pression。

凡有表决权是很重要的,这是最好的只允许注册用户投票。当然,人们可以而且将多个账户进行投票(见 http://gallery.live.com 一个例子),但你做了很多困难他们。如果投票是不是真的很重要,我会去用cookie的选项。

Im working on a website (html,css,javascript, ajax, php,mysql), and I want to restrict the number of times a particular user votes for a particular video.

Its similar to the YouTube system where you can voteUp or voteDown a particular video.

Each vote involves adding a row to the video.votes table, which logs the time, vote direction(up or down), the client IPaddress( using PHP: $ip = $_SERVER['REMOTE_ADDR']; ), and of course the ID of the video in question.

Adding votes is as simple as; (pseudocode): Javascript:onClick( vote( a,b,c,d ) ), which passes variables to PHP insertion script via ajax, and finally we replace the voteing buttons with a "Thank You For Voting" message.

THE PROBLEM:

If you reload/refresh the page after voting, you can vote again, and again, and again, you get the point.

MY QUESTION:

How do you limit the amount of times a particular user votes for a particular video??

MY THOUGHTS:

Do you use cookies, and add a new cookie with the id of the video. And check for a cookie before you insert a new vote.?

OR

Before you insert the vote, do you use the IPaddress and the videoID to see if this same user(IP) has voted for this same video(vidID) in the past 24hrs(mktime), and either allow or dissallow the voteInsertion based on this query?

OR

Do you just not care? Take the assumption that most users are sane, and have better things to do than refresh pages and vote repeatedly.??

Any suggestions or ideas welcome.

解决方案

Do you use cookies, and add a new cookie with the id of the video. And check for a cookie before you insert a new vote.?

Cookies can be easily disabled or very quickly cleared. Saving a vote to a cookie is unreliable and votes could be gamed with no problem.

Before you insert the vote, do you use the IPaddress and the videoID to see if this same user(IP) has voted for this same video(vidID) in the past 24hrs(mktime), and either allow or dissallow the voteInsertion based on this query?

Many users could be using the same router, effectively having the same IP. By doing this, you could be irritating users by stopping them from voting because another person from the same office/household has already voted on the video before sending them the link.

Do you just not care? Take the assumption that most users are sane, and have better things to do than refresh pages and vote repeatedly.?

This is entirely subjective and dependant on the importance of the votes. If voting is an important part of the site, it's best to care as much as you possibly can. For instance, if videos were sorted on highest rated, some users could vote many times to increase the popularity of their personal/favourite video, giving the impression of popularity to attract more views.

Where voting is important, it's best to only allow registered users to vote. Sure, people can and will make multiple accounts to vote (see http://gallery.live.com for an example), but you're making it a lot harder for them. If voting is not really important I would go with the cookie option.

 
精彩推荐
图片推荐