Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/articles/php-tutorials/)
-   -   Temporary Password Creator (http://www.go4expert.com/articles/temporary-password-creator-t268/)

pradeep 12Apr2005 08:30

Temporary Password Creator
 
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

shabbir 12Apr2005 11:31

Re: Temporary Password Creator
 
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


All times are GMT +5.5. The time now is 20:53.