주민 번호 체크

function chk_social_no(jumin1,jumin2)
{
if ((jumin1.length != 6) || (jumin2.length != 7))
{
return false;
}
else
{
a = jumin1.substring( 0, 1) * 2;
b = jumin1.substring( 1, 2) * 3;
c = jumin1.substring( 2, 3) * 4;
d = jumin1.substring( 3, 4) * 5;
e = jumin1.substring( 4, 5) * 6;
f = jumin1.substring( 5, 6) * 7;
g = jumin2.substring(0, 1) * 8;
h = jumin2.substring(1, 2) * 9;
i = jumin2.substring(2, 3) * 2;
j = jumin2.substring(3, 4) * 3;
k = jumin2.substring(4, 5) * 4;
l = jumin2.substring(5, 6) * 5;

pivot = jumin2.substring(6,7);
sum = a + b + c + d + e + f + g + h + i + j + k + l;
modulus = sum % 11;
end_number = 11 - modulus;

if (end_number == 11)
{
end_number = 1;
}
else if (end_number == 10)
{
end_number = 0;
}
else
{
end_number = end_number;
}

if (pivot != end_number)
{
return false;
}
else
{
return true;
}
}
}
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2004/12/14 13:45 2004/12/14 13:45
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/60

Trackback URL : http://tcbs17.cafe24.com/tc/trackback/60

« Previous : 1 : ... 242 : 243 : 244 : 245 : 246 : 247 : 248 : 249 : 250 : ... 324 : Next »

블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2024/11   »
          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
Statistics Graph

Site Stats

Total hits:
244455
Today:
806
Yesterday:
776