Database Authentication


I want to use Database authentication in yii framework. Various posts are very helpful for this and I have implemented it successfully. Now there are two upgrades I want to introduce in it.


[*]A salt field in DB for each user.


It is an advanced version of existing DB Auth.

A. When a user is created a unique salt field will be generated randomly and inserted to the db along with the password. $random_salt = hash(‘sha512’, uniqid(mt_rand(1, mt_getrandmax()), true));

B. Password will be hashed using SHA512 Algorithm. $password = hash(‘sha512’, $password.$random_salt);

C. At the time of authentication it will be checked according to the above rules.

Is any body have idea how can I Insert salt field in the database at the time of new user creation. Salt field is not created initially when DB Auth is implemented. I have just created this field.