Code彩色可变位数asp验证码类代码.doc_第1页
Code彩色可变位数asp验证码类代码.doc_第2页
Code彩色可变位数asp验证码类代码.doc_第3页
Code彩色可变位数asp验证码类代码.doc_第4页
Code彩色可变位数asp验证码类代码.doc_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

%Class CAMXAM_COM_RndCodeBmpPrivate TextDataLib,TextData,BmpData,BmpHead,BmpWidth,BmpHeight,BmpSize,TextDataLength,SessionStringPublic SessionName,TextLength,BackColor,TextColor,YawpColor,YawpCountPrivate Sub Class_Initialize()End SubPrivate Sub Class_Terminate()End SubPublic Function SetTextInfo(TextString) ReDim TextDataLib(0) TextDataLib(0) = TextStringEnd FunctionPublic Function AddTextData(TextDataString) TextDataLength = UBound(TextDataLib) + 1 ReDim Preserve TextDataLib(TextDataLength) TextDataLib(TextDataLength) = TextDataStringEnd FunctionPrivate Function Getbinary(IntNumber) Dim IntBin0,IntBin1,IntBin2,IntBin0_,IntBin1_,IntBin2_ IntBin0 = Int(IntNumber / 16777216) IntBin0_= IntNumber Mod 16777216 IntBin1 = Int(IntBin0_ / 65536) IntBin1_= IntBin0_ Mod 65536 IntBin2 = Int(IntBin1_ / 256) IntBin2_= IntBin1_ Mod 256 Getbinary = ChrB(IntBin2_) & ChrB(IntBin2) & ChrB(IntBin1) & ChrB(IntBin0)End FunctionPrivate Function GetColadRstring(ColadRstring) Dim ColorArray,CALength ColorArray = Split(ColadRstring,) CALength = UBound(ColorArray) GetColadRstring = ColorArray(GetRnd(0,CALength)End FunctionPrivate Function GetRnd(LowNumber,UpNumber) Randomize Timer GetRnd = Int(UpNumber - LowNumber + 1) * Rnd + LowNumber)End FunctionPrivate Function FileHeader() Response.Expires = -1 Response.AddHeader Pragma,no-cache Response.AddHeader cache-ctrol,no-cache Response.ContentType = Image/BMPEnd FunctionPrivate Function SetBmpHead(BmpSize,Width,Height) BmpHead = ChrB(66) & ChrB(77) BmpHead = BmpHead & Getbinary(BmpSize+54) BmpHead = BmpHead & Getbinary(0) BmpHead = BmpHead & Getbinary(54) BmpHead = BmpHead & Getbinary(40) BmpHead = BmpHead & Getbinary(Width) BmpHead = BmpHead & Getbinary(Height) BmpHead = BmpHead & ChrB(1) & ChrB(0) BmpHead = BmpHead & ChrB(24) & ChrB(0) BmpHead = BmpHead & Getbinary(0) BmpHead = BmpHead & Getbinary(BmpSize) BmpHead = BmpHead & Getbinary(65536) BmpHead = BmpHead & Getbinary(65536) BmpHead = BmpHead & Getbinary(16777216) BmpHead = BmpHead & Getbinary(16777216)End FunctionPrivate Function GetRndTextData() ReDim TextData(TextLength-1) Dim IText For IText = 0 To TextLength-1 Step +1 TextData(IText) = GetColadRstring(BackColor) & & GetColadRstring(TextColor) & & ChangeShape(TextDataLib(GetRnd(1,TextDataLength) SessionString = SessionString & GetTextData(IText)(4) NextEnd FunctionPrivate Function GetTextData(IText) Dim TextArray,ArrayLength,ITextData TextArray = Split(TextData(IText), ) ArrayLength = UBound(TextArray) Dim TextDataArray(5) TextDataArray(0) = TextArray(0) TextDataArray(1) = TextArray(1) TextDataArray(2) = Len(TextArray(3) TextDataArray(3) = ArrayLength - 2 TextDataArray(4) = TextArray(2) For ITextData = 3 To ArrayLength Step +1 TextDataArray(5) = TextDataArray(5) & & TextArray(ITextData) Next GetTextData = TextDataArrayEnd FunctionPrivate Function GetColor(ColadRstring) GetColor = ChrB(&H & Mid(ColadRstring,6,2) & ChrB(&H & Mid(ColadRstring,4,2) & ChrB(&H & Mid(ColadRstring,2,2)End FunctionPrivate Function BmpColor(ColorA,ColorB) Dim BmpColor_(1) BmpColor_(0) = GetColor(ColorA) BmpColor_(1) = GetColor(ColorB) BmpColor = BmpColor_End FunctionPrivate Function SetBmpData() Dim TextInfo,FontData,I,J,K GetRndTextData() TextInfo = GetTextData(0) BmpHeight = TextInfo(3) BmpWidth = TextInfo(2) * TextLength BmpSize = BmpHeight * BmpWidth * 3 For I = BmpHeight To 1 Step -1 For J = 0 To TextLength -1 Step +1 TextInfo = GetTextData(J) FontData = Split(TextInfo(5), )(I) For K = 1 To TextInfo(2) Step +1 If GetRnd(1,99) 7 Then nCurLeft =5 For nTemp1 =nTemp to ubound(sTemp) If nCurLeft 1 Then Exit For sTemp(nTemp1) =Fill(0, int(nCurLeft /2) ) & sTemp(nTemp1) nCurLeft =nCurLeft -1 Next Exit For End If sTemp(nTemp) =Fill(0, int(nCurLeft /2) ) & sTemp(nTemp) nCurLeft =nCurLeft +1 Next Else For nTemp =1 to ubound(sTemp) If nAspect =1 Then sTemp(nTemp) =Fill(0, int(nCurLeft /2) ) & sTemp(nTemp) Else sTemp(nTemp) =sTemp(nTemp) & Fill(0, int(nCurLeft /2) ) If Len(sTemp(nTemp) nMaxWidth Then sTemp(nTemp) =Fill(0, nMaxWidth - Len(sTemp(nTemp) & sTemp(nTemp) End If nCurLeft =nCurLeft +1 Next End If For nTemp =1 to ubound(sTemp) If Len(sTemp(nTemp) nMaxWidth Then sTemp(nTemp) =sTemp(nTemp) & Fill(0, nMaxWidth - Len(sTemp(nTemp) If sReturn Then sReturn =sReturn & sReturn =sReturn & sTemp(nTemp) Next nTopStart =Int(nMaxHeight -nHeight) - 1 + 1) * Rnd + 1) For nTemp =1 to nTopStart sReturn =Fill(0, nMaxWidth) & & sReturn Next For nTemp =0 to (nMaxHeight -nHeight -nTopStart) -1 sReturn =sReturn & & Fill(0, nMaxWidth) Next ChangeShape =sTemp(0) & & sReturnEnd FunctionPublic Function Fill(psChar, pnWidth) Dim nTemp, sTemp For nTemp =1 To pnWidth sTemp =sTemp & psChar Next Fill =sTempEnd FunctionEnd ClassDim BmpSet Bmp = New CAMXAM_COM_RndCodeBmpBmp.SetTextInfo Bmp.AddTextData 2 00111100 01111110 11100111 11000011 00000011 00000011 00000110 00001100 00011000 00110000 01100000 11111111 11111111Bmp.AddTextData 3 00111000 01111110 11000110 00000110 00000110 00011100 00011110 00000011 00000011 11000011 11000011 01111110 00111100Bmp.AddTextData 4 000001100 000011100 000011100 000111100 001101100 001101100 011001100 110001100 111111111 111111111 000001100 000001100 000001100Bmp.AddTextData 5 01111110 01111110 01100000 11000000 11011100 11111110 11000011 00000011 00000011 11000011 11000011 01111110 00111100Bmp.AddTextData 6 00111100 01111110 01100011 11000000 11000000 11011100 11111110 11100011 11000011 11000011 01100011 01111110 00111100Bmp.AddTextData 7 11111111 11111111 00000010 00000110 00001100 00001100 00011000 00011000 00011000 00011000 00110000 00110000 00110000Bmp.AddTextData 8 00111100 01111110 11000011 11000011 11000011 01111110 01111110 11000011 11000011 11000011 11000011 01111110 00111100Bmp.AddTextData A 0011110000 0000110000 0001111000 0001111000 0011001100 0011001100 0011111100 0110000110 0110000110 1111001111Bmp.AddTextData b 11000000 11000000 11000000 11011100 11111110 11100111 11000011 11000011 11000011 11000011 11100111 11111110 11011100Bmp.AddTextData B 11111110 01100011 01100011 01100011 01111110 01100011 01100011 01100011 01100011 11111110Bmp.AddTextData c 0011110 0111111 1110011 1100000 1100000 1100000 1100000 1110011 0111111 0011110Bmp.AddTextData C 00111111 01100111 11000011 11000011 11000000 11000000 11000000 11000000 01100011 00111110Bmp.AddTextData d 00000011 00000011 00000011 00111011 01111111 11100111 11000011 11000011 11000011 11000011 11100111 01111111 00111011Bmp.AddTextData e 00111100 01111110 11100110 11000011 11111111 11111111 11000000 11100011 01111110 00111100Bmp.AddTextData E 11111111 01100011 01100000 01101100 01111100 01101100 01100000 01100000 01100011 11111111Bmp.AddTextData f 0001111 0011111 0011000 0011000 0011000 1111110 1111110 0011000 0011000 0011000 0011000 0011000 0011000 0011000 0111000Bmp.AddTextData F 11111111 01100011 01100000 01101100 01111100 01101100 01100000 01100000 01100000 01100000Bmp.AddTextData G 001111110 011001110 110000110 110000110 110000000 110011111 110000110 110000110 011000110 001111100Bmp.AddTextData h 11000000 11000000 11000000 11011110 11111111 11100011 11000011 11000011 11000011 11000011 11000011 11000011 11000011Bmp.AddTextData H 1111001111 0110000110 0110000110 0110000110 0111111110 0110000110 0110000110 0110000110 0110000110 1111001111Bmp.AddTextData J 000111111 000001100 000001100 000001100 000001100 000001100 000001100 110001100 110001100 011111000Bmp.AddTextData k 11000000 11000000 11000000 11000111 11001110 11011100 11110000 11111000 11011000 11001100 11001100 11000110 11000111Bmp.AddTextData K 111111110 011001100 011011000 011011000 011110000 011110000 011011000 011001100 011000110 111100111Bmp.AddTextData L 11111000 01100000 01100000 01100000 01100000 01100000 01100000 01100000 01100011 11111111Bmp.AddTextData m 110111001110 111111011111 111001110011 110001100011 110001100011 110001100011 110001100011 110001100011 110001100011 110001100011Bmp.AddTextData M 1110000111 0110000110 0111001110 0111001110 0111111110 0111111110 0110110110 0110110110 0110000110 1111001111Bmp.AddTextData n 11011110 11111111 11100011 11000011 11000011 11000011 11000011 11000011 11000011 11000011Bmp.AddTextData N 1110011111 0110000110 0111000110 0111100110 0111100110 0110110110 0110011110 0110011110 0110001110 1111100110Bmp.AddTextData p 11011100 11111110 11100111 11000011 11000011 11000011 11000011 11100111 11111110 11011100 11000000 11000000 11000000 11000000Bmp.AddTextData P 11111110 01100011 01100011 01100011 01100011 01111110 01100000 01100000 01100000 01100000Bmp.AddTextData R 111111100 011000110 011000110 011000110 011000110 011111100 011011000 011001100 011000110 111100111Bmp.AddTextData s 01111110 11111110 11000000 11100000 01111100 00011110 00000011 10000011 11111111 01111100Bmp.AddTextData S 01111111 11000111 11000011 11000000 01111000 00001110 00000011 11000011 11100011 11111110Bmp.AddTextData t 00110000 00110000 11111111 11111111 00110000 00110000 00110000 00110000 00110000 00110000 00111111 00011111Bmp.AddTextData T 11111111 10011001 00011000 00011000 00011000 00011000 00011000 00011000 00011000 00011000Bmp.AddTextData u 11000011 11000011 11000011 11000011 11000011 11000011 11000011 11000111 11111111 01111011Bmp.AddTextData U 1111001111 0110000110 0110000110 0110000110 0110000110 0110000110 0110000110 0110000110 0111001110 0001111000Bmp.AddTextData v 110000011 011000011 011000110 011000110 001100110 001100100 000110100 000111100 000111000 000011000Bmp.AddTextData V 1111001111 0110000110 0110000110 0011001100 0011001100 0011001100 0001111000 0001111000 0000110000 0000110000Bmp.AddTextData w 11000000001 11000110011 11001110011 01001010010 01001010010 01101011010 01110011110 01110001110 00110001100 00110001100Bmp.AddTextData W 1110000111 1100000011 1100110011 1100110011 0111111110 0111111110 01

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论