Free Captchas!
EasyCaptchas are the easiest way to add Captcha functionality to your website. No software to install! We serve the captcha images and validate the form input. Fully customizable Captchas like this are just minutes away.
Using EasyCaptchas on your site
Step 1: Add this code to your form:
<input name="captcha" size="16"/>
<img id="captchaimg" src="http://www.EasyCaptchas.com/[UNIQUE_SESSION_ID].captcha.gif" />
<a href="http://easycaptchas.com/" onclick="document.getElementById('captchaimg').src+='?rf=1';return false;" style="font-size:9px">refresh</a><br />
<!-- Free Captcha provided courtesy of www.EasyCaptchas.com (please do not remove this link) -->
<noscript><a href="http://easycaptchas.com/" onclick="return false;" style="display:none">Captcha</a></noscript>
Step 2: Replace the [UNIQUE_SESSION_ID] variable above with a unique string that you generate. Make sure this is different for each user on your web site and you can access this on the page where the form submits to. Usually this would be a sessionID or similar unique token, combined with your domain name. Please avoid using special characters.
Step 3: On the next page (where your form submits), make an HTTP request to validate the captcha.
http://easycaptchas.com/check.aspx?sessionid=[UNIQUE_SESSION_ID]&input=[VALUE_OF_CAPTCHA]
[UNIQUE_SESSION_ID] must be the same unique value you passed in when you called the image.
[VALUE_OF_CAPTCHA] must be the text that the user typed into the "captcha" form field.
This page will return TRUE if it matched or FALSE if it didn't.
Customize your EasyCaptcha
Easily customize the size, colors and look of your EasyCaptcha by passing URL parameters on the image request.
<img src="http://easycaptchas.com/[UNIQUE_SESSION_ID].captcha.gif?transparent=true&bgcolor=cceeff" />
Available Parameters:
- transparent=[true|false] (if true, will return a transparent background gif image, masked to your background color)
- bgcolor=[hex color] (background color in hex format, like FFAAAA. Don't include the pound sign)
- color=[hex color] (text color in hex format, like FFAAAA. Don't include the pound sign)
- height=[number] (height in pixels)
- width=[number] (width in pixels)
- lines=[true|false] (if true will draw squiggly lines on the image for added security)
- noise=[true|false] (if true will draw random dots on the image for added security)
- words=[true|false] (if true will use english words instead of randomly generated words)
- phrase=[string] (allows you to generate your own captcha phrase if you plan to do your own validation. Of course you would need to save the image locally and send the local version to the browser so the phrase is not visible in the image URL).
Sample Code
Cold Fusion
<!--- this code goes on the form page --->
<cfset uniqueid = "#cgi.server_name##client.cfid##client.cfid#">
<form action="submit.cfm" method="post">
<input name="captcha" size="24"/>
<cfoutput>
<img id="captchaimg" src="http://www.EasyCaptchas.com/#uniqueid#.captcha.gif" border="0"/>
<a href="http://easycaptchas.com/" onclick="document.getElementById('captchaimg').src+='?rf=1';return false;" style="font-size:9px">refresh</a><br />
<!-- Free Captcha provided courtesy of www.EasyCaptchas.com (please do not remove this link) -->
<noscript><a href="http://easycaptchas.com/" onclick="return false;" style="display:none">Captcha</a></noscript>
</cfoutput>
<input type=submit>
</form>
<!--- this code goes on the submit page --->
<cfset uniqueid = "#cgi.server_name##client.cfid##client.cfid#">
<cfset isValid="false">
<cftry>
<cfhttp url="http://www.easycaptchas.com/check.aspx?sessionid=#uniqueid#&input=#form.captcha#" method="GET"></cfhttp>
<cfset isValid = trim(cfhttp.filecontent)>
<cfcatch></cfcatch>
</cftry>
<cfif isValid>
Captcha is valid!
<!--- form is validated --->
<cfelse>
Captcha validation failed!
<!--- form is invalid, take them back to re-enter the captcha --->
</cfif>
PHP
<!-- this code goes on the form page -->
<?php $uniqueid = $_SERVER['HTTP_HOST'].session_id(); ?>
<form action="submit.php" method="post">
<input name="captcha" size="24"/>
<img id="captchaimg" src="http://www.EasyCaptchas.com/<?php echo $uniqueid ?>.captcha.gif" border="0"/>
<a href="http://easycaptchas.com/" onclick="document.getElementById('captchaimg').src+='?rf=1';return false;" style="font-size:9px">refresh</a><br />
<!-- Free Captcha provided courtesy of www.EasyCaptchas.com (please do not remove this link) -->
<noscript><a href="http://easycaptchas.com/" onclick="return false;" style="display:none">Captcha</a></noscript>
<input type=submit>
</form>
<!-- this code goes on the submit page -->
<?php
$uniqueid = $_SERVER['HTTP_HOST'].session_id();
$fh = fopen("http://www.easycaptchas.com/check.aspx?sessionid=".$uniqueid."&input=".$_POST['captcha'], 'r');
$result = trim(fread($fh,8192));
if ($result == "TRUE")
{
echo "Captcha is valid!";
}
else
{
echo "Captcha validation failed!";
}
?>
ASP.NET (c#)
<!-- this code goes on the form page -->
<form action="submit.aspx" method="post">
<input name="captcha" size="24"/>
<img id="captchaimg" src="http://www.EasyCaptchas.com/<%= Session.SessionID %>.captcha.gif" border="0"/>
<a href="http://easycaptchas.com/" onclick="document.getElementById('captchaimg').src+='?rf=1';return false;" style="font-size:9px">refresh</a><br />
<!-- Free Captcha provided courtesy of www.EasyCaptchas.com (please do not remove this link) -->
<noscript><a href="http://easycaptchas.com/" onclick="return false;" style="display:none">Captcha</a></noscript>
<input type=submit>
</form>
<!-- this code goes on the submit page -->
<%
bool isValid = false;
try
{
System.Net.WebClient wc = new System.Net.WebClient();
string data = wc.DownloadString("http://www.easycaptchas.com/check.aspx?sessionid=" + Session.SessionID + "&input=" + Request.Params["captcha"]);
bool.TryParse(data.Trim(), out isValid);
}
catch
{
}
if (isValid)
{
Response.Write("Captcha is valid!");
}
else
Response.Write("Captcha validation failed!");
%>