Posts Tagged password

Generate Random Password with php

Generate a random password is very common issue. lots of people do it in different way. well, we can do it very quickly. its very simple easy two line code for generate random password.

function gen_md5_password($len = 6) {
// function calculates 32-digit hexadecimal md5 hash
// of some random data
return substr(md5(rand().rand()), 0, $len);
}

From your main function we have to just call this function like:

$random_pass = gen_md5_password();
echo $random_pass;

this will show different random number. $len variables value can be change. if we are willing to make a random number of 12 digit. we have to set $len=12.

like: function gen_md5_password($len = 12)

Add comment December 13, 2008


My Profile


# Software Eng. # Worked with C,C++, JAVA and PHP. #Love to play with codes. # Mostly like to do programming with 'C'. # I am not a CODER, but a DEVELOPER.

Admin Panel..

Life Cycle

December 2009
S S M T W T F
« Sep    
 1234
567891011
12131415161718
19202122232425
262728293031  

Clouds

cakephp codeIgniter desktop htaccess jscript linux mixed my words php regular expression

Just Posted

TOP R@TED

TaGs

cakephp codeIgniter desktop GP htaccess image upload installation jscript linux news password Personal Life php regular_Xpression script session validation

Archives

Top Posts

CoMmEnTs

Blog Stats

My Web Links

Web Links

RSS Xperts.PHP