How to restrict the verification code to use only once
Suppose there is an activity that has been implemented: each account can only participate once.
In the case of a verification code, if someone through the acquisition of a verification code, by submitting the same verification code, switch different accounts to participate in the activity.
This approach is not achievable, if so, how to avoid it! Verification code and account number through some encryption binding, when submitted to verify?
------Solution--------------------
You can do this, add a verification code in the database field to set a unique property, as long as a login to the verification code to the account a verification code, so it can not be bound
------Solution--------------------
Do not know your specific implementation, suggest session or cookies after the user entered the verification code, immediately destroy the current value.
The verification code can be made longer, such as 5-6-bit, in order to reduce the mechanism to bring about duplication.
Hope to help you!!!
------Solution--------------------
So, provide a way of thinking.
Write the verification code that has been used to the data table, and then each time the user submits a verification code, the database is queried once, and there is a field that distinguishes whether the code has been used. This prevents the verification code from repeating, similar to the invitation code.