Exoon Posted January 10, 2009 Share Posted January 10, 2009 Hello, I'm doing a video streaming script similar to youtube kinda and i was wondering what would be the best way to make sure that people can only make the hits go up once. I want it so if a user uploads a video they can sort by how many views etc so it needs to be unique to stop the user just pressing F5, 1000s of times to get to the top. At the moment im putting the IP into a database but i was thinking if the site starts to grow rapidly the amount of input into the database is going to be massive. What would you suggest i do. Thanks Exoon Quote Link to comment https://forums.phpfreaks.com/topic/140307-best-way-to-count-unique-hits/ Share on other sites More sharing options...
auro Posted January 10, 2009 Share Posted January 10, 2009 Friend, As I think, the way you are using to do the needful is the best. Quote Link to comment https://forums.phpfreaks.com/topic/140307-best-way-to-count-unique-hits/#findComment-734185 Share on other sites More sharing options...
.josh Posted January 10, 2009 Share Posted January 10, 2009 only way is to require login to view. Quote Link to comment https://forums.phpfreaks.com/topic/140307-best-way-to-count-unique-hits/#findComment-734189 Share on other sites More sharing options...
Exoon Posted January 10, 2009 Author Share Posted January 10, 2009 How would a massive site like youtube track their visits for each video then, same way as i am? Quote Link to comment https://forums.phpfreaks.com/topic/140307-best-way-to-count-unique-hits/#findComment-734201 Share on other sites More sharing options...
.josh Posted January 10, 2009 Share Posted January 10, 2009 'unique' visitors without login are always an estimation. You can start a session that tracks the IP for the duration of the session. Simply refreshing the browser won't end the session, so you can continue to track the IP based on that. Don't increment page view as long as session is active and IP matches on stored in session var. You can also attempt to set a cookie. If client accepts cookies, you can set one and check for it. Don't increment if cookie is found. Neither of those things are 100% insurance that user is unique. Cookies can be disallowed. Someone could be going through a proxy. So, the only way to ensure unique views is to require user to register/login. Quote Link to comment https://forums.phpfreaks.com/topic/140307-best-way-to-count-unique-hits/#findComment-734213 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.