ATHENA's profile闲人勿入BlogListsGuestbookMore ![]() | Help |
生成xbm格式的验证码on error resume next dim i dim countdata countdata="1234567890" dim rou,chkcode,chklen chkcode="" chklen = 4 randomize for i=1 to 4 rou = int(rnd*10) chkcode = chkcode + cstr(rou) next dim strDigits strDigits = Array(_ "0","0x3c","0x66","0x66","0x66","0x66","0x66","0x66","0x66","0x66","0x3c",_ "1","0x30","0x38","0x30","0x30","0x30","0x30","0x30","0x30","0x30","0x30",_ "2","0x3c","0x66","0x60","0x60","0x30","0x18","0x0c","0x06","0x06","0x7e",_ "3","0x3c","0x66","0x60","0x60","0x38","0x60","0x60","0x60","0x66","0x3c",_ "4","0x30","0x30","0x38","0x38","0x34","0x34","0x32","0x7e","0x30","0x78",_ "5","0x7e","0x06","0x06","0x06","0x3e","0x60","0x60","0x60","0x66","0x3c",_ "6","0x38","0x0c","0x06","0x06","0x3e","0x66","0x66","0x66","0x66","0x3c",_ "7","0x7e","0x66","0x60","0x60","0x30","0x30","0x18","0x18","0x0c","0x0c",_ "8","0x3c","0x66","0x66","0x66","0x3c","0x66","0x66","0x66","0x66","0x3c",_ "9","0x3c","0x66","0x66","0x66","0x66","0x7c","0x60","0x60","0x30","0x1c") dim iCharWidth,iCharHeight,theBit,theNum,iRow,k,theOffset dim imageStr imageStr = "" iCharWidth = 8 iCharHeight= 10*1 Response.ContentType ="image/x-xbitmap" Response.Expires =0 Response.Write "#define counter_width "&iCharWidth*chklen&chr(13) & chr(10) Response.Write "#define counter_height "&iCharHeight&chr(13) & chr(10) Response.Write "static unsigned char counter_bits[]={" for iRow=0 to iCharHeight-1 for i=1 to chklen theBit=mid(chkcode,i,1) k=0 do while k<ubound(strDigits) if strDigits(k) = theBit then exit do k=k+iCharHeight+1 loop if k>=ubound(strDigits) then k=0 theOffset = k + 1 imageStr = imageStr + (strDigits(theOffset+iRow))&"," next next imageStr = left(imageStr,(len(imageStr)-1)) Response.Write imageStr Response.Write "};" session("chkCode") = chkcode TrackbacksThe trackback URL for this entry is: http://athenalover.spaces.live.com/blog/cns!9EA68F276E74CDD5!175.trak Weblogs that reference this entry
|
|
|