<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Coder2Coder</title>
	<atom:link href="http://www.atekie.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.atekie.com/blog</link>
	<description>brought to you by aTekie</description>
	<lastBuildDate>Wed, 15 Jul 2009 04:32:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CAPTCHA Script (Human Verification)</title>
		<link>http://www.atekie.com/blog/?p=6</link>
		<comments>http://www.atekie.com/blog/?p=6#comments</comments>
		<pubDate>Mon, 13 Jul 2009 06:09:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[CAPTCHA]]></category>
		<category><![CDATA[FORM. HUMAN VERIFICATION]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.atekie.com/newsite/blog/?p=6</guid>
		<description><![CDATA[Implement a PHP CATCHPA script in a few easy steps.]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">With spiders crawling websites and sniffing out email addresses you many not want to simply list your email address on your website. Many people are choosing to implement customer contact forms to hide their email address from spiders.  Just because you don&#8217;t list your email does not mean scripts won&#8217;t submit your forms and send you a load of junk each day to your inbox. CAPTCHA allows you to verify humans are submitting the form and not a script by asking the user to enter the text they see in an image placed on the form. Below I have provided an easy to use script to integrate CAPTCHA technology on your form.</p>
<p style="text-align: left;"><a title="Download Source" href="http://www.atekie.com/downloads/captcha.zip" target="_self">Download Source</a></p>
<pre class="brush: php;">
&lt;?
function generateImageCode(){
	//Code Options
	$characters = &quot;ABCDEF23456789&quot;;
	$code_length = 5;

	$code = &quot;&quot;;
	while(strlen($code)&lt;$code_length){
		$code.= substr($characters, mt_rand(0, strlen($characters)-1), 1);
	}
	return $code;
}

function generateImage($code){
	//Image Options
	$width=&quot;60&quot;;
	$height=&quot;30&quot;;

	//Generate Image
	$image = imagecreate($width, $height) or die('GD Library not installed, please contact web host provider.');
	$bgColor = imagecolorallocate ($image, 255, 255, 255);
	$textColor = imagecolorallocate ($image, 0, 0, 0);
	imagestring ($image, 5, 5, 8, $code, $textColor);

	//Prevent Browser Cache
	header(&quot;Expires: Mon, 26 Jul 1997 05:00:00 GMT&quot;);
	header(&quot;Last-Modified: &quot; . gmdate(&quot;D, d M Y H:i:s&quot;) . &quot; GMT&quot;);
	header(&quot;Cache-Control: no-store, no-cache, must-revalidate&quot;);
	header(&quot;Cache-Control: post-check=0, pre-check=0&quot;, false);
	header(&quot;Pragma: no-cache&quot;);
	header('Content-type: image/jpeg');

	//Send Image to Browser
	imagejpeg($image);
	//Free up Memory
	imagedestroy($image);
}

session_start();
$_SESSION['code'] = generateImageCode();
generateImage($_SESSION['code']);

?&gt;
</pre>
<p>Now that we have the script to produce the image, we now need to integrate the script into a form:</p>
<pre class="brush: php;">
&lt;?
	session_start();

	if ($_POST) {
		if($validate==$_SESSION['code']){
			echo(&quot;Correct code entered. &lt;br /&gt;&quot;);
		} else {
			echo(&quot;Incorrect code entered. &lt;br /&gt;&quot;);
		}
	}
?&gt;

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
&lt;html&gt;
   &lt;head&gt;
	&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=iso-8859-1&quot;&gt;
	&lt;title&gt;Test Captcha&lt;/title&gt;
   &lt;/head&gt;
   &lt;body bgcolor=&quot;#ffffff&quot;&gt;
	&lt;form action=&quot;&lt;?=$PHP_SELF?&gt;&quot; method=&quot;post&quot; name=&quot;FormName&quot;&gt;
  	    &lt;img src=&quot;captcha.php&quot; alt=&quot;&quot; height=&quot;30&quot; width=&quot;60&quot; border=&quot;0&quot;&gt;&lt;br /&gt;
	    Please type above image text below:&lt;br /&gt;
	    &lt;input type=&quot;text&quot; name=&quot;validate&quot; size=&quot;24&quot; border=&quot;0&quot;&gt;
	    &lt;p&gt;&lt;input type=&quot;submit&quot; name=&quot;Test&quot; value=&quot;Test&quot; border=&quot;0&quot;&gt;&lt;/p&gt;
	&lt;/form&gt;
    &lt;/body&gt;
&lt;/html&gt;
?&gt;
</pre>
<p style="text-align: left;"><a title="Download Source" href="http://www.atekie.com/downloads/captcha.zip" target="_self">Download Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.atekie.com/blog/?feed=rss2&amp;p=6</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

