jEasyCaptcha is a simple method can help setup your own captcha server.
Captcha Server:
Sub Class_Globals
Dim captcha As jEasyCaptcha
End Sub
Public Sub Initialize
captcha.Initialize(320,90, 5)
End Sub
Sub Handle(req As ServletRequest, resp As ServletResponse)
resp.ContentType = "image/gif"
resp.setHeader("Pragma", "No-cache")
resp.setHeader("Cache-Control", "no-cache")
req.GetSession.SetAttribute("captcha",captcha.toString)
captcha.setFont("Arial", 12)
captcha.WriteOut(resp.OutputStream)
End Sub
Verify Captcha:
Sub Class_Globals
End Sub
Public Sub Initialize
End Sub
Sub Handle(req As ServletRequest, resp As ServletResponse)
Dim verCode As String = req.GetParameter("code")
Dim sessionCode As String = req.getSession().getAttribute("captcha")
Log("sessionCode=" & sessionCode)
Dim json As String
If (verCode = Null) Or (sessionCode.Contains(verCode) = False) Then
json = $"{"result":"false"}"$
Else
json = $"{"result":"true"}"$
End If
Log(json)
End Sub