简体   繁体   中英

How can I use mysql to save user state, so that they can only perform an action once per day?

< button type="button" id="daily-reward-button">Claim< /button>

1)When a User press this Button -> Button gets Disabled (User gets Banned in MYSQL /cannot Press it again)

2) After day changes at 00:00:01am re-enable it (Unban User in MYSQL)

I want Users not to be able to bypass this restriction by just deleting their cookies etc, that is why I think it must be done in co-operation with MYSQL.

I am a newbie so any extra information-explanation like im 5 would be much appreciated.

Thank you in advance.

Best Regards,

Chris

That is A LOT of components working together. User state is going to have to be saved by your front end JavaScript as well as your PHP/SQL backend.

What is supposed to happen if the user clicks the browser away? It hasn't to poll the PHP/SQL, and also keep the information in the JavaScript.

What is supposed to happen if the user changes machines? Do you remember his login username? Have you implemented usernames and passwords?

If you just want to disable a button in JavaScript, and not communicate any state to the server, that's one thing (usually 1 or 2 lines of JavaScript), but if you have users, you will need an end to end solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM