ASP implementiert einen GIF -Formatverifizierungscode ohne Komponente, Freunde, die ASP -Überprüfungscode benötigen, können sich darauf verweisen.
<%
Option explizite 'Anzeigeanweisung
Klasse com_gifcode_class
Öffentliche laut, Graf, Breite, Höhe, Winkel, Offset, Grenze
Private Graph (), Rand (3)
Private sub class_initialize ()
Randomisieren
Laut = 16 'Die Wahrscheinlichkeit des Interferenzpunkts erscheint
Count = 4 'Charaktermenge
Breite = 80 'Bildbreite
Höhe = 20 'Bildhöhe
Angle = 2 'kündigte zufällige Änderung angekündigt
Offset = 20 'zufällige Änderungen zum Offset
Rand = 1 'Rahmengröße
Ende sub
Öffentliche Funktion create ()
Const ccharset = 123456789
Dim i, x, y
Dim Vvalidcode: vvalidcode =
Dim Vindex
REDIM Graph (Breite-1, Höhe-1)
Für i = 0, um -1 zu zählen
vindex = int (rnd * len (ccharset))
vValidcode = vvalidcode + mid (ccharset, videx + 1, 1)
Setdraw vindex, ich
Nächste
Create = vValidcode
Endfunktion
Sub setdot (px, py)
Wenn px * (widthth-px-1)> = 0 und py * (Höhe-py-1)> = 0 dann dann
Graph (px, py) = 1
Ende wenn
Ende sub
Öffentliches Subsetdraw (Pindex, Pnumber)
'Charakterdaten
Dim Dotdata (8)
Dotdata (0) = Array (30, 15, 50, 1, 50, 100)
Dotdata (1) = Array (1, 34, 30, 1, 71, 1, 100, 34, 1, 100, 93, 100, 86)
Dotdata (2) = Array (1, 1, 100, 1, 42, 42, 100, 70, 50, 100, 1, 70)
Dotdata (3) = Array (100, 73, 6, 73, 75, 6, 75, 100)
Dotdata (4) = Array (100, 1, 1, 1, 1, 50, 50, 35, 55, 100, 80, 50, 100, 1, 95)
Dotdata (5) = Array (100, 20, 70, 1, 20, 1, 1, 30, 1, 80, 30, 100, 70, 100, 100, 80, 100, 60, 70, 50, 30, 50 , 1, 60)
Dotdata (6) = Array (6, 26, 6, 6, 100, 6, 53, 100)
Dotdata (7) = Array (100, 30, 100, 20, 70, 1, 30, 1, 1, 20, 30, 70, 80, 70, 100, 30, 100, 80, 80, 1, 70, 100 , 30)
Dotdata (8) = Array (1, 80, 30, 100, 80, 100, 100, 70, 100, 20, 70, 1, 30, 1, 1, 20, 1, 40, 30, 50, 70, 50 , 100, 40)
Schwacher Vertent: vextent = width / count
Rand (0) = Rand + Vextent * (RND * Offset) / 100 + Margin (1)
Rand (1) = vextent * (pnumber + 1) -Border -Vextent * (RND * Offset) / 100
Rand (2) = Grenze + Höhe * (Rnd * Offset) / 100
Rand (3) = Höhe -zahl -Heiht * (Rnd * Offset) / 100
Dim Vstartx, Vendx, Vstarty, Vendy
Dim Vwidth, VDX, VDX, VDY, VDELTAT
Dim Vangle, VLength
vwidth = int (margin (1) -margin (0))
vHeight = int (Margin (3) -Margin (2))
'Koordinaten starten
vstartx = int ((dotdata (pindex) (0) -1) * vwidth / 100)
vstarty = int
Dim i, j
Für i = 1 bis ubound (dotdata (pindex), 1)/2
Wenn dotdata (pindex) (2*i-2) <> 0 und dotdata (pindex) (2*i) <> 0 dann dann
'Endpunktkoordinaten
vendx = (dotdata (pindex) (2 * i) -1) * vwidth / 100
Vendy = (dotdata (pindex) (2 * i+1) -1) * vHeight / 100
'Horizontale Lücke
vdx = vendx -vstartx
'Vertikale Lücke
vdy = vendy -vstarty
'Kippwinkel
Wenn vdx = 0 dann
vangle = sgn (vdy) * 3.14/2
Anders
Vangle = ATN (VDY / VDX)
Ende wenn
'Zwei Koordinatenabstand
Wenn Sünde (Vangle) = 0 dann
vLength = vdx
Anders
vLength = vdy / sin (Vangle)
Ende wenn
'Zufälliger Rotationswinkel
Vangle = vangle + (rnd -0,5) * 2 * Winkel * 3.14 * 2 /100
vdx = int (cos (vangle) * vlength)
vdy = int (sin (vangle) * vlength)
Wenn ABS (VDX)> ABS (VDY) dann vdeltat = ABS (vdx) sonst vdeltat = ABS (VDY)
Für j = 1 bis vdeltat
SetDOT Margin (0) + Vstartx + J * VDX / VDELTAT, Rand (2) + Vstarty + J * vdeltatat
Nächste
vstartx = vstartx + vdx
vstarty = vstarty + vdy
Ende wenn
Nächste
Ende sub
Öffentliche Sub -Ausgabe ()
Response.expires = -9999
Response.addHeader Pragma, No-Cache
Antwort.Adheader Cache-CLM, No-Cache
Antwort.ContentType = Image/GIF
'Dateityp
Response.BinaryWrite Chrb (ASC (G)) & CHRB (ASC (I)) & CHRB (ASC (F))
'Versionsinformationen
Response.BinaryWrite CHRB (ASC (8)) & CHRB (ASC (9)) & CHRB (ASC (A))
'Logische Bildschirmbreite
Response.BinaryWrite CHRB (Width MOD 256) & CHRB ((Width / 256) Mod 256)
'Logische Bildschirmhöhe
Response.BinaryWrite CHRB (Height Mod 256) & CHRB (Höhe / 256 Mod 256)
Response.BinaryWrite CHRB (128) & CHRB (0) & CHRB (0)
'Globale Farbliste
Response.BinaryWrite CHRB (255) & CHRB (255) & CHRB (255)
Response.BinaryWrite CHRB (0) & CHRB (85) & CHRB (255)
'Bildidentifikation
Response.Binarywrite chrb (ASC (,,))
Antwort.BinaryWrite Chrb (0) & Chrb (0) & Chrb (0) & Chrb (0)
'Bildbreite
Response.BinaryWrite CHRB (Width MOD 256) & CHRB ((Width / 256) Mod 256)
'Bild hoch
Response.BinaryWrite CHRB (Height Mod 256) & CHRB (Höhe / 256 Mod 256)
Response.BinaryWrite CHRB (0) & CHRB (7) & CHRB (255)
Dim x, y, i: i = 0
Für y = 0 bis Höhe -1
Für x = 0 bis breit -1
Wenn rnd <noisy / 100 dann
Response.BinaryWrite CHRB (1-Graph (x, y))
Anders
Wenn x * (x-width) = 0 oder y * (y-height) = 0 dann
Response.binarywrite chrb (graph (x, y))
Anders
Wenn Grafik (x-1, y) = 1 oder Diagramm (x, y) oder Diagramm (x, y-1) = 1 Dann dann
Response.binarywrite chrb (1)
Anders
Response.binarywrite chrb (0)
Ende wenn
Ende wenn
Ende wenn
If (y * Breite + x + 1) mod 126 = 0 dann
Response.BinaryWrite CHRB (128)
I = i + 1
Ende wenn
If (y * width + x + i + 1) mod 255 = 0 dann
If (Breite * Höhe -y * Breite -x -1)> 255 Dann
Response.BinaryWrite CHRB (255)
Anders
Response.binarywrite chrb (Breite * Höhenmod 255)
Ende wenn
Ende wenn
Nächste
Nächste
Response.BinaryWrite CHRB (128) & CHRB (0) & CHRB (129) & CHRB (0) & CHRB (59)
Ende sub
Endklasse
Dim McOde
Setzen Sie mcode = new com_gifcode_class
Sitzung (getCode) = mcode.create ()
mcode.output ()
Setzen Sie McOde = nichts
%>