Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/140307-best-way-to-count-unique-hits/
Share on other sites

'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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.