basically there are "view counts" ( ie, number of times a video is viewed) on my video page im having problem with some of my members they purposely click the video they submitted to increase the popularity of the video ( say after submission he clicked the video 100 times so that it will come top in the list ) so i want to restrict it if he watch it with same ip address 100 or 10000 times it should show only 1 view count (from him) on my video page. im not good in php can you please tell me step by step what to do thanks here is the code i have on my video page mysql_query("UPDATE videos SET view = view+1 WHERE id = '$id'"); Code (markup): Any help really appreciated Thanks !!!
For this you need to create a new table which will keep the track of the visitors who watched the videos. The table will contain at least 2 fields i.e. video_id, ip_address Whenever a user click on the video, save its IP and the video id in this new table. And before updating the view count, make sure the IP and video do not exist more than once in the table.
if(!session_is_registered('viewed_' . $id)) { mysql_query("UPDATE videos SET view = view+1 WHERE id = '$id'"); $_SESSION['viewed_' . $id] = true; } Code (markup): Well, the code above won't avoid the same thing to happen at all. But AT LEAST, the code can reduce it.