I want to build a voucher system.
I am developing an application and want users to login from a database (preferable MS SQL). I want the DB to randomly create codes for users to top up their accounts. The codes will be unique in that they will be based on time. For example, a code like "238347428472" when allocated will be used for 10 hours. As the user is online, a counter will be checking how long the user has taken online and automatically deduct the time from the total time allocated. This process will continue until the user exhausts the entire 10 hours. If the user wants to login in again, he has to apply for another time (10, 20, 30 hours) depending on the user's choice.