Javascript - How to "block" access to a website and unlock it if the user likes a particular facebook page or waits a certain time?

Asked

Viewed 90 times

0

The idea is to create a div within the entire body of the site for the user to view when entering, so it would have something like "Like the page to enter now or wait 30 seconds". The part of time you can do in js with setinterval and getelement to give a display:One after 30 seconds, the problem is the like part, how to do and how not to display the message again if the user has already liked.

  • What back-end language are you using?

  • I don’t think Facebook allows this kind of behavior anymore. It was very "popular" a few years ago and eventually the Facebook policy on this changed. Any solution you use without confirming with Facebook if the user gave like, it is easy to overcome. You would have to have an app submitted and approved with Facebook to be able to "ask" if the user gave like, but if you are approved and eventually reported, you will be blocked.

1 answer

0

You can record the ip of the user who liked in the database of your application and if you access again you will not be able to like again, because will bar by ip.

I don’t know what server language you’re using, but in PHP you get the IP like this

$_SERVER['REMOTE_ADDR']

I hope I’ve helped.

  • I understood the idea, but what about detecting that he liked the page as I would?

  • Make a query in the bank where the field you saved the ip is equal to the access ip. If return value he can no longer enjoy, because already enjoyed earlier.

  • And if the guy restarts the modem and gets a new IP?

  • It is a risk to take. To avoid this risk it would have to be necessary for the user to log in and filter through the login.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.