Reputation: 23
I have some problem to solve. I created a website. Website's member has their(A) own page(like blog) and if someone stays in their(A) page for more than a minute, they(A) can earn some points. And by this point they can buy stuff. So radically members(A) should advertise their(A) page, but some members tries to just earn the points using negative ways. Like changing IP and keep visiting their own page.
This is the current way that I'm using
But some people figured out this and keep changing their IP and visiting their own page.
Further ways I thought about it was using cookie.
So what i want to ask is,
Is there a way to set cookie after a minute when visitor visited site? If not, are there any brilliant way to prevent people from changing their IP?
Upvotes: 2
Views: 170
Reputation: 24182
You can't control user's IP, so you will need to track them.
You set a cookie immediately at visit, and in the cookie you can store the date and time of the visit. Each time the user visits your site, read the cookie and check if it contains a time before a minute, then credit the site. Then you can set something else in this cookie, to flag that this user has already received credit. Or, even better, use $_SESSION to store the same things, as a SESSION object will expire if the user stays idle for some time. The SESSION relies usually on cookies anyway (so the next part of the message still holds true).
Now, what if a user deletes his cookie? You have the same problem.
So you should probably resort to some more obscure way to tracking your users. Possibilities: browser fingerprinting (server side), flash cookies, html5 local storage (client side). A user could use multiple browsers, but there are only so many one can install in one computer. You can research those terms and you will find plenty of material. You can also mix those techniques, and add the IP check on top of them... But it will require some develompen time...
Upvotes: 1