ASP generated Authenticode Code program

Source: Internet
Author: User

<%
Option Explicit
Response.Buffer = True
Numcode (8) ' Note: 1,4,7,10,13,16 for color background type 2,5,8,11,14,17 for Black-and-white 3,6,9,12,15,18 for noise-point type
Function Numcode (CodeType)
Response.Expires =-1
Response.AddHeader "Pragma", "No-cache"
Response.AddHeader "Cache-ctrol", "No-cache"
On Error Resume Next
Dim Znum, Rnum, I, J, ListNum, Listcode
Dim ADOs, ADOS1
Listcode = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Randomize Timer
Dim zimg (6), Nstr
For i = 0 to 5
Rnum = CStr (CInt Rnd)) ' Change 35 to 9 to use a pure digital password
Zimg (i) = Rnum
LISTNUM = ListNum & Mid (Listcode, Rnum + 1, 1)
Next
Session ("Checkcode") = ListNum
Dim Pos
Set ADOs = Server.CreateObject ("ADODB.stream")
Ados.mode = 3
Ados.type = 1
Ados.open
Set Ados1 = Server.CreateObject ("ADODB.stream")
Ados1.mode = 3
Ados1.type = 1
Ados1.open
Ados.loadfromfile (Server.MapPath) (". /images/body "& CodeType &". Fix "))
Ados1.write Ados.read (2880)
For i = 0 to 5
Ados.position = (35-zimg (i)) * 480
Ados1.position = i * 480
Ados1.write Ados.read (480)
Next
Ados.loadfromfile (Server.MapPath) (". /images/head.fix "))
Pos = LenB (Ados.read ())
Ados.position = Pos
For i = 0 to 1
For j = 0 to 5
Ados1.position = i * + J * 480
Ados.position = Pos + * j + I * 270
Ados.write Ados1.read (30)
Next
Next
Response.ContentType = "Images/bmp"
ados.position = 0
Response.BinaryWrite Ados.read ()
Ados.Close:Set ADOs = Nothing
Ados1.Close:Set Ados1 = Nothing
' If ERR Then session ("Checkcode") = "999999"
End Function
%>

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.