php - Best Technique to Store Password History for Users? -


i in process of developing php login system. implement restriction users cannot use password have used (up 5 old passwords). best option storing passwords? came 2 idea's:

1) table: password column: passwordid, userid, password1, password2, password3, password4, password5, lastchanged, currentpassword. each user have own row. fill columns on time , rewrite accordingly.

or

2) table: password column: passwordid, userid, password, datechanged. each user have 6 rows. php handle figuring out of current via date.

option 2 better of 2 options except don't have worry deleting rows. rdbmss have way of selecting top n records based on something.

the major reason option 2 better, if either increase or decrease number of records have queried, can update database record.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -