Un generatore casuale di password è una funzione abbastanza comune utilizzato da siti web in codice PHP. Quello qui sotto è quello che io uso per molti siti web.
<? php / ** * Random Password Generator * @ Pubblico * @ Param int $ length lunghezza della password per generare Restituisce una stringa * @ return randomizzati password * / randomPword funzione ($ length) ( $ seed = 'ABC123DEF456GHI789JKL0MNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; seedLength $ = strlen ($ seed); $ random =''; for ($ i = 1; $ i <= $ length; $ i + +) ( charPos $ = mt_rand (0, ($ seedLength - 1)); $ singleChar = substr (sementi, $ charPos, 1); $ random .= $ singleChar; ) return $ random; ) ?>
Hope it helps! Gustare!




















































