Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Random password

Parašė Reamis· 2011 Gru. 15 17:12:26
#2


<?php
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;
}
 
 
$password = createRandomPassword();
echo "Your random password is: $password";
?> 
 

Šaltinis: http://www.totallyphp.co.uk/crea...m-password