asp 生成验证码程序代码

<%
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("../images/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("../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 = "images/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
%>

 

时间: 2025-01-30 10:42:25

asp 生成验证码程序代码的相关文章

asp 生成验证码实例代码

asp教程 生成验证码实例代码 call com_creatvalidcode("validcode") sub com_creatvalidcode(ps教程n)     ' 禁止缓存   response.expires = -1   response.expiresabsolute = now() - 1    response.cachecontrol = "no-cache"      'response.expires = -9999      'res

完美的php生成验证码程序代码

•新建一个PHP文件captcha_code_file.php  代码如下 复制代码 //首先开启session session_start(); //定义前台显示验证码长&宽 $image_width = 120; $image_height = 40; $characters_on_image = 6; $font = './monofont.ttf'; //The characters that can be used in the CAPTCHA code. //avoid confus

一个超简单asp生成验证码程序

<% sub getsafecode  dim test,result  on error resume next  set test=server.createobject("adodb.stream")  set test=nothing  if err then   dim znum   randomize timer   znum=cint(8999*rnd+1000)   session("safecode")=znum   result=sessi

asp生成验证码程序

<% Option Explicit Response.buffer=true Response.Expires = -1 Response.ExpiresAbsolute = Now() - 1 Call Com_CreatValidCode("GetCode") Sub Com_CreatValidCode(pSN)  'Author: Layen  'QQ: 84815733  'E-mail: support@ssaw.net  ' 禁止缓存  Response.Expi

ASP生成验证码详细教程

总共有三个文件.讲解如何通过ASP生成验证码.Asp文件:Code.Asp 数据文件:body.Fix , Head.Fix  用法:<img src="code.asp"> <%Option ExplicitResponse.buffer=trueNumCodeFunction NumCode()    Response.Expires = -1    Response.AddHeader "Pragma","no-cache"

php生成雪花背景验证码程序代码

验证码生成程序  代码如下 复制代码 <?php session_start(); session_register("login_check_number"); //昨晚看到了chianren上的验证码效果,就考虑了一下,用PHP的GD库完成了类似功能 //先成生背景,再把生成的验证码放上去 $img_height=120;    //先定义图片的长.宽 $img_width=40; if($HTTP_GET_VARS["act"]== "init

php 中文与英文验证码程序代码

//英文验证码相对简单,不要作hex处理,直接用色彩值就OK了.如果 session_start(); function rand_create() {     //通知浏览器将要输出PNG图片     Header("Content-type: image/PNG");     //准备好随机数发生器种子      srand((double)microtime()*1000000);     //准备图片的相关参数       $im = imagecreate(62,22);  

PHP 生成英文单词验证码程序代码

具体  代码如下 复制代码 $width=145; $height = 45;          $authcode = vcaptcha_read_code('words.txt') ;          $bg = 'bg/captcha_bg3.jpg';          $img_type   = 'png';          /* 验证码长度 */ $letters = strlen($authcode);          $img_bg    = (function_exist

ASP.net 验证码实现代码(C#)_实用技巧

public class ValidateCode : System.Web.UI.Page {   private void Page_Load(object sender, System.EventArgs e)   {    this.CreateCheckCodeImage(GenerateCheckCode());   }   #region Web 窗体设计器生成的代码   override protected void OnInit(EventArgs e)   {    //