Zend - The PHP Company




Passwords

Add Code


Yet Another Password Generator  

Type: application
Added by: amirbilal1
Entered: 13/06/2006
Last modified: 09/12/2005
Rating: - (fewer than 3 votes)
Views: 2395
A simple and 'quick' random password generator of any length.


<?php
    
function randGen($len=6) {
        
$possible 'abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789';
        
$slen strlen($possible);
        
$ret '';
        for(
$i=0$i<$len$i++) {
            
$rnd rand(0$slen);
            
$ret .= $possible{$rnd};
        }
        return 
$ret;
    }
?>


Usage Example


<?php
    
echo randGen(10);
    
// will generate a password of 10 characters
?>


Rate This Script





Search



This Category All Categories