cfoe
2012-06-27 f0b3e5fe4f3d40a95e1f4f6e8cd62246a7c93c83
interface/lib/classes/auth.inc.php
@@ -123,6 +123,25 @@
         exit;
      }
   }
   public function get_random_password($length = 8) {
      $base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
      $password = '';
      for ($n=0;$n<$length;$n++) {
         $password.=$base64_alphabet[mt_rand(0,63)];
      }
      return $password;
   }
   public function crypt_password($cleartext_password) {
      $salt="$1$";
      $base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
      for ($n=0;$n<8;$n++) {
         $salt.=$base64_alphabet[mt_rand(0,63)];
      }
      $salt.="$";
      return crypt($cleartext_password,$salt);
   }
      
}