清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | <?php /* Class MAKEpasswd: Make password from selected characters in a string. required arguments: length of a password and characters to use in a password. 1 = a - z 2 = A - Z 3 = a - z and A - Z 4 = a - z, A - Z and 0 - 9 5 = a - z, A - Z, 0 - 9 and chars !#$%&() usage: Make 10 passwords that is 8 characters long and includes characters a - z, A - Z, 0 - 9 and !#$%&() $numTimes = 0; $example = new MAKEpasswd(8,5); while($numTimes < 10) { print($example->makePassword() . "<br>\n"); $numTimes++; } */ class MAKEpasswd { var $intLength ; var $pool ; function MAKEpasswd( $iLength , $iChars ) { $this ->intLength = $iLength ; $this ->pool = $this ->getPool( $iChars ); } function getPool( $iChars ) { switch ( $iChars ) { case 1: /* a - z */ for ( $i = 0x61; $i <= 0x7A; $i ++) { $str .= chr ( $i ); } return $str ; break ; case 2: /* A - Z */ for ( $i = 0x41; $i <= 0x5A; $i ++) { $str .= chr ( $i ); } return $str ; break ; case 3: /* a - z and A - Z */ $str = $this ->getPool(1); $str .= $this ->getPool(2); return $str ; break ; case 4: /* 0 - 9, A - Z and a - z */ $str = $this ->getPool(3); // get chars a - z and A - Z first for ( $i = 0x30; $i <= 0x39; $i ++) { $str .= chr ( $i ); // add chars 0 - 9; } return $str ; break ; case 5: /* This will add these chars into the string !#$%&() */ $str = $this ->getPool(4); for ( $i = 0x21; $i < 0x29; $i ++) { if ( $i == 0x22 || $i == 0x27) // Exclude characters " and ' { continue ; } $str .= chr ( $i ); } return $str ; break ; } } function makePassword() { srand ((double) microtime() * 1000000); $str = "" ; while ( strlen ( $str )< $this ->intLength) { $str .= $this ->pool[rand()% strlen ( $this ->pool)]; } return $str ; } } ?> |