ASP authentication Code Source code

Source: Internet
Author: User
Tags chr

ASP authentication Code Source code

Call method, is b.htm page

<form name= "Form1" >
<input type= "text" Name= "a" ><br>
<input type= "text" name= "B" ><br><span></span><a href= " Javascript:f () "> Update </a><br>
<input type= "button" value= "Submit" onclick= "return F1 ()" >
</form>
<script>
function f ()
{
document.getElementById ("Yzm"). src= "Yzm.asp";
}
Function F1 ()
{
if (document.form1.a.value!= "AAA")
{
Alert (' Error ');
document.getElementById ("Yzm"). src= "Yzm.asp";
Document.form1.a.focus ();
return false;
}
}
</script>

Let's save the following page as a 111cn.asp

<%
Option Explicit
Response.Expires = 0
Response.AddHeader "Pragma", "No-cache"
Response.AddHeader "Cache-ctrol", "No-cache"
Response.ContentType = "Image/bmp"
Randomize Timer

Dim Text_data (9), Text_len,int_temp (), I,J,K,INT_TEMP2

' * * * Parameters Configuration Area * * *

Text_len = 4 ' Verification Code length (1-25-bit support)

''**********************

ReDim int_temp (text_len-1)

Text_data (0) = " 00000000000001111000001100110000110111000011011100001100110000111011000011101100001100110000011110000000000000 "
Text_data (1) = " 00000000000000011000000011100000111110000000011000000001100000000110000000011000000001100000000110000000000000 "
Text_data (2) = " 00000000000001111000001100110000110011000000001100000001100000001100000001100000001100000000111111000000000000 "
Text_data (3) = " 00000000000001111000001100110000110011000000001100000011100000000011000011001100001100110000011110000000000000 "
Text_data (4) = " 00000000000001100000000110000000011011000001101100000110110000110011000011111110000000110000000011000000000000 "
Text_data (5) = " 00000000000011111100001100000000110000000011000000001111100000000011000000001100000001100000111100000000000000 "
Text_data (6) = " 00000000000000111000000011000000011000000011111000001100110000110011000011001100001100110000011110000000000000 "
Text_data (7) = " 00000000000011111100000000110000000110000000011000000011000000001100000001100000000110000000011000000000000000 "
Text_data (8) = " 00000000000001111000001100110000110011000011101100000111100000110111000011001100001100110000011110000000000000 "
Text_data (9) = " 00000000000001111000001100110000110011000011001100001100110000011111000000011000000011000000011100000000000000 "

"Randomly generate your verification code below
Session ("Num") = ""
For I = 0 to Text_len-1
Int_temp (I) = Int (RND * 10)
Session ("num") = Session ("num") + Mid ("0123456789", Int_temp (I) +1,1)
Next

' Output file header
Int_temp2 = (text_len-1) \ 4 * (text_len-1)/4-(text_len-1) \ 4 * 4) *
Response. BinaryWrite ChrB (&h42) & ChrB (&h4d)
Response.BinaryWrite ChrB ((INT_TEMP2 + 206)/256-(INT_TEMP2 + 206) \ 256) * 256) & ChrB ((int_temp2 + 206) \ 256)    ' special bit
Response.BinaryWrite ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (&h76) & ChrB (0) & ChrB (0) & ChrB (0) & CHR B (&h28) & ChrB (0) & ChrB (0) & ChrB (0)
Response.BinaryWrite ChrB (Text_len *)    ' special bit
R Esponse. BinaryWrite ChrB (0) & ChrB (0) & ChrB (0) & ChrB (&HB) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (& Amp H1) & ChrB (0) & ChrB (&H4) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0)
response.b Inarywrite ChrB ((INT_TEMP2 +)/256-(INT_TEMP2 +) \ 256) * 256) & ChrB ((INT_TEMP2 +) \ 256)    " Special bit

Response.BinaryWrite ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & CHR B (0) & ChrB (0) & ChrB (0) & ChrB (+) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (a) & ChrB (0) &am P ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (& H80) & ChrB (0) & ChrB (0) & ChrB (&h80) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (&AMP;H80) & ChrB (&AMP;H80) & ChrB (0) & ChrB (&h80) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (&h80) & Ch RB (0) & ChrB (&h80) & ChrB (0)
Response.BinaryWrite ChrB (&h80) & ChrB (&h80) & ChrB (0) & ChrB (0) & ChrB (&h80) & ChrB ; H80) & ChrB (&h80) & ChrB (0) & ChrB (&AMP;HC0) & ChrB (&AMP;HC0) & ChrB (&AMP;HC0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (&AMP;HFF) & ChrB (0) & ChrB (0) & ChrB (&AMP;HFF) & ChrB (0) & ChrB (0) & Amp ChrB (0) & ChrB (&AMP;HFF) & ChrB (&AMP;HFF) & ChrB (0) & ChrB (&AMP;HFF) & ChrB (0) & ChrB (0) & CHR B (0) & ChrB (&AMP;HFF) & ChrB (0) & ChrB (&AMP;HFF) & ChrB (0) & ChrB (&AMP;HFF) & ChrB (&AMP;HFF) & ChrB (0) & ChrB (0) & ChrB (&AMP;HFF) & ChrB (&AMP;HFF) & ChrB (&AMP;HFF) & ChrB (0)

"Output picture data below
For i = 0 Step-1
For j = 0 to Text_len-1
For k = 1 to 9 Step 2
If Mid (Text_data (Int_temp (j)), I * + k, 1) = "0" Then int_temp2 = Get_backcolor () * Else INT_TEMP2 = Get_forecolo R () * 16
If Mid (Text_data (Int_temp (j)), I * + k + 1, 1) = "0" Then int_temp2 = int_temp2 + get_backcolor () Else INT_TEMP2 = i NT_TEMP2 + Get_forecolor ()
Response.BinaryWrite ChrB (INT_TEMP2)
Next
Next
INT_TEMP2 = (TEXT_LEN/4-text_len \ 4) * 4
Select Case INT_TEMP2
Case 1
Response.BinaryWrite ChrB (0) & ChrB (0) & ChrB (0)
Case 2
Response.BinaryWrite ChrB (0) & ChrB (0)
Case 3
Response.BinaryWrite ChrB (0)
End Select
Next

Function Get_backcolor ()
"Get a background color
If Int (Rnd *) = 0 Then ' NOTE: here Rnd * 30 is the size of the background noise, the greater the value, the less noise, the easier the picture to see
Get_backcolor = CInt (Mid ("00021209", Int (RND * 4) * 2 + 1,2))
Else
Get_backcolor = CInt (Mid ("081515151515", Int (RND * 6) * 2 + 1,2))
End If
End Function

Function Get_forecolor ()
"Get a front view
Get_forecolor = CInt (Mid ("00021209", Int (RND * 4) * 2 + 1,2))
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.