• 获得验证码


    1.在许多论坛的登录页面上,都有一个附加码,这样做的目的是防止有人利用破解程序,暴力破解里面的密码

    2.生成附加码的代码:

    <%

        Response.Buffer=false

        NumCode

        Function NumCode()

            Response.Expires=-1

            Response.AddHeader "Progma","no-cache"

            Response.AddHeader "cache-control","no-cache"

            dim rndnum,i,j

            dim Ados,Ados1

            Do While len(rndnum)<4

                num1=Cstr(Chr((57-48)*rnd +48))

                rndnum=rndnum & num1

            loop

            Session("adminid")=rndnum

            dim zimag(4),nstr

            nstr=cstr(rndnum)

            for i=0 to 3

                zimag(i)=cint(mid(nstr,i+1,1))

            next

            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

            Ados1.LoadFromFile(Server.mapPath("images/body.Fix"))

            Ados1.Write Ados.read(1280)

            for i=0 to 3

                Ados.Position=(9-zimage(i))*320

                Ados1.Position=i*320

                Ados1.Write Ados.read(320)

            next

            Ados.LoadFromFile(Server.mapPath("images/head.fix"))

            Pos=lenb(Ados.read())

            Ados.Position=pos

            for i=0 to 9 step 1

                for j=0 to 3

                    Ados.Position=i*32+j*320

                    Ados1.Postion=pos+30*j+i*120

                    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    

        End Function

    %>

    3.调用方法

    <% response.write "<img src=code.asp>"  %>

  • 相关阅读:
    面向对象一
    模块二:os模块、sys模块、json模块、pickle模块,包
    模块一:时间模块、random模块、hashlib模块、日志模块
    异常处理、迭代器、推导式、生成器
    有参装饰器
    匿名函数、高阶函数
    装饰器
    函数对象、函数嵌套、闭包函数
    名称空间与作用域
    day17 django 相关
  • 原文地址:https://www.cnblogs.com/djcsch2001/p/2035732.html
Copyright © 2020-2023  润新知