User Login

PHP: Generate Random AlphaNumeric Password / ID

sharkar's picture
From:
Akhaura
sharkar
I use Google ChromeI use SafariWindows User
Relationship Status:
Single & Looking
Joined: 11/03/2012
Drops: 23
Mood: Accomplished

Nice little PHP function that will generate a completely random password.

/*
* The letter l (lowercase L) and the number 1 have been removed, as they can be mistaken for each other
*/
 
function createRandomPassword() {
 
$chars = "abcdefghijkmnopqrstuvwxyz023456789";
srand((double)microtime()*1000000);
$i = 0;
$pass = '' ;
 
while ($i <= 7) {
  $num = rand() % 33;
  $tmp = substr($chars, $num, 1);
  $pass = $pass . $tmp;
  $i++;
}
 
return $pass;
}
 
// Usage
$password = createRandomPassword();
echo "Your random password is: $password";
I Averaged: 2 | 2 votes


Read More ...





Who's New

Pianpian qian's picture
Adonis David's picture
yezi8899's picture
Ponti233's picture
luowei04032025's picture
Benniehench03's picture
Yoeniscesp's picture
luissuraez798's picture
lishen's picture
ParkerBlair's picture
JackWalker's picture
LapHoan's picture
moontan's picture
Sjolund's picture
xxxmk's picture
facebook codes exploits tips tricks Phrozen Crew
All contents ©Copyright GeekDrop™ 2009-2026
TOS | Privacy Policy