Asp output bmp

Source: Internet
Author: User

Asp output bmp
[12:04:25 | Author: flashsoft]
Font size: large | medium | small
<%
Call Com_CreatValidCode ("ValidCode ")

Sub Com_CreatValidCode (pSN)

'Author: Layen
'Qq: 84815733
'E-mail: support@ssaw.net

'Prohibit caching
Response. Expires =-9999
Response. AddHeader "Pragma", "no-cache"
Response. AddHeader "cache-ctrol", "no-cache"
Response. ContentType = "Image/BMP"

Randomize

Dim I, ii, iii

Const cOdds = 8' probability of occurrence of miscellaneous
Const cAmount = 36' text count
Const cCode = "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"

'Color data (character, background)
Dim vColorData (1)
VColorData (0) = ChrB (0) & ChrB (0) & ChrB (0) 'Blue 0, green 0, red 0 (black)
VColorData (1) = ChrB (250) & ChrB (236) & ChrB (211) 'Blue 250, green 236, red 211 (light blue)

'Randomly generated characters
Dim vCode (4), vCodes
For I = 0 To 3
VCode (I) = Int (Rnd * cAmount)
VCodes = vCodes & Mid (cCode, vCode (I) + 1, 1)
Next

Session (pSN) = vCodes 'record the Session

'Character data
Dim vNumberData (35)
VNumberData (0) = "1110000111110111101111011110111101001011110100101111010010111101001011110111101111011110111110000111"
VNumberData (1) = "1111011111110001111111110111111111011111111101111111110111111111011111111101111111110111111100000111"
VNumberData (2) = "1110000111110111101111011110111111111011111111011111111011111111011111111011111111011110111100000011"
VNumberData (3) = "1110000111110111101111011110111111110111111100111111111101111111111011110111101111011110111110000111"
VNumberData (4) = "1111101111111110111111110011111110101111110110111111011011111100000011111110111111111011111111000011"
VNumberData (5) = "1100000011110111111111011111111101000111110011101111111110111111111011110111101111011110111110000111"
VNumberData (6) = "1111000111111011101111011111111101111111110100011111001110111101111011110111101111011110111110000111"
VNumberData (7) = "1100000011110111011111011101111111101111111110111111110111111111011111111101111111110111111111011111"
VNumberData (8) = "1110000111110111101111011110111101111011111000011111101101111101111011110111101111011110111110000111"
VNumberData (9) = "1110001111110111011111011110111101111011110111001111100010111111111011111111101111011101111110001111"
VNumberData (10) = "1111011111111101111111101011111110101111111010111111101011111100000111110111011111011101111000100011"
VNumberData (11) = "1000000111110111101111011110111101110111110000111111011101111101111011110111101111011110111000000111"
VNumberData (12) = "1110000011110111101110111110111011111111101111111110111111111011111111101111101111011101111110001111"
VNumberData (13) = "1000001111110111011111011110111101111011110111101111011110111101111011110111101111011101111000001111"
VNumberData (14) = "1000000111110111101111011011111101101111110000111111011011111101101111110111111111011110111000000111"
VNumberData (15) = "1000000111110111101111011011111101101111110000111111011011111101101111110111111111011111111000111111"
VNumberData (16) = "1110000111110111011110111101111011111111101111111110111111111011100011101111011111011101111110001111"
VNumberData (17) = "1000100011110111011111011101111101110111110000011111011101111101110111110111011111011101111000100011"
VNumberData (18) = "1100000111111101111111110111111111011111111101111111110111111111011111111101111111110111111100000111"
VNumberData (19) = "1110000011111110111111111011111111101111111110111111111011111111101111111110111110111011111000011111"
VNumberData (20) = "1000100011110111011111011011111101011111110001111111010111111101101111110110111111011101111000100011"
VNumberData (21) = "1000111111110111111111011111111101111111110111111111011111111101111111110111111111011110111000000011"
VNumberData (22) = "1000100011110010011111001001111100100111110101011111010101111101010111110101011111010101111001010011"
VNumberData (23) = "1000100011110011011111001101111101010111110101011111010101111101100111110110011111011001111000110111"
VNumberData (24) = "1110001111110111011110111110111011111011101111101110111110111011111011101111101111011101111110001111"
VNumberData (25) = "1000000111110111101111011110111101111011110000011111011111111101111111110111111111011111111000111111"
VNumberData (26) = "1110001111110111011110111110111011111011101111101110111110111011111011101001101111011001111110001011"
VNumberData (27th) = "1000001111110111011111011101111101110111110000111111010111111101101111110110111111011101111000110011"
VNumberData (28) = "1110000011110111101111011110111101111111111001111111111001111111111011110111101111011110111100000111"
VNumberData (29) = "1000000011101101101111110111111111011111111101111111110111111111011111111101111111110111111110001111"
VNumberData (30) = "1000100011110111011111011101111101110111110111011111011101111101110111110111011111011101111110001111"
VNumberData (31) = "1000100011110111011111011101111101110111111010111111101011111110101111111010111111110111111111011111"
VNumberData (32) = "1001010011110101011111010101111101010111110101011111001001111110101111111010111111101011111110101111"
VNumberData (33) = "1000100011110111011111101011111110101111111101111111110111111110101111111010111111011101111000100011"
VNumberData (34) = "1000100011110111011111011101111110101111111010111111110111111111011111111101111111110111111110001111"
VNumberData (35) = "1100000011110111011111111101111111101111111110111111110111111111011111111011111111101110111100000011"

'Output image file headers
Response. binaryWrite ChrB (66) & ChrB (77) & ChrB (230) & ChrB (4) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) &_
ChrB (0) & ChrB (0) & ChrB (54) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (40) & ChrB (0) &_
ChrB (0) & ChrB (0) & ChrB (40) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (10) & ChrB (0) &_
ChrB (0) & ChrB (0) & ChrB (1) & ChrB (0)

'Output Image Information Headers
Response. binaryWrite ChrB (24) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & chrb( 176) & ChrB (4) &_
ChrB (0) & ChrB (0) & ChrB (18) & ChrB (11) & ChrB (0) & ChrB (0) & ChrB (18) & ChrB (11) &_
ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) &_
ChrB (0) & ChrB (0)

For I = 9 To 0 Step-1 'goes through all rows
For ii = 0 To 3' goes through all words
For iii = 1 To 10' goes through all pixels
'Output image data row by row, word by word, and pixel by Pixel
If Rnd * 99 + 1 <cOdds then' random generation of miscellaneous
Response. BinaryWrite vColorData (0)
Else
Response. BinaryWrite vColorData (Mid (vNumberData (vCode (ii), I * 10 + iii, 1 ))
End If
Next
Next
Next

End Sub
%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.