php - Create a unique random token string in Yii for users table -


i working on yii app requires 'users' table have column 'token' need unique random string based upon user in table (eg there never same token twice).

can give me tips on doing this, or there yii component/extension/generator setup this.

also - optimised db column type this?

i suggest use hash, produces long string , use unique string hashed:

sha512($username.time().rand(1000, 9999)); 

some php hash algorithms lengths


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -