天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

PHP生成隨機密碼類分享

類代碼:

<?php/** * php - Password Generator Class * Version 1.0.0 * */ if (@!is_object($passGen) || !isset($passGen)) {  $passGen = new Password;} class Password{   /**   * 大寫字母 A-Z   *   * @var array   */  protected $uppercase_chars;   /**   * 小寫字母 a-z   *   * @var array   */  protected $lowercase_chars;   /**   * 阿拉伯數字 0-9   *   * @var array   */  protected $number_chars;   /**   * 特殊字符   *   * @var array   */  protected $special_chars;   /**   * 其他特殊字符   *   * @var array   */  protected $extra_chars;   /**   * 最終用來生成密碼的所有字符   *   * @var array   */  protected $chars = array();   /**   * 密碼長度   *   * @var array   */  public $length;   /**   * 是否使用大寫字母   *   * @var boolean   */  public $uppercase;   /**   * 是否使用小寫字母   *   * @var boolean   */  public $lowercase;   /**   * 是否使用阿拉伯數字   *   * @var boolean   */  public $number;   /**   * 是否使用特殊字符   *   * @var boolean   */  public $special;   /**   * 是否使用額外的特殊字符   *   * @var boolean   */  public $extra;   /**   * 初始化密碼設置   *   * @param int $length   */  function Password($length = 12)  {    $this->length = $length;         $this->configure(true, true, true, false, false);  }   /**   * 配置   */  function configure($uppercase = false, $lowercase = false, $number = false,            $special = false, $extra = false  ) {    $this->chars = array();     $this->upper_chars  = array(                 "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"                );    $this->lower_chars  = array(                 "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"                );    $this->number_chars = array(                 "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"                );    $this->special_chars = array(                 "!", "@", "#", "$", "%", "^", "&", "*", "(", ")"                );    $this->extra_chars  = array(                 "[", "]", "{", "}", "-", "_", "+", "=", "<",                 ">", "?", "/", "`", "~", "|", ",", ".", ";", ":"                );     if (($this->uppercase = $uppercase) === true) {      $this->chars = array_merge($this->chars, $this->upper_chars);    }    if (($this->lowercase = $lowercase) === true) {      $this->chars = array_merge($this->chars, $this->lower_chars);    }    if (($this->number = $number) === true) {      $this->chars = array_merge($this->chars, $this->number_chars);    }    if (($this->special = $special) === true) {      $this->chars = array_merge($this->chars, $this->special_chars);    }    if (($this->extra = $extra) === true) {      $this->chars = array_merge($this->chars, $this->extra_chars);    }     $this->chars = array_unique($this->chars);  }     /**   * 從字符列中生成隨機密碼   *   * @return string   **/  function generate()  {    if (empty($this->chars)) {      return false;    }     $hash    = '';    $totalChars = count($this->chars) - 1;         for ($i = 0; $i < $this->length; $i++) {      $hash .= $this->chars[$this->random(0, $totalChars)];    }     return $hash;  }   /**   * 生成隨機數字   *   * @return int   */  function random($min = 0, $max = 0)  {    $max_random = 4294967295;     $random = uniqid(microtime() . mt_rand(), true);    $random = sha1(md5($random));     $value = substr($random, 0, 8);    $value = abs(hexdec($value));     if ($max != 0) {      $value = $min + ($max - $min + 1) * $value / ($max_random + 1);    }     return abs(intval($value));  }}

調用:

<?php include_once 'password.class.php'; echo $passGen->generate(); //FS4yq74e2LeE

php技術PHP生成隨機密碼類分享,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 在线黑人抽搐潮喷 | 国产情侣真实露脸在线 | 三级黄视频 | 两个女人互添下身高潮自视频 | 一抽一出BGM免费50分动漫 | 中文字幕本庄优花喂奶 | 欧美黑人巨大性极品hd欧 | 动漫女主被扒开双腿羞辱 | YELLOW视频在线观看免费版高清 | 交换邻居波多野结衣中文字幕 | 色欲久久综合亚洲精品蜜桃 | 色偷偷亚洲天堂 | 天美传媒在线观看免费完整版 | 18禁在线无遮挡羞羞漫画 | 老少配xxxxx欧美| 免费99精品国产自在现线 | 午夜免费啪视频观看视频 | 男人J桶进男人屁股过程 | 国产精品麻豆a啊在线观看 国产精品麻豆AV | 乌克兰粉嫩摘花第一次 | 久久成人伊人欧洲精品AV | 又大又硬又爽免费视频 | 亚洲视频在线看 | 久草草在线视视频 | 老师在讲桌下边h边讲课 | 97午夜理论片影院在线播放 | S货SAO死你BL大点声叫BL | 999久久久无码国产精蜜柚 | 99久久全国免费久久爱 | 无码观看AAAAAAAA片 | 日本欧美久久久久免费播放网 | 欧美人与动交zOZ0 | 国产中文视频无码成人精品 | 极品少妇高潮啪啪AV无码 | 久久人妻AV一区二区软件 | 亚洲一区免费在线观看 | WWW久久只有这里有精品 | 男欢女爱免费视频 | 成人免费在线观看视频 | 情浓野战台湾三级 | 97国产揄拍国产精品人妻 |