Example #1
0
function count_syl($str)
{
    if (is_numeric($str)) {
        return count_numbers($str);
    }
    if (ctype_upper($str)) {
        return strlen($str);
    }
    $str = strtolower($str);
    if (strlen($str) <= 3) {
        return 1;
    }
    $str = preg_replace('/(?:[^laeiouy]es|ed|[^laeiouy]e)$/', '', $str);
    // var_dump($str);
    $str = preg_replace('/^y/', '', $str);
    // var_dump($str);
    preg_match_all('/[aeiouy]{1,2}/', $str, $matches);
    // var_dump($matches);
    return count($matches[0]);
}
Example #2
0
 /**
  * 회원가입시 패스워드가 올바른 규약에 의해 입력되었는지를 체크하는 함수입니다
  */
 public function _mem_password_check($str)
 {
     $uppercase = $this->cbconfig->item('password_uppercase_length');
     $number = $this->cbconfig->item('password_numbers_length');
     $specialchar = $this->cbconfig->item('password_specialchars_length');
     $this->load->helper('chkstring');
     $str_uc = count_uppercase($str);
     $str_num = count_numbers($str);
     $str_spc = count_specialchars($str);
     if ($str_uc < $uppercase or $str_num < $number or $str_spc < $specialchar) {
         $description = '비밀번호는 ';
         if ($str_uc < $uppercase) {
             $description .= ' ' . $uppercase . '개 이상의 대문자';
         }
         if ($str_num < $number) {
             $description .= ' ' . $number . '개 이상의 숫자';
         }
         if ($str_spc < $specialchar) {
             $description .= ' ' . $specialchar . '개 이상의 특수문자';
         }
         $description .= '를 포함해야 합니다';
         $this->form_validation->set_message('_mem_password_check', $description);
         return false;
     }
     return true;
 }