Temporary Password Creator

pradeep's Avatar author of Temporary Password Creator
This is an article on Temporary Password Creator in PHP.
Many sites send you a temporary password after u sign up with them. Here is is how you too can do that

PHP Code:
function TempPassword($tp_len)
{
   
$pstring "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWXxYyZz0123456789";
   
$plen strlen($pstring);
      for (
$i 1$i <= $tp_len$i++)
      {
          
$start rand(0,$plen);
          
$temp_password.= substr($pstring$start1);
      }

    return 
$temp_password;


Example:
PHP Code:
$tp=TempPassword("9"); 
Result:
Code:
$tp= Ab72Pz3Rs

Go4Expert Founder
12Apr2005,11:31   #2
shabbir's Avatar
I have some different idea about generating random password. You can see that here http://www.go4expert.com/showthread.php?t=269

Thanks
Shabbir Bhimani