濮阳杆衣贸易有限公司

主頁 > 知識庫 > asp無組件生成驗證碼 GIF圖片格式

asp無組件生成驗證碼 GIF圖片格式

熱門標(biāo)簽:java外呼系統(tǒng)是什么 梧州市地圖標(biāo)注 武穴地圖標(biāo)注 石家莊慧營銷外呼系統(tǒng) 外呼線路批發(fā) 濟(jì)源電銷外呼系統(tǒng)線路 地圖標(biāo)注陽江 世界地圖標(biāo)注了哪些城市 創(chuàng)意電話機(jī)器人
復(fù)制代碼 代碼如下:

%
Option Explicit ' 顯示聲明
Class Com_GifCode_Class
'''''''''''''''''''''''''''''''''''''''''''''
' Author: Layen support@ssaw.net 84815733(QQ)
' Thanks: Laomi, Laomiao, NetRube
' 2006-01-02
'''''''''''''''''''''''''''''''''''''''''''''
Public Noisy, Count, Width, Height, Angle, Offset, Border
Private Graph(), Margin(3)
Private Sub Class_Initialize()
Randomize
Noisy = 16 ' 干擾點(diǎn)出現(xiàn)的概率
Count = 4 ' 字符數(shù)量
Width = 80 ' 圖片寬度
Height = 20 ' 圖片高度
Angle = 2 ' 角度隨機(jī)變化量
Offset = 20 ' 偏移隨機(jī)變化量
Border = 1 ' 邊框大小
End Sub
Public Function Create()
Const cCharSet = "123456789"
Dim i, x, y
Dim vValidCode : vValidCode = ""
Dim vIndex
ReDim Graph(Width-1, Height-1)
For i = 0 To Count - 1
vIndex = Int(Rnd * Len(cCharSet))
vValidCode = vValidCode + Mid(cCharSet, vIndex+1 , 1)
SetDraw vIndex, i
Next
Create = vValidCode
End Function
Sub SetDot(pX, pY)
If pX * (Width-pX-1) >= 0 And pY * (Height-pY-1) >= 0 Then
Graph(pX, pY) = 1
End If
End Sub
Public Sub SetDraw(pIndex, pNumber)
' 字符數(shù)據(jù)
Dim DotData(8)
DotData(0) = Array(30, 15, 50, 1, 50, 100)
DotData(1) = Array(1 ,34 ,30 ,1 ,71, 1, 100, 34, 1, 100, 93, 100, 100, 86)
DotData(2) = Array(1, 1, 100, 1, 42, 42, 100, 70, 50, 100, 1, 70)
DotData(3) = Array(100, 73, 6, 73, 75, 6, 75, 100)
DotData(4) = Array(100, 1, 1, 1, 1, 50, 50, 35, 100, 55, 100, 80, 50, 100, 1, 95)
DotData(5) = Array(100, 20, 70, 1, 20, 1, 1, 30, 1, 80, 30, 100, 70, 100, 100, 80, 100, 60, 70, 50, 30, 50, 1, 60)
DotData(6) = Array(6, 26, 6, 6, 100, 6, 53, 100)
DotData(7) = Array(100, 30, 100, 20, 70, 1, 30, 1, 1, 20, 1, 30, 100, 70, 100, 80, 70, 100, 30, 100, 1, 80, 1, 70, 100, 30)
DotData(8) = Array(1, 80, 30, 100, 80, 100, 100, 70, 100, 20, 70, 1, 30, 1, 1, 20, 1, 40, 30, 50, 70, 50, 100, 40)
Dim vExtent : vExtent = Width / Count
Margin(0) = Border + vExtent * (Rnd * Offset) / 100 + Margin(1)
Margin(1) = vExtent * (pNumber + 1) - Border - vExtent * (Rnd * Offset) / 100
Margin(2) = Border + Height * (Rnd * Offset) / 100
Margin(3) = Height - Border - Height * (Rnd * Offset) / 100
Dim vStartX, vEndX, vStartY, vEndY
Dim vWidth, vHeight, vDX, vDY, vDeltaT
Dim vAngle, vLength
vWidth = Int(Margin(1) - Margin(0))
vHeight = Int(Margin(3) - Margin(2))
' 起始坐標(biāo)
vStartX = Int((DotData(pIndex)(0)-1) * vWidth / 100)
vStartY = Int((DotData(pIndex)(1)-1) * vHeight / 100)
Dim i, j
For i = 1 To UBound(DotData(pIndex), 1)/2
If DotData(pIndex)(2*i-2) > 0 And DotData(pIndex)(2*i) > 0 Then
' 終點(diǎn)坐標(biāo)
vEndX = (DotData(pIndex)(2*i)-1) * vWidth / 100
vEndY = (DotData(pIndex)(2*i+1)-1) * vHeight / 100
' 橫向差距
vDX = vEndX - vStartX
' 縱向差距
vDY = vEndY - vStartY
' 傾斜角度
If vDX = 0 Then
vAngle = Sgn(vDY) * 3.14/2
Else
vAngle = Atn(vDY / vDX)
End If
' 兩坐標(biāo)距離
If Sin(vAngle) = 0 Then
vLength = vDX
Else
vLength = vDY / Sin(vAngle)
End If
' 隨機(jī)轉(zhuǎn)動角度
vAngle = vAngle + (Rnd - 0.5) * 2 * Angle * 3.14 * 2 / 100
vDX = Int(Cos(vAngle) * vLength)
vDY = Int(Sin(vAngle) * vLength)
If Abs(vDX) > Abs(vDY) Then vDeltaT = Abs(vDX) Else vDeltaT = Abs(vDY)
For j = 1 To vDeltaT
SetDot Margin(0) + vStartX + j * vDX / vDeltaT, Margin(2) + vStartY + j * vDY / vDeltaT
Next
vStartX = vStartX + vDX
vStartY = vStartY + vDY
End If
Next
End Sub
Public Sub Output()
Response.Expires = -9999
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-ctrol", "no-cache"
Response.ContentType = "image/gif"
' 文件類型
Response.BinaryWrite ChrB(Asc("G")) ChrB(Asc("I")) ChrB(Asc("F"))
' 版本信息
Response.BinaryWrite ChrB(Asc("8")) ChrB(Asc("9")) ChrB(Asc("a"))
' 邏輯屏幕寬度
Response.BinaryWrite ChrB(Width Mod 256) ChrB((Width \ 256) Mod 256)
' 邏輯屏幕高度
Response.BinaryWrite ChrB(Height Mod 256) ChrB((Height \ 256) Mod 256)
Response.BinaryWrite ChrB(128) ChrB(0) ChrB(0)
' 全局顏色列表
Response.BinaryWrite ChrB(255) ChrB(255) ChrB(255)
Response.BinaryWrite ChrB(0) ChrB(85) ChrB(255)
' 圖象標(biāo)識符
Response.BinaryWrite ChrB(Asc(","))
Response.BinaryWrite ChrB(0) ChrB(0) ChrB(0) ChrB(0)
' 圖象寬度
Response.BinaryWrite ChrB(Width Mod 256) ChrB((Width \ 256) Mod 256)
' 圖象高度
Response.BinaryWrite ChrB(Height Mod 256) ChrB((Height \ 256) Mod 256)
Response.BinaryWrite ChrB(0) ChrB(7) ChrB(255)
Dim x, y, i : i = 0
For y = 0 To Height - 1
For x = 0 To Width - 1
If Rnd Noisy / 100 Then
Response.BinaryWrite ChrB(1-Graph(x, y))
Else
If x * (x-Width) = 0 Or y * (y-Height) = 0 Then
Response.BinaryWrite ChrB(Graph(x, y))
Else
If Graph(x-1, y) = 1 Or Graph(x, y) Or Graph(x, y-1) = 1 Then
Response.BinaryWrite ChrB(1)
Else
Response.BinaryWrite ChrB(0)
End If
End If
End If
If (y * Width + x + 1) Mod 126 = 0 Then
Response.BinaryWrite ChrB(128)
i = i + 1
End If
If (y * Width + x + i + 1) Mod 255 = 0 Then
If (Width*Height - y * Width - x - 1) > 255 Then
Response.BinaryWrite ChrB(255)
Else
Response.BinaryWrite ChrB(Width * Height Mod 255)
End If
End If
Next
Next
Response.BinaryWrite ChrB(128) ChrB(0) ChrB(129) ChrB(0) ChrB(59)
End Sub
End Class
Dim mCode
Set mCode = New Com_GifCode_Class
Session("GetCode") = mCode.Create()
mCode.Output()
Set mCode = Nothing
%>
您可能感興趣的文章:
  • asp.net下中文驗證碼,免費(fèi)開源代碼
  • asp.net(C#) 生成隨機(jī)驗證碼的代碼
  • ASP.net 驗證碼實現(xiàn)代碼(C#)
  • Asp.net(C#)實現(xiàn)驗證碼功能代碼
  • asp.net 簡單驗證碼驗證實現(xiàn)代碼
  • asp.net 驗證碼生成和刷新及驗證
  • asp最簡單的生成驗證碼代碼
  • ASP.NET中的無刷新驗證碼的開發(fā)(完整代碼)
  • asp.net ajax實現(xiàn)無刷新驗證碼
  • asp.net 圖片驗證碼的HtmlHelper
  • asp.net生成驗證碼(純數(shù)字)
  • asp.net中3種驗證碼示例(實現(xiàn)代碼)(數(shù)字,數(shù)字字母混和,漢字)
  • ASP.NET MVC驗證碼功能實現(xiàn)代碼
  • asp.net驗證碼的簡單制作
  • ASP實現(xiàn)加法驗證碼

標(biāo)簽:淮北 甘南 滁州 揭陽 來賓 迪慶 唐山 南寧

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《asp無組件生成驗證碼 GIF圖片格式》,本文關(guān)鍵詞  asp,無,組件,生成,驗證,碼,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《asp無組件生成驗證碼 GIF圖片格式》相關(guān)的同類信息!
  • 本頁收集關(guān)于asp無組件生成驗證碼 GIF圖片格式的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    怀远县| 栖霞市| 乡宁县| 宜兰县| 庄浪县| 绍兴县| 临泽县| 秭归县| 赞皇县| 嘉黎县| 耒阳市| 潞西市| 专栏| 全椒县| 西藏| 竹山县| 聂拉木县| 山丹县| 正宁县| 崇明县| 玛纳斯县| 全州县| 长乐市| 滨海县| 额敏县| 东兰县| 工布江达县| 礼泉县| 柞水县| 滕州市| 富蕴县| 蒲城县| 阳原县| 武强县| 藁城市| 宣汉县| 邹平县| 新兴县| 眉山市| 株洲县| 浦县|