复制下面代码,存为c_validcode.asp上传到function下就可以了
复制代码代码如下:
<%@CODEPAGE=65001%>
<%
'///////////////////////////////////////////////////////////////////////////////
'//Z-Blog
'//作者:朱煊(zx.asd),sipo
'//版权所有:RainbowSoftStudio
'//技术支持:[email protected]
'//单元名称:c_validcode.asp
'//开始时间:2007-4-4
'//最后修改:2007-4-4
'//备注:www.dc9.cn
'///////////////////////////////////////////////////////////////////////////////
%>
<%OptionExplicit%>
<%OnErrorResumeNext%>
<!--#includefile="../c_option.asp"-->
<!--#includefile="../function/c_function.asp"-->
<%
'.VerifyCodeGetVerifyNumber,False
ClassCom_GifCode_Class
PublicNoisy,Count,Width,Height,Angle,Offset,Border
PrivateGraph(),Margin(3)
PrivateSubClass_Initialize()
Randomize
Noisy=7'干扰点出现的概率
Count=5'字符数量
Width=60'图片宽度
Height=20'图片高度
Angle=3'角度随机变化量
Offset=10'偏移随机变化量
Border=2'边框大小
EndSub
PublicFunctionCreate(str)
Dimi
DimvIndex
ReDimGraph(Width-1,Height-1)
Fori=0ToCount-1
vIndex=CInt(Mid(str,i+1,1)-1)
SetDrawvIndex,i
Next
EndFunction
SubSetDot(pX,pY)
IfpX*(Width-pX-1)>=0AndpY*(Height-pY-1)>=0Then
Graph(pX,pY)=1
EndIf
EndSub
PublicSubSetDraw(pIndex,pNumber)
'字符数据字典
IfpIndex=-1ThenpIndex=9
DimDotData(9)
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)