Zend - The PHP Company




Passwords

Add Code


Password generator  

Type: code fragment
Added by: lampa
Entered: 30/06/2002
Last modified: 03/12/2007
Rating: - (fewer than 3 votes)
Views: 5450
Modified santos_raj Auto Password Generation. Change $len to got other length (default 8 chars)


<?php
function make_password() {
    
$len 8;
    
mt_srand((double)microtime() * 1000000);
    
$pwd '';

    for(
$i 0$i $len $i++) {
    
$num mt_rand(48122);

        if ((
$num 96 && $num 123 ) || ($num 64 && $num 91) || ($num 47 && $num 58))
            
$pwd .= chr($num);
        else
            
$i--;
    }

    return 
$pwd;
}
?>


Usage Example


E27hQwar
lbOlLAze


Rate This Script





Search



This Category All Categories