Random PAssword Generation
Moderator: General Moderators
Random PAssword Generation
Hi. How would i generate a long radnom password, consisting of numbers and letters?
Code: Select all
<?php
$strList=array();
for ($i=48;$i<=57;$i++) $strList[]=chr($i);
for ($i=65;$i<=90;$i++) $strList[]=chr($i);
for ($i=97;$i<=122;$i++) $strList[]=chr($i);
$Pass="";
for ($i=0;$i<50;$i++) $Pass.=$strList[rand(0,count($strList)-1)];
echo $Pass;
?>You cannot get back MD5 values back. Either you have to generate a new password and mail or use mcrypt functions instead where you can encryt and decrypt using your own key.
http://www.php.net/manual/en/ref.mcrypt.php
http://www.php.net/manual/en/ref.mcrypt.php