• 获得验证码


    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>"  %>

  • 相关阅读:
    <<软技能,代码之外的生存技能>>读书笔记
    Pma模块详解,对用户登录linux等进行限制,密码修改限制等
    numpy pandas matplotlib
    numpy安装包scipy
    linux python 安装 nose lapack atlas numpy scipy
    kafka搭建
    实例化Bean的方法(基于xml配置)-http://blog.csdn.net/shymi1991/article/details/48153293
    转-Vue.js2.0从入门到放弃---入门实例(一)
    form表单传递对象数组
    使用ajax提交form表单,包括ajax文件上传 转http://www.cnblogs.com/zhuxiaojie/p/4783939.html
  • 原文地址:https://www.cnblogs.com/djcsch2001/p/2035732.html
Copyright © 2020-2023  润新知