如何验证信用卡是否可用?

    核实信用卡的真伪是一件麻烦的事儿,看看下面的代码,也许会给你帮上忙:

<Script runat=server language=vbscript>
function mod10(cardNo)
lCard=len(cardNo)
lC=right(cardNo,1)
cStat=0
for i=(lCard-1) to 1 step -1
tempChar= mid(cardNo,i,1)
d=cint(tempChar)
if lcard mod 2 = 1 then
temp=d*(1+((i+1) mod 2))
else
temp=d*(1+(i mod 2))
end if
if temp < 10 then
cStat = cStat + temp
else
cStat = cStat + temp - 9
end if
next
cStat = (10-(cStat mod 10)) mod 10
if cint(lC) = cStat then
mod10 = true
end if
end function
</script>

posted on 2008-12-08 11:20  cqsar  阅读(335)  评论(0编辑  收藏  举报