Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Need the Token generation code for passport system.
only 50 tokens should be given in a single day,and the 51st registering person should get the first token for the next day...
Please replay As soon as possible...
Posted
Comments
Richard MacCutchan 19-Apr-15 3:21am    
You have tagged your (vague) question C++, C# and Java, but you have not given any useful information for people to help you. Assuming this is just about counting to 50, you should explain the problem in proper detail.

1 solution

Keep a track of tokens generated (or atleast count of tokens generated) in the database (or somewhere on the file system). Then stop token generation after 50 users per day.

Its an overhead, but it will ensure only a fifty users login to you application.

Storing in-memory can also be implemented, but it is risky as if your application crashes or restarts, this count could be lost.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900