<%
Option Explicit
Response.buffer = True
NumCode (8)   '注：1,4,7,10,13,16为彩色背景型 2,5,8,11,14,17为黑白型 3,6,9,12,15,18为噪点型
Function NumCode(CodeType)
    Response.Expires = -1
    Response.AddHeader "Pragma", "no-cache"
    Response.AddHeader "cache-ctrol", "no-cache"
    On Error Resume Next
    Dim zNum, rNum, i, j, listnum, listcode
    Dim Ados, Ados1
    listcode = "0123456789abcdefghijklmnopqrstuvwxyz"
    Randomize Timer
    Dim zimg(6), NStr
    For i = 0 To 5
        rNum = CStr(CInt(35 * Rnd)) '将35改为9即为使用纯数字密码
        zimg(i) = rNum
        listnum = listnum & Mid(listcode, rNum + 1, 1)
    Next
    Session("CheckCode") = listnum
    Dim Pos
    Set Ados = Server.CreateObject("Adodb.Stream")
    Ados.Mode = 3
    Ados.Type = 1
    Ados.Open
    Set Ados1 = Server.CreateObject("Adodb.Stream")
    Ados1.Mode = 3
    Ados1.Type = 1
    Ados1.Open
    Ados.LoadFromFile (Server.mappath("../img/body" & CodeType & ".Fix"))
    Ados1.write Ados.read(2880)
    For i = 0 To 5
        Ados.Position = (35 - zimg(i)) * 480
        Ados1.Position = i * 480
        Ados1.write Ados.read(480)
    Next
    Ados.LoadFromFile (Server.mappath("../img/head.fix"))
    Pos = LenB(Ados.read())
    Ados.Position = Pos
    For i = 0 To 15 Step 1
        For j = 0 To 5
            Ados1.Position = i * 32 + j * 480
            Ados.Position = Pos + 30 * j + i * 270
            Ados.write Ados1.read(30)
        Next
    Next
    Response.ContentType = "image/BMP"
    Ados.Position = 0
    Response.BinaryWrite Ados.read()
    Ados.Close: Set Ados = Nothing
    Ados1.Close: Set Ados1 = Nothing
    'If Err Then Session("CheckCode") = "999999"
End Function
%>