Create random password in php to send at email address

Create random password in php to send at email address

Postby zahid on Tue Mar 31, 2009 7:06 pm

Sometime at the time of registration we take just email address and send random password to that email address and activation link

the following method helps to create random password :

function createRandomString(){
$len = 8;
$base='ABCDEFGHKLMNOPQRSTWXYZabcdefghjkmnpqrstwxyz123456789';
$max=strlen($base)-1;
$activatecode='';
mt_srand((double)microtime()*1000000);
while (strlen($activatecode)<$len+1)
$activatecode.=$base{mt_rand(0,$max)};

return $activatecode;

}


Hope it will work fine...
Have a nice day ....
zahid
 
Posts: 9
Joined: Mon Mar 16, 2009 11:11 am

Return to PHP

Who is online

Users browsing this forum: No registered users and 1 guest

cron