Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 21st, 2010 | Syntax: None | Size: 0.58 KB | Hits: 57 | Expires: Never
Copy text to clipboard
  1. find | grep PasswordGenerator
  2. ./lib/PasswordGenerator.class.php
  3. ./lib/sfPasswordGenerator.class.php
  4.  
  5. cat lib/sfPasswordGenerator.class.php
  6. <?php
  7.  
  8.   static public class sfPasswordGenerator {
  9.     static function get($chars = null) {
  10.       if(is_null($type))
  11.         $chars = "abcdefghijkmnopqrstuvwxyz023456789";
  12.  
  13.       srand((double)microtime()*1000000);
  14.       $i = 0;
  15.       $pass = '' ;
  16.  
  17.       while ($i <= 7) {
  18.         $num = rand() % 33;
  19.         $tmp = substr($chars, $num, 1);
  20.         $pass = $pass . $tmp;
  21.        $i++;
  22.       }
  23.       return $pass;
  24.     }
  25.   }