Mailinglisten-Archive |
Hallo, >um ein Passwort zu erstllen tu ich dies: > > $matrix='qwertzuiopasdfghjklyxcvbnmQWERTZUIOPLKJHGFDSAYXCVBNM1234567890'; > for ($i=0;$i<5;$i++) > { > $password=$password.substr($matrix,rand(0,61),1); > } > >das blöde daran ist, dass immer wieder die gleichen Passwörter entstehen. >Weiss jemand rat? Try This: ------------------------------------- function make_pass() { $string=array("r","P","t","A","i","w","C","P","Y","p","a","b","c","d","e","f ","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y ","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R ","S","T","U","V","W","X","Y","Z"); srand((double)microtime()*1000000); $randval = rand(123456789,999999999); $werte[]=substr($randval,0,2); $werte[]=substr($randval,2,2); $werte[]=substr($randval,4,2); $werte[]=substr($randval,6,2); $werte[]=substr($randval,8,2); $werte[]=substr($randval,-1); for($j=0; $j<count($werte); $j++){ if($werte[$j]>52){ $werte[$j]=$werte[$j]/2; } if($werte[$j]>52){ $werte[$j]=$werte[$j]/2; } $pass.=$string[$werte[$j]]; } #$pass=substr($pass,-2); srand((double)microtime()*10); $randval=rand(10,99); $pass.=$randval; return $pass; } ------------------------------------------------ Mit bestem Gruss Ludwig Ruderstaller -- ______________________________________________________________ CWD - Creative Web Design http://www.cwd.at Ludwig Ruderstaller mailto:ruderstaller_(at)_cwd.at Tannengasse 19/1/46 Tel. +43 1 786 89 25 1150 Wien Fax. +43 1 786 89 84
php::bar PHP Wiki - Listenarchive