PX : code

genpasswd by Karl Gray
Download this code


<?php
function genpasswd () {
$passwd="";
$i=0;
if (!(
$fd fopen ("/dev/urandom""r"))){
    echo 
"File open failed";
    exit;
}  
while(
$i!=8){
    
$c=fread($fd,1);
    
flush();
    if (
ereg ("[a-zA-Z0-9]" ,$c)) {
        
$passwd[$i]=$c;
        
$i++;
        }
    }
$passwd=implode ($passwd,"");    
fclose($fd);
return 
$passwd;
}
echo 
"This password is genpasswd()<br>
?>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.