Location: PHPKode > scripts > simplepass > simplepass/rnd_pass.php
<?php
/*

 simple password generation, heiko @ dillemuth dot de (c) 11/2002

 returns an alphanumeric string

 len (optional)    = lenght of string returned (max. 30)
 offset (optional) = code to generate password string, maybe the client ip address


 How to use

 $p=new rnd_pass();
 $p->rnd_pass(5, "mycodeword");               #Generate password with len=5 chars
 print $p->get_pass();

*/

class rnd_pass
{

  var $tmppass;

  function rnd_pass($len=5, $offset="codeword")
   {

    if($len>30)         #max. 30 Char
     $len=30;

    $pass=$offset.date("s:H:m:i:s");
    $this->tmppass=substr(md5($pass), 2, $len);

   }#endfunc


  function get_pass()
   {

    return $this->tmppass;
    
   }#endfunc

}#endclass


?>
Return current item: simplepass