The generated activation code can be as simple as generating a random number with a fixed number of digits.
Personally, I do this, and then save the generated code in the database user table along with the username / password / email, etc., so that it can be quickly checked when the link is clicked and the verification code.
I usually use a "long" data type and generate 9-digit random numbers, and store these raw (not encoded) in the database for easy retrieval. Passwords must be encoded, but the activation code is a one-time, discarded value, so there is no need for any special consideration.
source share