Twitsnip is a place to post code snippets and share them. Login with your existing Twitter account, if you don't have a Twitter account simply create on at www.twitter.com

PHP function to genarate a random password

PHP function to genarate a random password

0

I use this in case someone has forgotten there password alongside some other code. Hope it is useful!

function makeRandomPassword() { 
$salt = "abchefghjkmnpqrstuvwxyz0123456789"; 
          srand((double)microtime()*1000000);  
          $i = 0; 
          while ($i <= 7) { 
                $num = rand() % 33; 
                $tmp = substr($salt, $num, 1); 
                $pass = $pass . $tmp; 
                $i++; 
          } 
          return $pass; 
    }

Tags: Random Password

Comments

No comments yet

Login to Twitter to comment