Project

General

Profile

Files » captchasProcess.jsp

captchasProcess.jsp - Soh Keong, 09/22/2004 07:24 AM

 
<%--
% Example for using the free http://captchas.net Webservice
% Documentation see http://captchas.net/sample/jsp/
--%>

<%@ page language="java" import="com.ecosway.captchas.CaptchasDotNet"%>

<%@ include file="../menu.jsp"%>
<div align="center">
<br> <br>
<%
// Construct the captchas object
// Use same settings as in query.jsp
CaptchasDotNet captchas = new CaptchasDotNet(
request.getSession(true), // Ensure session
CaptchasDotNet.CLIENT, // client
CaptchasDotNet.SECRET // secret
);
// Read the form values
String password = request.getParameter("password");

// Check captcha
String body;
switch (captchas.check(password)) {
case 's':
body = "Session seems to be timed out or broken. ";
body += "Please try again or report error to administrator.";
break;
case 'm':
body = "Every CAPTCHA can only be used once. ";
body += "The current CAPTCHA has already been used. ";
body += "Please use back button and reload";
break;
case 'w':
body = "You entered the wrong password. ";
body += "Please use back button and try again. ";
break;
default:
body = "Answer was entered correctly";
break;
}
%>
<%=body%>
</div>
(3-3/3)