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

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -