<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Simple PHP-GD captcha image</title>
	<atom:link href="http://www.php-help.ro/php-tutorials/simple-php-gd-capcha-image/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.php-help.ro/php-tutorials/simple-php-gd-capcha-image/</link>
	<description>All about integrating PHP with JavaScript and Flash</description>
	<lastBuildDate>Tue, 31 Jan 2012 02:53:55 +0200</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: 21 Free CAPTCHA Sources &#124; Codrops</title>
		<link>http://www.php-help.ro/php-tutorials/simple-php-gd-capcha-image/comment-page-1/#comment-5278</link>
		<dc:creator>21 Free CAPTCHA Sources &#124; Codrops</dc:creator>
		<pubDate>Wed, 20 Jul 2011 15:56:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.php-help.ro/php/simple-php-gd-capcha-image/#comment-5278</guid>
		<description>[...] Classhttp://fragged.org/dev/hOOmanTest_captcha_for_mootools.php19. Simple PHP-GD CAPTCHA Imagehttp://www.php-help.ro/php-tutorials/simple-php-gd-capcha-image/20. Simple AJAX CAPTCHAhttp://blog.smileylover.com/simple-ajax-captcha/21. AJAX CAPTCHA [...]</description>
		<content:encoded><![CDATA[<p>[...] Classhttp://fragged.org/dev/hOOmanTest_captcha_for_mootools.php19. Simple PHP-GD CAPTCHA Imagehttp://www.php-help.ro/php-tutorials/simple-php-gd-capcha-image/20. Simple AJAX CAPTCHAhttp://blog.smileylover.com/simple-ajax-captcha/21. AJAX CAPTCHA [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tiganus Razvan</title>
		<link>http://www.php-help.ro/php-tutorials/simple-php-gd-capcha-image/comment-page-1/#comment-3909</link>
		<dc:creator>Tiganus Razvan</dc:creator>
		<pubDate>Mon, 03 May 2010 15:24:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.php-help.ro/php/simple-php-gd-capcha-image/#comment-3909</guid>
		<description>i already sent it to php.net too..
this is respons for &lt;strong&gt;adam at worldwrestlingmania dot cjb dot net&lt;/strong&gt;&lt;br /&gt;
06-Dec-2009 04:35(here http://php.net/manual/en/function.imagettftext.php)&lt;br /&gt;
&lt;br /&gt;
and for all that&#039;s using captcha to prevent send information in a form using a robot.
People you don&#039;t need captcha!!!! There is another convenient method , to protect a website for spamming and is much simple:&lt;br /&gt;
&lt;br /&gt;
Let&#039;s consider the 1st page(with the form) and let&#039;s say the second ... index.php and receiver.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
index.php:&lt;br /&gt;
----------------------------------------------------------------------&lt;br /&gt;

&lt;code&gt;&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0   Transitional//EN&quot;&gt;&lt;HTML&gt;&lt;br /&gt;
&lt;HEAD&gt;&lt;br /&gt;
&lt;TITLE&gt;index.php&lt;/TITLE&gt;&lt;br /&gt;
&lt;/HEAD&gt;&lt;br /&gt;
&lt;BODY&gt;&lt;br /&gt;
&lt;?php&lt;br /&gt;
echo(&#039;this is the form`s page&#039;);&lt;br /&gt;
?&gt;&lt;FORM METHOD=POST ACTION=&quot;receiver.php&quot;&gt;&lt;br /&gt;
    
&lt;INPUT TYPE=&quot;text&quot; NAME=&quot;data&quot;&gt;&nbsp;&lt;INPUT TYPE=&quot;submit&quot; VALUE=&quot;send!&quot; NAME=&quot;send&quot;&gt;&lt;BR&gt;&lt;br /&gt;
    
A form without captcha!!!&lt;br /&gt;
&lt;/FORM&gt;&lt;br /&gt;
&lt;/BODY&gt;&lt;/HTML&gt;&lt;br /&gt;&lt;/code&gt;

----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
receiver.php&lt;br /&gt;
----------------------------------------------------------------------&lt;br /&gt;

&lt;code&gt;&lt;?php&lt;br /&gt;
//receiver.php&lt;br /&gt;
function protectform(){&lt;br /&gt;
    
if($_SERVER[&quot;REQUEST_METHOD&quot;]!=&#039;GET&#039;){&lt;br /&gt;
&lt;br /&gt;
        
$servername=$_SERVER[&quot;SERVER_NAME&quot;];&lt;br /&gt;
        
$noterror=true;&lt;br /&gt;
        
if   (isset($_SERVER[&quot;HTTP_REFERER&quot;]))&lt;br /&gt;
            
$gethost=Parse_url($_SERVER[&quot;HTTP_REFERER&quot;]);&lt;br /&gt;
        
else&lt;br /&gt;
            
$noterror=false;&lt;br /&gt;
        
$pimp=false;&lt;br /&gt;
        
if (!$noterror )&lt;br /&gt;
            
$pimp=true;&lt;br /&gt;
        
if(isset($gethost))&lt;br /&gt;
            
if    ($gethost[&#039;host&#039;]!==$servername)&lt;br /&gt;
                
$pimp=true;&lt;br /&gt;
        
&lt;br /&gt;
    
&lt;br /&gt;
        
if ($pimp){&lt;br /&gt;
            
//print_r($gethost);&lt;br /&gt;
              
die(&#039;Go away hacker!&#039;);&lt;br /&gt;
        
}&lt;br /&gt;
&lt;br /&gt;
    
}&lt;br /&gt;
}&lt;br /&gt;
protectform();&lt;br /&gt;
if(isset($_REQUEST[&#039;send&#039;])and  (trim($_REQUEST[&#039;data&#039;])!=&#039;&#039;) ) echo(&#039;We already send to this page this  value:&nbsp;&#039;.$_REQUEST[&#039;data&#039;].&#039;&lt;br&gt;&#039;); else echo(&#039;Please  try to fill something in that form!&#039;);&lt;br /&gt;
?&gt;&lt;A HREF=&quot;index.php&quot;&gt;Return to my form&lt;/A&gt;&lt;br /&gt;&lt;/code&gt;

----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
how to probe it?&lt;br /&gt;
well let&#039;s say you already upload it on &lt;br /&gt;
www.example.com/myfolder/ index.php and receiver.php&lt;br /&gt;
&lt;br /&gt;
so try to digit &lt;br /&gt;
www.example.com/myfolder/index.php&lt;br /&gt;
&lt;br /&gt;
now fill the form&#039;s value...and click send.&lt;br /&gt;
now is redirected to receiver.php and you see the right value.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let&#039;s probe the vulnerability of the script:&lt;br /&gt;
digit again&lt;br /&gt;
www.example.com/myfolder/index.php &lt;br /&gt;
now when you see the form press File/Save as from the browser&#039;s menu   and save it on desktop like index.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
now try to open with notepad to edit it and change this line:&lt;br /&gt;
&lt;FORM METHOD=POST ACTION=&quot;receiver.php&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
to something like this:&lt;br /&gt;
 
&lt;FORM METHOD=POST ACTION=&quot;http://www.example.com/myfolder/receiver.php&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
now save it and double click it from desktop.&lt;br /&gt;
well what you see when you already fill that text form and you send the data to www.example.com/myfolder/ ?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(For php beginners:www.example.com  can be www.banana.com too , i don&#039;t know where you will probe this software)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
to all people who said :&quot;php is unsecure&quot; i respond with :&lt;br /&gt;
I  am writing scripts from 1992, my opinion like expert is : php  rooooooooolez!!! people if you don&#039;t know how to write scripts in php  try php.net to learn something. me,Constantin</description>
		<content:encoded><![CDATA[<p>i already sent it to php.net too..<br />
this is respons for <strong>adam at worldwrestlingmania dot cjb dot net</strong><br />
06-Dec-2009 04:35(here <a href="http://php.net/manual/en/function.imagettftext.php)" rel="nofollow">http://php.net/manual/en/function.imagettftext.php)</a></p>
<p>and for all that&#8217;s using captcha to prevent send information in a form using a robot.<br />
People you don&#8217;t need captcha!!!! There is another convenient method , to protect a website for spamming and is much simple:</p>
<p>Let&#8217;s consider the 1st page(with the form) and let&#8217;s say the second &#8230; index.php and receiver.php</p>
<p>
index.php:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p><code>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0   Transitional//EN&quot;&gt;&lt;HTML&gt;<br />
&lt;HEAD&gt;<br />
&lt;TITLE&gt;index.php&lt;/TITLE&gt;<br />
&lt;/HEAD&gt;<br />
&lt;BODY&gt;<br />
&lt;?php<br />
echo('this is the form`s page');<br />
?&gt;&lt;FORM METHOD=POST ACTION=&quot;receiver.php&quot;&gt;<br />
    <br />
&lt;INPUT TYPE=&quot;text&quot; NAME=&quot;data&quot;&gt;&amp;nbsp;&lt;INPUT TYPE=&quot;submit&quot; VALUE=&quot;send!&quot; NAME=&quot;send&quot;&gt;&lt;BR&gt;<br />
    <br />
A form without captcha!!!<br />
&lt;/FORM&gt;<br />
&lt;/BODY&gt;&lt;/HTML&gt;<br /></code></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>
receiver.php<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p><code>&lt;?php<br />
//receiver.php<br />
function protectform(){<br />
    <br />
if($_SERVER[&quot;REQUEST_METHOD&quot;]!='GET'){</p>
<p>        <br />
$servername=$_SERVER[&quot;SERVER_NAME&quot;];<br />
        <br />
$noterror=true;<br />
        <br />
if   (isset($_SERVER[&quot;HTTP_REFERER&quot;]))<br />
            <br />
$gethost=Parse_url($_SERVER[&quot;HTTP_REFERER&quot;]);<br />
        <br />
else<br />
            <br />
$noterror=false;<br />
        <br />
$pimp=false;<br />
        <br />
if (!$noterror )<br />
            <br />
$pimp=true;<br />
        <br />
if(isset($gethost))<br />
            <br />
if    ($gethost['host']!==$servername)<br />
                <br />
$pimp=true;<br />
        <br />
<br />
    <br />
<br />
        <br />
if ($pimp){<br />
            <br />
//print_r($gethost);<br />
              <br />
die('Go away hacker!');<br />
        <br />
}</p>
<p>    <br />
}<br />
}<br />
protectform();<br />
if(isset($_REQUEST['send'])and  (trim($_REQUEST['data'])!='') ) echo('We already send to this page this  value:&amp;nbsp;'.$_REQUEST['data'].'&lt;br&gt;'); else echo('Please  try to fill something in that form!');<br />
?&gt;&lt;A HREF=&quot;index.php&quot;&gt;Return to my form&lt;/A&gt;<br /></code></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>how to probe it?<br />
well let&#8217;s say you already upload it on <br />
<a href="http://www.example.com/myfolder/" rel="nofollow">http://www.example.com/myfolder/</a> index.php and receiver.php</p>
<p>so try to digit <br />
<a href="http://www.example.com/myfolder/index.php" rel="nofollow">http://www.example.com/myfolder/index.php</a></p>
<p>now fill the form&#8217;s value&#8230;and click send.<br />
now is redirected to receiver.php and you see the right value.</p>
<p>
Let&#8217;s probe the vulnerability of the script:<br />
digit again<br />
<a href="http://www.example.com/myfolder/index.php" rel="nofollow">http://www.example.com/myfolder/index.php</a> <br />
now when you see the form press File/Save as from the browser&#8217;s menu   and save it on desktop like index.html</p>
<p>
now try to open with notepad to edit it and change this line:<br />
&lt;FORM METHOD=POST ACTION=&quot;receiver.php&quot;&gt;</p>
<p>to something like this:<br />
 <br />
&lt;FORM METHOD=POST ACTION=&quot;http://www.example.com/myfolder/receiver.php&quot;&gt;</p>
<p>now save it and double click it from desktop.<br />
well what you see when you already fill that text form and you send the data to <a href="http://www.example.com/myfolder/" rel="nofollow">http://www.example.com/myfolder/</a> ?</p>
<p>
(For php beginners:www.example.com  can be <a href="http://www.banana.com" rel="nofollow">http://www.banana.com</a> too , i don&#8217;t know where you will probe this software)</p>
<p>
to all people who said :&quot;php is unsecure&quot; i respond with :<br />
I  am writing scripts from 1992, my opinion like expert is : php  rooooooooolez!!! people if you don&#8217;t know how to write scripts in php  try php.net to learn something. me,Constantin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shane</title>
		<link>http://www.php-help.ro/php-tutorials/simple-php-gd-capcha-image/comment-page-1/#comment-3728</link>
		<dc:creator>Shane</dc:creator>
		<pubDate>Wed, 10 Mar 2010 22:30:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.php-help.ro/php/simple-php-gd-capcha-image/#comment-3728</guid>
		<description>Hi

I downloaded and ran the script on a Windows server but was unsuccessful. I have GD installed (phpinfo(); stated everything was enabled); I also changed the php.ini file - changed ;extension=php_gd2.dll to extension=php_gd2.dll, restarted the server but still no joy. Any help would greatly appreciated.

Thanks in advance, Shane</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>I downloaded and ran the script on a Windows server but was unsuccessful. I have GD installed (phpinfo(); stated everything was enabled); I also changed the php.ini file &#8211; changed ;extension=php_gd2.dll to extension=php_gd2.dll, restarted the server but still no joy. Any help would greatly appreciated.</p>
<p>Thanks in advance, Shane</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Constantin Boiangiu</title>
		<link>http://www.php-help.ro/php-tutorials/simple-php-gd-capcha-image/comment-page-1/#comment-3524</link>
		<dc:creator>Constantin Boiangiu</dc:creator>
		<pubDate>Sun, 20 Dec 2009 14:10:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.php-help.ro/php/simple-php-gd-capcha-image/#comment-3524</guid>
		<description>Please do. Drop me a line at constantin [at] php-help.ro I&#039;ll update your comment above with the complete script you&#039;ll send. Thank you.</description>
		<content:encoded><![CDATA[<p>Please do. Drop me a line at constantin [at] php-help.ro I&#8217;ll update your comment above with the complete script you&#8217;ll send. Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: m7o</title>
		<link>http://www.php-help.ro/php-tutorials/simple-php-gd-capcha-image/comment-page-1/#comment-3519</link>
		<dc:creator>m7o</dc:creator>
		<pubDate>Sat, 19 Dec 2009 12:44:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.php-help.ro/php/simple-php-gd-capcha-image/#comment-3519</guid>
		<description>the code didn&#039;t come though all they, it got gut off and the image tag got removed ... too bad. Maybe I can post it somewhere else or send it to you.</description>
		<content:encoded><![CDATA[<p>the code didn&#8217;t come though all they, it got gut off and the image tag got removed &#8230; too bad. Maybe I can post it somewhere else or send it to you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: m7o</title>
		<link>http://www.php-help.ro/php-tutorials/simple-php-gd-capcha-image/comment-page-1/#comment-3518</link>
		<dc:creator>m7o</dc:creator>
		<pubDate>Sat, 19 Dec 2009 12:42:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.php-help.ro/php/simple-php-gd-capcha-image/#comment-3518</guid>
		<description>Thanks a lot for the script, I added a bit to get better random numbers and letters and to have different angles and colors for them. I used a smaller jpg and changed the dimensions a bit, of course everyone can play with the numbers and the jpg size. And to make sure one won&#039;t get an image from the browser cache add a unique or random string to the image url, for example like this:

&lt;?php
echo &quot;&quot;;
?&gt;

The altered script:

&lt;?php

session_start();
srand((double)microtime()*1000000);
$_SESSION[&#039;security_string&#039;]= substr(md5(uniqid()), 0, 5);
$image_text = empty($_SESSION[&#039;security_string&#039;]) ? &#039;error&#039; : $_SESSION[&#039;security_string&#039;];
$img=imagecreatefromjpeg(&quot;texture.jpg&quot;);
$x = rand(5,10);
for($n=0;$n</description>
		<content:encoded><![CDATA[<p>Thanks a lot for the script, I added a bit to get better random numbers and letters and to have different angles and colors for them. I used a smaller jpg and changed the dimensions a bit, of course everyone can play with the numbers and the jpg size. And to make sure one won&#8217;t get an image from the browser cache add a unique or random string to the image url, for example like this:</p>
<p>&lt;?php<br />
echo &#8220;&#8221;;<br />
?&gt;</p>
<p>The altered script:</p>
<p>&lt;?php</p>
<p>session_start();<br />
srand((double)microtime()*1000000);<br />
$_SESSION['security_string']= substr(md5(uniqid()), 0, 5);<br />
$image_text = empty($_SESSION['security_string']) ? &#8216;error&#8217; : $_SESSION['security_string'];<br />
$img=imagecreatefromjpeg(&#8220;texture.jpg&#8221;);<br />
$x = rand(5,10);<br />
for($n=0;$n</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Constantin Boiangiu</title>
		<link>http://www.php-help.ro/php-tutorials/simple-php-gd-capcha-image/comment-page-1/#comment-3334</link>
		<dc:creator>Constantin Boiangiu</dc:creator>
		<pubDate>Mon, 14 Sep 2009 08:11:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.php-help.ro/php/simple-php-gd-capcha-image/#comment-3334</guid>
		<description>How you implement the form is your own choice. The purpose of this is to show a simple way to generate a captcha image. Try a google search, there are tons of tutorials on form processing.</description>
		<content:encoded><![CDATA[<p>How you implement the form is your own choice. The purpose of this is to show a simple way to generate a captcha image. Try a google search, there are tons of tutorials on form processing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Achshar</title>
		<link>http://www.php-help.ro/php-tutorials/simple-php-gd-capcha-image/comment-page-1/#comment-3330</link>
		<dc:creator>Achshar</dc:creator>
		<pubDate>Tue, 08 Sep 2009 21:12:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.php-help.ro/php/simple-php-gd-capcha-image/#comment-3330</guid>
		<description>hello fellas
i  am a newbie and dont have much of coding experience....
i got every thing but i dony find the form... like a text field.... and how to check if the value inserted in the text box is what the session has generated... i dwnloaded the script but index page only has the image not the form...
so i guess it is not a &quot; working &quot; example...</description>
		<content:encoded><![CDATA[<p>hello fellas<br />
i  am a newbie and dont have much of coding experience&#8230;.<br />
i got every thing but i dony find the form&#8230; like a text field&#8230;. and how to check if the value inserted in the text box is what the session has generated&#8230; i dwnloaded the script but index page only has the image not the form&#8230;<br />
so i guess it is not a &#8221; working &#8221; example&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cody Taylor</title>
		<link>http://www.php-help.ro/php-tutorials/simple-php-gd-capcha-image/comment-page-1/#comment-3283</link>
		<dc:creator>Cody Taylor</dc:creator>
		<pubDate>Fri, 14 Aug 2009 16:22:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.php-help.ro/php/simple-php-gd-capcha-image/#comment-3283</guid>
		<description>For random spacing and coloring on each letter check http://codytaylor.org/?p=14213</description>
		<content:encoded><![CDATA[<p>For random spacing and coloring on each letter check <a href="http://codytaylor.org/?p=14213" rel="nofollow">http://codytaylor.org/?p=14213</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: How to create a math captcha image</title>
		<link>http://www.php-help.ro/php-tutorials/simple-php-gd-capcha-image/comment-page-1/#comment-2895</link>
		<dc:creator>How to create a math captcha image</dc:creator>
		<pubDate>Fri, 27 Feb 2009 08:33:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.php-help.ro/php/simple-php-gd-capcha-image/#comment-2895</guid>
		<description>[...] I wrote a small tutorial about how to create a captcha image. After surfing the web today, I&#8217;ve found another idea. How about creating a captcha image [...]</description>
		<content:encoded><![CDATA[<p>[...] I wrote a small tutorial about how to create a captcha image. After surfing the web today, I&#8217;ve found another idea. How about creating a captcha image [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

