외국인 주민번호 체크 루틴 추가
외국인 주민번호를 가지고 계신 분들의 경우에는 배포 원본 wrest.js 에서는 안되어 수정한 것입니다.
방법은 쉬워 금새 만들었지만 혹시나 저도 알고리즘을 잊어버릴까봐서 여기다 백업겸(?) 적어둡니다. ^^
wrest.js 에서
sum_1 = (juminno.charAt(0)*2)+
(juminno.charAt(1)*3)+
(juminno.charAt(2)*4)+
(juminno.charAt(3)*5)+
(juminno.charAt(4)*6)+
(juminno.charAt(5)*7)+
(juminno.charAt(6)*8)+
(juminno.charAt(7)*9)+
(juminno.charAt(8)*2)+
(juminno.charAt(9)*3)+
(juminno.charAt(10)*4)+
(juminno.charAt(11)*5);
sum_2=sum_1 % 11;
if (sum_2 == 0)
at = 10;
else
{
if (sum_2 == 1)
at = 11;
else
at = sum_2;
}
att = 11 - at;
// 외국인 주민번호 체크 추가
if(juminno.charAt(6) >= 6) {
if( ((juminno.charAt(7)*9)+(juminno.charAt(8)*2)) % 2)!=0 ) {
att = -1;
} else {
att += 2;
att = (att>10) ? att-10 : att;
}
}
// 1800 년대에 태어나신 분들은 남자, 여자의 구분이 9, 0 이라는
// 얘기를 들은적이 있는데 그렇다면 아래의 구문은 오류이다.
// 하지만... 100살넘은 분들이 주민등록번호를 과연 입력해볼까?
if (juminno.charAt(12) != att ||
juminno.substr(2,2) < '01' ||
juminno.substr(2,2) > '12' ||
juminno.substr(4,2) < '01' ||
juminno.substr(4,2) > '31')
// || juminno.charAt(6) > 6) : 외국인 주민번호 체크시에는 삭제
{
wrestMsg = wrestItemname(fld) + " : 올바른 주민등록번호가 아닙니다.("+att+")\n";
wrestFld = fld;
}
댓글 3개