weixin_33736832 2012-10-21 20:02 采纳率: 0%
浏览 28

HTML / PHP-Promocode使用限制

So I have a website where you can register and use a specific registration code. However I want to limit the total use of the registration code to only 20 times. So the first 20 people who use it will get it, and then it'll be locked out meaning no one else can use the registration code. So if I have this input field:

Registration code: <input type="text" id="registration_code">​

Then I just want to grey the field out, or make it unclickable when the limit has been reached. My idea on how to do this would be to have an ajax call for the text field, which calls a php file that checks the number of times it is used already. The way it would do that is, I would have a specific 1-column table in my database that starts at the value of 0 and increments everytime the code is used. The php can retrieve that number and if it's <=20 then lock else, leave it open.

However, this seems like a very roundabout method, and I was hoping stack had some better ideas. Anyone know how to best deal with this kind of situation?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
    • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
    • ¥20 matlab yalmip kkt 双层优化问题
    • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
    • ¥88 实在没有想法,需要个思路
    • ¥15 MATLAB报错输入参数太多
    • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
    • ¥15 有赏,i卡绘世画不出
    • ¥15 如何用stata画出文献中常见的安慰剂检验图
    • ¥15 c语言链表结构体数据插入