Verify password


SUBMITTED BY: Guest

DATE: March 27, 2015, 1:18 p.m.

FORMAT: PHP

SIZE: 429 Bytes

HITS: 1188

  1. function valide_motdepasse($chaine, $mode = 2){
  2. $minimum = array(1 => 4, 2 => 6, 3 => 8);
  3. $pourcentage = array(1 => 26, 2 => 51, 3 => 76);
  4. if(preg_match('#[a-z-0-9]{'.$minimum[$mode].',}#', $chaine)){
  5. $a_chaine = str_split($chaine);
  6. $c_uniques = array_unique($a_chaine);
  7. if(count($c_uniques)*100/count($a_chaine) >= $pourcentage[$mode]){
  8. return true;
  9. }
  10. }
  11. return false;
  12. }
  13. ?>

comments powered by Disqus