php - Most efficient way of checking if a user as activated his/her account? -


I want my users to be able to activate their accounts before being able to login, they can register with an activation link After an email is sent, something like this:

Of course, when anyone logs in, I have to see the weather or not that the user has activated it / In his account, I can think of two ways to solve this problem, either my 'use' The subject is an extra column in the table, which is set to free whenever the user is active:

  ----- --------- --------------------------------- | ID | Username Password | Activation_token | ----------------------------------------------- | 1 | User1 | Blala | | ----------------------------------------------- | 2 | User1 | Blala | Asd232DA34qADJs2 | -----------------------------------------------  

Then whenever user logs in, I remove activation_token with user information. Or I may have a separate table that contains only activation tokens, which are then linked to the 'Users' table each time the user logs in:

  -------- ----------------------------- | ID | Account_id | Activation_token | -------------------------------------- | 1 | 37 | Dsad2428491dka98 -------------------------------------- | 2 | 2 | Asd232DA34qADJs2 | --------------------------------------  

then Which would be the most efficient? Thanks for your time.

Edit: Thanks for all the great responses

< P> Personally, I want to combine two ...

  ------------------------ ------------- | ID | Username Password | Position | ------------------------------------- | 1 | User1 | Blala | 1 | ------------------------------------- | 2 | User1 | Blala | 0 | -----------------------------------  

from where Status is a TINYINT (1) area that is 0 for passive users, and 1 for active users. In this way, you can actually tell the user's "status" quickly ...

Then, store the token in another table (just like you) ... in this way, You do not need to join to join or check the string column when the account is not active ...


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -