[英]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> <button type="button" id="daily-reward-button">声明</button>
1)When a User press this Button -> Button gets Disabled (User gets Banned in MYSQL /cannot Press it again) 1)当用户按下此按钮时 -> 按钮被禁用(用户在 MYSQL 中被禁止/不能再次按下它)
2) After day changes at 00:00:01am re-enable it (Unban User in MYSQL) 2)在上午 00:00:01 更改后重新启用它(在 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.我希望用户不能仅仅通过删除他们的 cookie 等来绕过这个限制,这就是为什么我认为它必须与 MYSQL 合作完成。
I am a newbie so any extra information-explanation like im 5 would be much appreciated.我是一个新手,所以任何像 im 5 这样的额外信息解释将不胜感激。
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.
用户状态必须由前端 JavaScript 以及 PHP/SQL 后端保存。
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.
它没有轮询 PHP/SQL,也将信息保存在 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.如果您只想禁用 JavaScript 中的按钮,而不向服务器传达任何状态,那是一回事(通常是 1 或 2 行 JavaScript),但如果您有用户,则需要端到端的解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.