asp產生驗證碼程式

來源:互聯網
上載者:User

numcode (8)
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
    if len(trim(request("t")))<1 then
 session.timeout=1
    else
 if isnumeric(trim(request("t"))) then
  session.timeout=int(trim(request("t")))
 else
  session.timeout=1
 end if
    end if
    if len(trim(request("v")))<1 then
 session(sessionprefix&"syscode")=listnum
    else
 session(sessionprefix&trim(request("v")))=listnum
    end if
    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("www.111cn.net/body.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("images/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(sessionprefix&"checkcode") = "999999"
end function
%>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.