ANBSCaptchaBox (Part 4)

Attempt to create Captcha inputbox as simple as possible using third party captcha.
A nice simple ASP-Pure captcha
I started to play with it, but did not finish and not tested
Originally from http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=4&txtCodeId=9151


Public

Not Tested

My Own Work
Function ANBSCaptchaBox(BCaptchaLength, BSessionVar, BName, BValue, BCaption, TextboxWidth, LabelColWidth, BLongDescription)
' Needs ANBSCaptchaGenerator.asp, RemoveHTML
' LabelColWidth = width of label = 0 to 12 (bootstrap grid width), LabelColWidth = 0 means no label
' Width of inputbox = 12 - LabelColWidth (bootstrap grid width)
' BCaptchaLength is the length of chars in captcha (no of imaages)
' BSessionVar = the name of variable to save captcha for comparison
' Has to be ANBSCaptchaImageID
' If changed, then modify it in ANBSCaptchaGenerator.asp
' Using Bootstrap 4, if LabelColWidth = 3, inputbox width = 9
' Only if TextboxWidth = 0
Rett = ""
DescDiv = ""
InputStyle = ""
Div2Close = vbcrlf
TextboxWidth = Fix(TextboxWidth)
LabelColWidth = Fix(LabelColWidth)
Dir_CaptchaGenerator = "ANBSCaptchaGenerator.asp?img="
If BLongDescription > "" Then
DescDiv = DescDiv & "" & vbcrlf
DescDiv = DescDiv & BLongDescription & vbcrlf
DescDiv = DescDiv & "
" & vbcrlf
End If
Dim RndNum', ImageNo
Randomize Timer
' ImageNo = CStr(Fix(99999 * Rnd)) 'Here you can set the max number of images to be shown, ie. 99999999
' Session("ImageNo") = ImageNo 'Session variable of the final number to be shown
Session(BSessionVar) = BCaptchaLength 'Session variable of the final number to be shown
For i = 1 To Len(BCaptchaLength)
RndNum = 99999 * Rnd 'Random number to avoid caching
' here, 'img' shows which number should be displayed, we write the image tag
' to get the image from asp page.
Rett = Rett & ""
Rett = Rett & ""
Next

If LabelColWidth > 0 Then
Rett = Rett & "
" & vbcrlf
Rett = Rett & "" & vbcrlf
Rett = Rett & "
" & vbcrlf
Div2Close = "
" & vbcrlf
End If
If TextboxWidth > 0 Then InputStyle = " Style=""width:" & TextboxWidth & "px"" "
Rett = Rett & " Rett = Rett & "placeholder=""" & RemoveHTML(BCaption) & """ class=""form-control"" "
ANBSCaptchaBox = Rett & "value=""" & BValue & """ " & InputStyle & " >" & DescDiv & Div2Close
End Function

BCaptchaLength, BSessionVar, BName, BValue, BCaption, TextboxWidth, LabelColWidth, BLongDescription

Views 779 Downloads 335

Classic ASP Protection
ANmarAmdeen
763
Revisions

v1.0