
September 5th, 2007, 01:27 AM
|
|
Contributing User
|
|
Join Date: Feb 2005
Location: asian
|
|
This is for classic newbie alone, don't use classic anymore, this ain't that fast but you might get the idea.
I don't use those fancy stuffs like italized text or adding some hard-to-look backgrounds but you can add it if you like.
processform.asp
Code:
<fieldset class="pss">
<legend>Verification Code</legend>
<p>Please enter the text that you see in the image into the box on the right. You are asked to do this in order to verify that this registration is not being performed by an automated process.</p>
<input name="verification" id="verification" value="" size="16" type="text" maxlength="6" />
<!--#include file="random.asp" -->
<%
dim image_num
randomize
image_num=int(rnd*9)+1 '1 to 10
select case image_num
case 1
image_num="#ff00ff"
case 2
image_num="#669966"
case 3
image_num="#cccc99"
case 4
image_num="#0000ff"
case 5
image_num="#993333"
case 6
image_num="#ff6633"
case 7
image_num="#6666cc"
case 8
image_num="#009966"
case 9
image_num="#666666"
case 10
image_num="#000000"
end select
%>
<span style="background-color:<%=image_num%>; border:1px solid #000000; font-size:18px; padding:4px 8px; margin-left:150px; color:#ffffff">
<%
'Dimensidon variables
Dim WriteDigitLoopCount 'Loop counter to display the code
dim randnum
randnum = Randomizer(6)
random_activation = Randomizer(36)
For WriteDigitLoopCount = 1 to Len(randnum)
Response.Write(" " & Mid(randnum, WriteDigitLoopCount, 1) & " ")
next
%>
</span><input name="verification2" id="verification2" value="<%=randnum%>" size="16" type="hidden" maxlength="6" />
<input name="random_activation" id="random_activation" value="<%=random_activation%>" size="46" type="hidden" maxlength="6" />
</fieldset>
random.asp
Code:
<%
Function Randomizer(myLength)
Const minLength = 4
Const maxLength = 8
Dim X, Y, strPW
If myLength = 0 Then
Randomize
myLength = Int((maxLength * Rnd) + minLength)
End If
For X = 1 To myLength
Y = Int((3 * Rnd) + 1)
Select Case Y
Case 1
Randomize
strPW = strPW & CHR(Int((9 * Rnd) + 48))
Case 2
Randomize
strPW = strPW & CHR(Int((25 * Rnd) + 65))
Case 3
Randomize
strPW = strPW & CHR(Int((25 * Rnd) + 97))
End Select
Next
Randomizer = strPW
End Function
%>
|