zoukankan      html  css  js  c++  java
  • 最简单的asp验证码

    <%
    Public Function BornVerifyCode()
             Randomize '设置随机因子
             BornVerifyCode=Mid((Rnd * 1000000), 1, 4) '生成6位随机数,取高4位
          End Function
    %>

    调用:<%=BornVerifyCode%>

    <%
    Function CheckCode
           const theNum = 4              '设置位数,修改就是了
    '*************************************************************
           dim strCode,theCodes,str0
           theCodes = ""    '初始化验证码字符
                strCode = "123456789AABCDEFGHI135GGW468HJKLMNTPQRS148963TUVWR"
                strCode = LCASE(strCode)    '全部换成小写,当然也可不换
           RANDOMIZE
               for i = 1 to theNum  
                    '循环结构重复筛选单个字符进行组合,生成theNum位的验证码
               str0=mid(strCode,INT((50-1+1)*RND+1),1)  
                    'str0为一次循环周期内经筛选的单个临时字符
               theCodes = theCodes&str0    '字符叠加过程
               next
           if theCodes = "" then 
                    theCodes = "9999"  
                end if        
           Session("SystemRocCode") = cstr(theCodes) 
                '将字符结果保存在Seesion中
           Response.Write theCodes    '显示出验证字符
    End Function
    %>

    调用:<%=CheckCode%>

  • 相关阅读:
    HDU 1950 Bridging signals
    HDU 1025 (LIS+二分) Constructing Roads In JGShining's Kingdom
    HDU 1160 FatMouse's Speed
    HDU 1257 最少拦截系统
    HDU 1574 RP问题
    解同余式ax ≡ c(mod m)
    拓展欧几里得算法及代码实现
    百练 1088 滑雪
    [再做01背包] POJ 3624 Charm Bracelet
    百练 2755 神奇的口袋
  • 原文地址:https://www.cnblogs.com/ince/p/10424897.html
Copyright © 2011-2022 走看看