Execute function only once

-2

At first, I've seen some issues like this here, but practically none of them fits / does not work in my scenario. It is as follows: I need a script to run (in my case, a button will be clicked automatically) only once (possibly recording some cookie, I believe ...) when a user accesses the page in question and disable that same script for any subsequent access or refresh on the page. How can I proceed?

    
asked by anonymous 31.12.2017 / 13:25

1 answer

1

It saves in the database whether it clicked or not. If you want it to never again push the button it is necessary to save in the database because cookies can be deleted, the user can access from another computer. In its place I would make a table that would store 0 or 1, if 0 is because it n clicked, if it has 1 then it already clicked, then I would not put the HTML of the button on the page or I would put% .

    
01.01.2018 / 18:50