<?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>elxsy &#187; Php</title>
	<atom:link href="http://www.elxsy.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.elxsy.com</link>
	<description>where humanity wins the fight against machines</description>
	<lastBuildDate>Mon, 15 Aug 2011 10:08:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Installing ImageMagick on Windows and Using with PHP &#8211; Imagick</title>
		<link>http://www.elxsy.com/2009/07/installing-imagemagick-on-windows-and-using-with-php-imagick/</link>
		<comments>http://www.elxsy.com/2009/07/installing-imagemagick-on-windows-and-using-with-php-imagick/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 16:20:35 +0000</pubDate>
		<dc:creator>cenOTapH</dc:creator>
				<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[dll]]></category>
		<category><![CDATA[exe]]></category>
		<category><![CDATA[imagick]]></category>
		<category><![CDATA[imagick dll]]></category>
		<category><![CDATA[imagick installation]]></category>
		<category><![CDATA[imagick on windows]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[php 5.2]]></category>
		<category><![CDATA[php convert image]]></category>
		<category><![CDATA[php image manipulation]]></category>
		<category><![CDATA[php imagick dll]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[windows xp]]></category>

		<guid isPermaLink="false">http://www.elxsy.com/?p=265</guid>
		<description><![CDATA[As most of your know ImageMagick is like the photoshop on your console demand. Best with their explanation. ImageMagick® is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>As most of your know <a href="http://imagemagick.org/script/index.php">ImageMagick </a>is like the photoshop on your console demand. Best with their explanation.</p>
<blockquote><p>ImageMagick<sup><a href="http://tarr.uspto.gov/servlet/tarr?regser=serial&amp;entry=78333969">®</a></sup> is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of <a href="http://imagemagick.org/script/formats.php">formats</a> (over 100) including <a href="http://imagemagick.org/script/motion-picture.php">DPX</a>, <a href="http://imagemagick.org/script/high-dynamic-range.php">EXR</a>, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.</p></blockquote>
<p>It is very powerful and supports all platforms with tons of different languages and implementations. Because my hosting solutions did not suppot it (many of them dont do as well) I always used awesome GD library to process images on my projects. Well now my hosting does support and I am going to use it so I needed to install it to my development environment which is windows. I am going to install and use Imagick also because using IM from native PHP is much more faster than using it from console via exec.</p>
<p>Well first of all ImageMagick on windows with PHP is a really pain in the ass, if you have the commitment and time go for it otherwise use it from console. Here are the steps and todo's to install for <strong>PHP 5.2.x</strong>, ( I dont know if it works with PHP 5.3.x or below, you will need to test for yourself. I am a happy camper for now ).</p>
<h3><span style="color: #ff6600;">UPDATE</span></h3>
<p>Just to make things clear, all the PHP dll files (librarires) are 32 bit, so if your system is 64 bit and you will still need to download and operate 32 bit ImageMagick, Apache, etc.</p>
<h3><span id="more-265"></span>1 Download ImageMagick</h3>
<p>Go to <a href="http://imagemagick.org/script/binary-releases.php#windows">http://imagemagick.org/script/binary-releases.php#windows</a> to download the latest version, which is <strong>ImageMagick-6.5.4-2-Q16-windows-dll.exe</strong></p>
<p>Now the beauty, static versions are suppose to work with every platform but they act really funny so you should download a dynamic version. If you system/pc supports go for 16 bit Q16. The difference is explained on the link very well.</p>
<p>Now in my case, the latest version did not work so I had to go through old versions and <strong>ImageMagick-6.4.2-7-Q16-windows-dll</strong> version worked like charm for me. My system is <strong>Windows XP SP2, 32 Bit, Intel Centrino 1.76GHZ.</strong> You can download the older versions from <a href="http://image_magick.veidrodis.com/image_magick/binaries/">here</a>.</p>
<p>I suggest you to download and try the latest one, complete all steps, if it doesnt work try with a lower version and so on.</p>
<h3>2 Install ImageMagick</h3>
<p>Install the IM on a path like <code>C:\imagemagick\</code> with no spaces and simple location. Do not go for c:\program files\etc</p>
<p><span style="color: #ff0000;">Do not forget</span> to click on the "<strong>Add to system path</strong>" checkbox. You can ignore the rest of the checkboxes</p>
<h3>3 Testing the Installation</h3>
<p>Open the command prompt (Run-&gt;"CMD"-&gt;ENTER) and type in <strong>convert</strong> and press enter. You should see the help parameters of convert. If so go to <strong>step 4.</strong></p>
<p>if it says its failed or unknown function or type in a parameter to convert ( which is a default function in Windows XP to convert HDD from FAT32 to NTFS or vice varsa ) you need to add path to environment by yourself.</p>
<p>My Computer -&gt; Right Click -&gt; Properties -&gt; Advanced (Tab) -&gt; Environment Variables (at the bottom) -&gt; System Variables (Section) -&gt; Scroll to Find "<strong>Path</strong>" -&gt; Select it and click <strong>Edit</strong> -&gt; Add your installation directory to there.</p>
<h3>4 Downloading the php_Imagick.dll</h3>
<p>Again the version problem, well if you are using <strong>PHP 5.2.x</strong> this is <a href="http://valokuva.org/outside-blog-content/imagick-windows-builds/080709/">where you will get your</a> dll.</p>
<p>dyn = dynamic, st = static, q16 = 16 bit, q8= 8 bit. This should match your downloaded version of course. If you downloaded q16 dynamic library, your file will be <a href="http://valokuva.org/outside-blog-content/imagick-windows-builds/080709/php_imagick_dyn-Q16.dll">php_imagick_dyn-Q16.dll</a></p>
<p>If you are using <strong>PHP 5.3.x</strong>, <a href="http://valokuva.org/outside-blog-content/imagick-windows-builds/php53/">this is your location</a> to download.</p>
<h3>5 Find and Place the dll in your extension folder</h3>
<p>Rename the downloaded dll to <strong>php_imagick.dll</strong> for easy usage and place it under your extension folder. It is usually <code>php/ext/</code>. Go to <strong>Step 6</strong>.</p>
<p>If it is not, then you can find it in your php.ini file with the extension_dir param.<br />
<code>; Directory in which the loadable extensions (modules) reside.<br />
extension_dir = "Something something"</code></p>
<h3>6 Edit PHP.ini</h3>
<p>Uncomment if it exists or add if it doesnt exist this line<br />
<code>extension=php_imagick.dll</code></p>
<h3>7 Restart</h3>
<p>This is the important part, I spent good half an hour trying to make it work.. grrrr.. You need to restart your PC to libraries take effect.</p>
<p>If you do not restart and start your apache you will see an error like. So please do restart your PC.</p>
<blockquote><p>Unable to find CORE_RL_Wand.dll something something.</p></blockquote>
<h3>8 Start Apache and check</h3>
<p>Start your apache, and check with the <strong>phpinfo()</strong> , if you see imagick library and its values thats it you are set. go to <strong>step 9</strong>.</p>
<p>If not you have picked up the wrong dll file for PHP. Browse through the directory and try another dlls, if they dont work try to lower your ImageMagick installation version. Dont give up, it will work.</p>
<h3>9 Test with some code</h3>
<p>Put a nice big picture named <strong>a.jpg</strong> along side with your<strong> test.php</strong> script, run the test and check the directory to see <strong>a_thumnail.jpg</strong>. Here is the script, simple and fast <img src='http://www.elxsy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre class="brush:php">&lt;?
$im = new imagick( 'a.jpg' );
// resize by 200 width and keep the ratio
$im-&gt;thumbnailImage( 200, 0);
// write to disk
$im-&gt;writeImage( 'a_thumbnail.jpg' );
?&gt;</pre>
<h3>10 Manual, Learning and Playing Around</h3>
<p>To use it from php all you need is  <a href="http://uk3.php.net/imagick">PHP functions and manual</a> including some examples as well.</p>
<p>If you want to go further and mess around <a href="http://www.imagemagick.org/Usage/">here is the</a> command line ( exec() ) parameters, manuals and examples</p>
<h2>Finally</h2>
<p>So this is it, I hope you get it to work at the first trial now and drop a comment if you have any useful information or experience any error, we will try to help you out.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.elxsy.com/2009/07/installing-imagemagick-on-windows-and-using-with-php-imagick/feed/</wfw:commentRss>
		<slash:comments>65</slash:comments>
		</item>
		<item>
		<title>ImHuman WordPress Plugin 0.0.9 Test Run</title>
		<link>http://www.elxsy.com/2009/06/imhuman-wordpress-plugin-0-0-9-test-run/</link>
		<comments>http://www.elxsy.com/2009/06/imhuman-wordpress-plugin-0-0-9-test-run/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 20:49:36 +0000</pubDate>
		<dc:creator>cenOTapH</dc:creator>
				<category><![CDATA[ImHuman]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[captcha]]></category>
		<category><![CDATA[comment form]]></category>
		<category><![CDATA[humanizer]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[wp]]></category>
		<category><![CDATA[wptouch]]></category>

		<guid isPermaLink="false">http://www.elxsy.com/?p=238</guid>
		<description><![CDATA[Today with the feedback about empty forms and skipping the check for registered users, I have compiled a brand new version of the plugin as 0.0.9. This version is currently running under elxsy in order to test now. Please drop a comment to test it.  As usual functions with Mobile browsers and WPtouch seemlesly. Features: [...]

<div class="promote clear" style="background:#EDEDED"><h3>Related posts</h3><ol><li><a href='http://www.elxsy.com/2009/06/imhuman-multilanguage-and-new-wordpress-plugin/' rel='bookmark' title='ImHuman multilanguage and new wordpress plugin'>ImHuman multilanguage and new wordpress plugin</a></li>
<li><a href='http://www.elxsy.com/2009/07/imhuman-in-brazilian-portuguese/' rel='bookmark' title='ImHuman in Brazilian Portuguese'>ImHuman in Brazilian Portuguese</a></li>
<li><a href='http://www.elxsy.com/2009/07/imhuman-in-russian/' rel='bookmark' title='ImHuman in Russian'>ImHuman in Russian</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div id="attachment_241" class="wp-caption alignright" style="width: 130px"><a href="http://www.elxsy.com/wp-content/uploads/2009/06/IMG_0273.png"><img class="size-medium wp-image-241" title="IMG_0273" src="http://www.elxsy.com/wp-content/uploads/2009/06/IMG_0273-200x300.png" alt="IPhone Output" width="120" height="180" /></a><p class="wp-caption-text">IPhone Output</p></div>
<div id="attachment_242" class="wp-caption alignright" style="width: 130px"><a href="http://www.elxsy.com/wp-content/uploads/2009/06/IMG_0272.png"><img class="size-medium wp-image-242" title="IMG_0272" src="http://www.elxsy.com/wp-content/uploads/2009/06/IMG_0272-200x300.png" alt="IPhone Output" width="120" height="180" /></a><p class="wp-caption-text">IPhone Output</p></div>
<p>Today with the feedback about empty forms and skipping the check for registered users, I have compiled a brand new version of the plugin as 0.0.9. This version is currently running under elxsy in order to test now. Please drop a comment to test it.  As usual functions with Mobile browsers and WPtouch seemlesly.</p>
<h2>Features:</h2>
<ul>
<li>Complete AJAX comment posting and error reporting without any hack or modification to your current WP</li>
<li>Choice to skip the security check for registered members.</li>
<li>So Post contents will not be lost even wordpress fails to retrive them from cookies</li>
<li>Secure new set of humanizers for each fail as it should be in a secure form</li>
<li>Timeout support</li>
<li>Eliminates multiple posting</li>
</ul>


<div class="promote clear" style="background:#EDEDED"><h3>Related posts</h3><ol><li><a href='http://www.elxsy.com/2009/06/imhuman-multilanguage-and-new-wordpress-plugin/' rel='bookmark' title='ImHuman multilanguage and new wordpress plugin'>ImHuman multilanguage and new wordpress plugin</a></li>
<li><a href='http://www.elxsy.com/2009/07/imhuman-in-brazilian-portuguese/' rel='bookmark' title='ImHuman in Brazilian Portuguese'>ImHuman in Brazilian Portuguese</a></li>
<li><a href='http://www.elxsy.com/2009/07/imhuman-in-russian/' rel='bookmark' title='ImHuman in Russian'>ImHuman in Russian</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.elxsy.com/2009/06/imhuman-wordpress-plugin-0-0-9-test-run/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>ImHuman multilanguage and new wordpress plugin</title>
		<link>http://www.elxsy.com/2009/06/imhuman-multilanguage-and-new-wordpress-plugin/</link>
		<comments>http://www.elxsy.com/2009/06/imhuman-multilanguage-and-new-wordpress-plugin/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 20:18:48 +0000</pubDate>
		<dc:creator>cenOTapH</dc:creator>
				<category><![CDATA[ImHuman]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[captcha]]></category>
		<category><![CDATA[comment]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[french]]></category>
		<category><![CDATA[multilanguage]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress 2.8]]></category>

		<guid isPermaLink="false">http://www.elxsy.com/?p=231</guid>
		<description><![CDATA[While trying to overcome problems at SuperNo's blog which were mainly due to older PHP version, I had the chance to put the project into second gear thanks to SuperNo. ImHuman now speaks french ! all you need to do is to add lang=LANG_CODE Parameters in to your request string where LANG_CODE can be en [...]

<div class="promote clear" style="background:#EDEDED"><h3>Related posts</h3><ol><li><a href='http://www.elxsy.com/2009/06/imhuman-wordpress-plugin-0-0-9-test-run/' rel='bookmark' title='ImHuman WordPress Plugin 0.0.9 Test Run'>ImHuman WordPress Plugin 0.0.9 Test Run</a></li>
<li><a href='http://www.elxsy.com/2009/07/imhuman-in-russian/' rel='bookmark' title='ImHuman in Russian'>ImHuman in Russian</a></li>
<li><a href='http://www.elxsy.com/2009/07/imhuman-in-brazilian-portuguese/' rel='bookmark' title='ImHuman in Brazilian Portuguese'>ImHuman in Brazilian Portuguese</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>While trying to overcome problems at SuperNo's <a href="http://www.superno.com/blog">blog</a> which were mainly due to older PHP version, I had the chance to put the project into second gear thanks to <strong>SuperNo</strong>. ImHuman now speaks french <img src='http://www.elxsy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ! all you need to do is to add</p>
<pre>lang=LANG_CODE</pre>
<p>Parameters in to your request string where <code>LANG_CODE</code> can be <strong>en </strong>or <strong>fr</strong> for now. If you would like to see it in your own language contact me.</p>
<p>I am going to update the repository in couple minutes. New wordpress plugin features are:</p>
<ul>
<li>Requires PHP5, reduced in size.</li>
<li>works with AJAX, Jquery mandatory.</li>
<li>No more manual imhuman_render() insertion anymore</li>
<li>Supports Multilanguage (English and French only for now)</li>
<li>No more cache or back key problems if you guess the answer wrong and go back in your browser</li>
<li>You can customize your instruction message in your own language or format also</li>
</ul>


<div class="promote clear" style="background:#EDEDED"><h3>Related posts</h3><ol><li><a href='http://www.elxsy.com/2009/06/imhuman-wordpress-plugin-0-0-9-test-run/' rel='bookmark' title='ImHuman WordPress Plugin 0.0.9 Test Run'>ImHuman WordPress Plugin 0.0.9 Test Run</a></li>
<li><a href='http://www.elxsy.com/2009/07/imhuman-in-russian/' rel='bookmark' title='ImHuman in Russian'>ImHuman in Russian</a></li>
<li><a href='http://www.elxsy.com/2009/07/imhuman-in-brazilian-portuguese/' rel='bookmark' title='ImHuman in Brazilian Portuguese'>ImHuman in Brazilian Portuguese</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.elxsy.com/2009/06/imhuman-multilanguage-and-new-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to identify and ban bots-spiders-crawlers</title>
		<link>http://www.elxsy.com/2009/06/how-to-identify-and-ban-bots-spiders-crawlers/</link>
		<comments>http://www.elxsy.com/2009/06/how-to-identify-and-ban-bots-spiders-crawlers/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 19:05:02 +0000</pubDate>
		<dc:creator>cenOTapH</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[awstats]]></category>
		<category><![CDATA[ban]]></category>
		<category><![CDATA[bot]]></category>
		<category><![CDATA[bot-trap]]></category>
		<category><![CDATA[crawler]]></category>
		<category><![CDATA[identify]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[leecher]]></category>
		<category><![CDATA[robots]]></category>
		<category><![CDATA[robots.txt]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[spider]]></category>
		<category><![CDATA[trap]]></category>
		<category><![CDATA[visitor]]></category>

		<guid isPermaLink="false">http://www.elxsy.com/?p=158</guid>
		<description><![CDATA[This is a fast step tutorial. I will describe how to identify and get rid of web spiders/crawlers. Whats is a bot and what it does, how it functions etc all can be found here So you are trouble with robots, good or bad does not matter. They all leech away your bandwith and resources [...]

<div class="promote clear" style="background:#EDEDED"><h3>Related posts</h3><ol><li><a href='http://www.elxsy.com/2009/06/imhuman-wordpress-plugin-0-0-9-test-run/' rel='bookmark' title='ImHuman WordPress Plugin 0.0.9 Test Run'>ImHuman WordPress Plugin 0.0.9 Test Run</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This is a fast step tutorial. I will describe how to identify and get rid of web spiders/crawlers. Whats is a bot and what it does, how it functions etc all can be found <a href="http://www.robotstxt.org/orig.html">here</a> So you are trouble with robots, good or bad does not matter. They all leech away your bandwith and resources and just maybe do something for you in return. Even though they are not harvasting or spammer bots. This problem goes beyond bandwidth when you have like 100,000 dynamic pages under one server.  So how do we seperate them as good or bad?  <span id="more-158"></span></p>
<h2>First Intention:</h2>
<ol>
<li><strong>Good ones</strong>
<ol>
<li><strong>Intentionally good and result is efficient</strong>: Like google and yahoo. They scan your website and return visitors via search queries in exchange. They leech away your resources but give something in return.</li>
<li><strong>intentionally good but result is inefficient</strong> : Like cuil or yandex or other wanna look good but index selling companies.  Leeching your resources and nothing in return. This is the place where you want to decide, if a bot leeches away 5% of your bandwith and return 5 visitors in a month or none. You should list that one as bad also.</li>
</ol>
</li>
<li><strong>Bad ones</strong> : Ones that scans your website and links in order to harvest emails, content, links and weak security measures and sell them to other people, businesses and other sources. Leeching from your back in other words. They are all bad and should not be allowed to view your contents.</li>
</ol>
<h2>Second Identification and Obeying your Rules:</h2>
<ol>
<li><strong>Who identifies and obeys :</strong> Usually who identifies themselves as some robot or spider, they obey the robots.txt rules.  Sometimes they do not.</li>
<li>Who doesnt: Usually harmfull bots identify themselves as normal web users and they do not care about robots.txt</li>
</ol>
<h1>Method</h1>
<h2>1st Good and Obeying ones</h2>
<h3><span style="text-decoration: line-through;">Tag and ban bad ones</span></h3>
<p>This should be the old method. There used to be maybe 10 bots around the internet that can leech and scan important amounts due to low resources but now home-grown spiders are around everyday and minute with large resources. So specifying who is <strong>bad </strong>in a 95% bad ratio world is not smart.</p>
<h3>Tag and Allow only good ones</h3>
<p>This should be the appropriate solution for the problem now. Only allow good ones via robots.txt. In my case they are only big and useful search engines for me. Sample robots.txt that allows the ones with specified identification and disallows the rest.</p>
<pre class="brush:perl">User-agent: Googlebot
User-agent: Slurp
User-agent: msnbot
User-agent: Mediapartners-Google*
User-agent: Googlebot-Image
User-agent: Yahoo-MMCrawler
Disallow: 

User-agent: *
Disallow: /</pre>
<p>so we got rid of the intentionally good, or bad but useless and rule obeying ones. How to get rid of disobeying ones?</p>
<h2>2nd Bad and disobedient ones</h2>
<p>If you are using apache (and you should use apache!) you can ban them via user agent or user ip. So why are we banning via agent? They can use any IP adress and many bots have IP ranges like xx.xx.xx.10-100 but some of them gets a new IP adress whenever they want or as a backend crawler so you can miss them. User agent allows to get them whatever the IP is.</p>
<h3>Ban via user agent</h3>
<p>Create your .htaccess file or modify existing one and add the bots user agents with respecting values. Sample:</p>
<pre class="brush:perl">RewriteCond %{HTTP_USER_AGENT} .*Rapidmorebot.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Gigabot.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Yanga.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Baiduspider.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^AISearchBot.*
RewriteRule ^.* - [F]</pre>
<p>What we did is we told the apache web server that if any request's user agent parameter matches the given values, redirect them to an access denied page.</p>
<p><strong>.*etc*.</strong> shortly means, if includes the etc string in any position</p>
<p><strong>^etc.*</strong> means if it begins with etc and goes with anything</p>
<p><strong>[OR] </strong>means OR.  Note : If you leave the OR parameter, it will act as an AND and will not block any bots.</p>
<p>You can use regular expressions in Rewrite cond and rules. Search on the internet for more information. You can add or remove as many lines/bots as you desire</p>
<h3>Ban via IP address</h3>
<p>If they do not identify themselves or fake it, we are going to ban them via IP adresses.  You can specify single IP or IP ranges in them. Again create or modify your .htaccess. Insert your bot's IP into necessary fields and repeat them until you are all done.</p>
<pre class="brush:perl">order allow,deny
deny from 127.0.0.1 # only ban ip from #dddd
deny from 127.0.0.1/17 # ban through 1 to 17
allow from all # and allow the rest</pre>
<p>You can edit these settings from your hosting cpanel management also.</p>
<h1>Identifying Bots</h1>
<p>We are not bulletproof althout we only let selected good ones, ban the ones we caught. There will be always new bots and updates to existing ones that can make ur settings and rules become invalid. We need to be upto date also. So how do we identify them?</p>
<h2>1st General Knowledge</h2>
<p>Of course you are not the only one facing this problem. People started to make lists and publish them because these bots annoyed them too much and they wanna help other people like you also. So here is some databases of known bots/spiders. Note : These databases are not upto date and they do not include all spiders, just the generally known ones. You should try to catch your manually and then consult these dbs to check your result.</p>
<p><a href="http://www.robotstxt.org/db.html">http://www.robotstxt.org/db.html</a></p>
<p><a href="http://www.iplists.com/">http://www.iplists.com/</a></p>
<h2>2nd via Hosting logs | Some stats analyzer</h2>
<p>You can manually analyze your hosting logs, bandwith usage, pages to get most hit from singular ips or you can use an application like <strong>awstats</strong> or commercial solutions like weblogexpert to analyze your logs for you and create reports for you.</p>
<div id="attachment_159" class="wp-caption aligncenter" style="width: 610px"><a href="http://www.elxsy.com/wp-content/uploads/2009/06/h1.jpg"><img class="size-full wp-image-159" title="h1" src="http://www.elxsy.com/wp-content/uploads/2009/06/h1.jpg" alt="Awstats spider/bot list" width="600" height="172" /></a><p class="wp-caption-text">Awstats spider/bot list</p></div>
<p>Awstats identifies them by hits on robots.txt and user agent string. You can have the user agent but you are unprotected against unknown and IP values.</p>
<p>You can detect if any bots leeching on your website in easy analysis.</p>
<ol>
<li>Did "time spent on webpage" decreased suddenly? Bots get a page and exit, so they stay less then 2-3 seconds in your page. Humans will be able to load the page in this time only. So if these ratio goes higher it means you have a spider inside. You can track it down by finding request IPs with short "spent time" values.</li>
<li>Did hits on a pages  increased suddenly? In general rules, you will attract visitors slowly, your hits wont be 10 one day and 1000 other day if everything working ok. You have a spider inside.</li>
<li>Did your bandwith increased suddenly? You have a spider leeching on u.</li>
</ol>
<p>All these rules applies to awstats Hosts section, you can have their IP and their agents via spider db I gave previously. So lets analyze one of my Host sectiona and find bots manually via their IP. Lets analyze the IPs and area in red drawing.</p>
<div id="attachment_160" class="wp-caption aligncenter" style="width: 715px"><a href="http://www.elxsy.com/wp-content/uploads/2009/06/h2.jpg"><img class="size-full wp-image-160" title="h2" src="http://www.elxsy.com/wp-content/uploads/2009/06/h2.jpg" alt="h2" width="705" height="253" /></a><p class="wp-caption-text">Awstats Host section</p></div>
<ol>
<li>line is a bot or a service (dns, ping, etc) no way a human being can hit that many pages in one day and spend 20mb bandwith. We download a page with its all attachments (images, scripts, styles) like a size of 400kb in my condition (pages are huge). But bots only download the text content, so its relatively small compared to the original size (7-8Kb). (cache is not included because i know it is a dynamic image page )</li>
<li>line is definitely a bot and pretty bad one (<strong>zoozle.net you should ban it</strong>!) wasted 1.5gb in one day! I hope you see the importance of eliminating bots on your system health now!</li>
<li>and so on.. they are all spiders - services crawling - pinging  the website.</li>
</ol>
<h2>3rd Setup a Bot Trap</h2>
<p>Even your analyze can overlook some small but in time big trouble creator bots. What we can do is to setup a bot trap for them to fall in.  What we are going to do is to create a trap link which records visitors details. Publish that link on your website via invisible properties and then tell the good and obeying bots to not to go over forbidden zone. So whoever do not listen to what we say will be get tagged.  Method depends on if you want them in a database or in a logfile or via email.</p>
<p><strong>1st </strong>Create a weird link in your web site like www.example.com/this-is-trap-dont-click-it/index.php and add</p>
<p><strong>2nd</strong> contents of the .php file is</p>
<pre class="brush:php">$ip 		= $_SERVER['REMOTE_ADDR'];
$host		= $_SERVER['HTTP_HOST'];
$agent 		= $_SERVER['HTTP_USER_AGENT'];
$referer	= $_SERVER['HTTP_REFERER'];
$time		= date("d.m.Y H:i");
// mail, write in log file or insert into db depending on your choice</pre>
<p><strong>3rd </strong>Put in your footer a link to that weird link and make the link same color as background color, or put an 1X1 transparent gif into the link. ie</p>
<pre>&lt;!-- Trap for bots. Human visitors please do not visit this adress --&gt;
&lt;a href="this-is-trap-dont-click-it/index.php"&gt;&lt;img src="1_by_1pixel.gif" border="0"
alt="Please do not visit, its a trap for bots" width="1" height="1"/&gt;&lt;/a&gt;</pre>
<p><strong>4th</strong> add these lines to your robots.txt. Which will tell good and obedient bots not to follow the link and get in trouble.</p>
<pre class="brush:perl">User-agent: *
Disallow: /this-is-trap-dont-click-it</pre>
<p>So here our bot trap is set and finished finally. Analyze your trap logs and ban them via your criteries (leeching - new visitors ) and their behaviour.</p>
<p>Thats it, hope you enjoyed the post.</p>


<div class="promote clear" style="background:#EDEDED"><h3>Related posts</h3><ol><li><a href='http://www.elxsy.com/2009/06/imhuman-wordpress-plugin-0-0-9-test-run/' rel='bookmark' title='ImHuman WordPress Plugin 0.0.9 Test Run'>ImHuman WordPress Plugin 0.0.9 Test Run</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.elxsy.com/2009/06/how-to-identify-and-ban-bots-spiders-crawlers/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ImHuman &#8211; a Humanized &#8220;Are you human?&#8221; checker</title>
		<link>http://www.elxsy.com/2009/05/imhuman-humanized-security-and-spam-check/</link>
		<comments>http://www.elxsy.com/2009/05/imhuman-humanized-security-and-spam-check/#comments</comments>
		<pubDate>Thu, 28 May 2009 01:43:09 +0000</pubDate>
		<dc:creator>cenOTapH</dc:creator>
				<category><![CDATA[ImHuman]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[are you human]]></category>
		<category><![CDATA[captcha]]></category>
		<category><![CDATA[cracking]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[human]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[possibilities]]></category>
		<category><![CDATA[prevent spam]]></category>
		<category><![CDATA[recaptcha]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[ui]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.wp.c/?p=1</guid>
		<description><![CDATA[History The internet we know is nearly 10 years old. Before that, it was dark and static ages, where you put up an HTML website via editors and FTPs and wait for people to email you or mainly phone you about your website. With the new interactive web pages and database connections, we human beings [...]

<div class="promote clear" style="background:#EDEDED"><h3>Related posts</h3><ol><li><a href='http://www.elxsy.com/2009/06/imhuman-wordpress-plugin-0-0-9-test-run/' rel='bookmark' title='ImHuman WordPress Plugin 0.0.9 Test Run'>ImHuman WordPress Plugin 0.0.9 Test Run</a></li>
<li><a href='http://www.elxsy.com/2009/06/imhuman-multilanguage-and-new-wordpress-plugin/' rel='bookmark' title='ImHuman multilanguage and new wordpress plugin'>ImHuman multilanguage and new wordpress plugin</a></li>
<li><a href='http://www.elxsy.com/2009/07/imhuman-in-russian/' rel='bookmark' title='ImHuman in Russian'>ImHuman in Russian</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<h2>History</h2>
<p>The internet we know is nearly <a href="http://uk3.php.net/manual/en/history.php.php">10 years old</a>. Before that, it was dark and static ages, where you put up an HTML website via editors and FTPs and wait for people to email you or mainly <strong>phone you</strong> about your website.</p>
<p>With the new interactive web pages and database connections, we human beings were finally able to post our weird, funny, whatever comes to our mind ideas in to the world wide web via guest books, forums, comments and many many more you know of. But like every new innovation we made, we brought up problems with that also. We started to flood the entry forms in terms of fun, hacking, attacking, advertisement or digital harassment. And like this is not enough we have created applications to do the harassment for us faster and easier (attack launchers, flooder, spam bots). But hey, it was all 56K modem speed right, what was the harm in 1 spam per minute in once a week when couple geeks connects to the internet from SF to check some new chicks. PCs and their power were limited also, taking 4 minutes to power up and 2 minutes to load the internet browser. Well then we got cable modems, T1 lines, ADSL lines, fiber optics and satellite connections all for to download porn faster of course <img src='http://www.elxsy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Abuse to the top! With faster doubled, quadrant CPUs, RAMS bigger than your foot and with an internet population of 70% world population! Yeah baby now we are talking!</p>
<p><span id="more-1"></span>Well of course we came up with methods to prevent these abuse also, like auditing at first. We hired people and volunteered to monitor the content that's being posted. Then we developed banning, blocked attack routes, issued backup servers in the name of keeping porn 7/24 alive on the air. But thats not working because when we post something we want to see it on air immediately! That is why forums are so alive, people can see their comments and keep an eye on their posts. It simulates the normal human dialogue and conversation, where you get a response nearly for everything you send.</p>
<p>But in the audit you read an annoying argument about a discussion then u post your ideas too and as a human being you follow your nature and wait for a response on the web page. you  wait... wait then finally give up. God knows when the editor is free and enables your post. God knows when other poster returns to that website and reads your post and posts a reply and again wait for audit approval gives up. Months later you stumble that website again and remember "ohh shit yeah I posted some stuff here..". Then cycle begins in an irritating way over again or you just say.. "ahh the hell with it" and hit the X</p>
<p>Then some fellas said "hey you know what, computer programs can only read text. If we put an image with some confirmation in it, they cant read that, so they cant post.. hahah sweet. cool mann.. you rock!". Then we all started to put "<strong>C</strong>ompletely <strong>A</strong>utomated <strong>P</strong>ublic <strong>T</strong>uring test to tell <strong>C</strong>omputers and <strong>H</strong>umans <strong>A</strong>part" <a href="http://en.wikipedia.org/wiki/Captcha">CAPTCHA</a> s in our personal web pages. Like we are some bank or some government security department  faces abusive attacks everyday. Anyhow everything was going smooth until...</p>
<p>The  other side came along ( like all natures' bad fellas = which is usually the smarter, more skilled and better know how equipped ) and said "Dude! I got news for ya. computers can read images also if you teach them how, Pwned!". So the epic battle between good and evil began and like all battles, public ( we the internet users )  is the only victim.</p>
<p>So instead thinking of more innovative or humanly ways, good guys just said ok then I am going to fold, trash, noise, distort the image and lets see you teach the computer to read that. This is where we are now. In reality nobody tries to spam out 85% of the websites or abuse their entries but still people go crazy about who will be the winner of creating the most ugliest, human enemy, pain in the ass CAPTCHAs ever!</p>
<h2>CAPTCHAs</h2>
<p>Lets just not all talk, here is some examples I picked up tonight in 2 minutes at my very first trials. I did not intentionally tried on getting them this ugly. One of the best ones out there is reCAPTCHA itself, which supports a good cause but still ...</p>
<div id="attachment_130" class="wp-caption aligncenter" style="width: 332px"><img class="size-full wp-image-130" title="reCaptcha" src="http://www.elxsy.com/wp-content/uploads/2009/06/c1.jpg" alt="reCaptcha" width="322" height="134" /><p class="wp-caption-text">reCaptcha</p></div>
<p>call me blind but I want to ask you even in my 1024px resolution, what the hell is this? Is that a <strong>G or C or  A or S?</strong></p>
<div id="attachment_125" class="wp-caption aligncenter" style="width: 310px"><img class="size-full wp-image-125" title="EyeStraing captchas" src="http://www.elxsy.com/wp-content/uploads/2009/06/c4.jpg" alt="EyeStraing captchas" width="300" height="334" /><p class="wp-caption-text">EyeStraing captchas</p></div>
<p>One of the best examples shown in <a href="http://www.johnmwillis.com/other/top-10-worst-captchas/">Top 10 worst captcha ever</a></p>
<p>The one I have failed to capture but thanks to this guy he didn't fail. Rapidshare is one of the most used file sharing services and look at the result <a href="http://depressedprogrammer.wordpress.com/2008/04/20/worst-captcha-ever/">worst captcha ever</a>. I failed to capture Megaupload's recent captcha, after all the complaints they changed it to a semi better one now. And yet one more <a href="http://blog.mikezhang.com/2008/03/17/worst-captcha">worst ever</a> with a funny comment at the end <img src='http://www.elxsy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Problems</h2>
<p>If we return to the subject, one day my friend asked me for help on msn and I said sure. She said she couldnt register for a Google Mail account I was like "pfftt, women" and told her I can open her a new one and give it to her. Well, after my 50th effort maybe to match the characters to the image (although they match 30 times) I have managed to open one with tons of frustration. No need to provide them, whenever you want to check you can see it in the "Innovative Google" register page but here is two shots I have.</p>
<div id="attachment_132" class="wp-caption aligncenter" style="width: 461px"><img class="size-full wp-image-132" title="Google captcha 1" src="http://www.elxsy.com/wp-content/uploads/2009/06/c3.jpg" alt="Google captcha 1" width="451" height="129" /><p class="wp-caption-text">Google captcha 1 </p></div>
<div id="attachment_131" class="wp-caption aligncenter" style="width: 521px"><img class="size-full wp-image-131" title="Google captcha 2" src="http://www.elxsy.com/wp-content/uploads/2009/06/c2.jpg" alt="Google captcha 2" width="511" height="184" /><p class="wp-caption-text">Google captcha 2</p></div>
<p>AND there is a <strong>disabled</strong> icon near the input area like mocking us! Well I think you are the real <strong>disabled one</strong> dear, by creating that block of code and still keeping it on the most "Innovative" Company's website. So this was kinda my first strike.</p>
<p>And the most interesting part is that, this method is efficient hmm maybe yes, secure maybe yes, but does it overcomes the existing problem? definitely NOOO! You remember what happened right, good guys put image, bad guys read the image so good guys now putting retardly distorted images. I guess you understand what I am trying to say. <strong>Plus</strong>, it created another problem! Readability and user friendly level of a captcha image! We are doing something wrong here.. . very wrong..</p>
<p>So are they secure, well in a way. They are random letters put together in an image instead of outputting as text, and to prevent them being read by a computer again, they are distorted. Now this is the question in your mind, "Cant computers read the letters in distorted images ?" Yes they can! They can read whatever you teach them to read. They had cracked lots of easy, mid level captchas and read through them like butter. With computer vision techniques and some several day wasting on matlab and methodology trials you can crack them too depending on your CV skills and distortion of the image. Plus if no randomness or hash methods included in the generation of an captcha, you can always go back from result (distorted image) to the source (original clean letters ready to serve as butter for OCR). It is mathematics, 2 + 2 = 4, 4 = x + x, not very hard to find X right?</p>
<p>How about brute forcing? Well they are perfect for eliminating them because of their combination  size.Back to 8th grade mathematics, <a href="http://en.wikipedia.org/wiki/Permutation">Permutations</a>. If you use english alphabet as the sample array ( which has 26 letters ) and print 3 random letters in the captcha for the user to enter, with not any of them being unique, the probability of input strings: You need to select among 26 letters for first letter, therefore you have 26 choices. Then for the second one you have 26 also and so on..Meaning an attacker (may) need to try 26 ^ 3 = 26.26.26 = <strong>17576</strong> different strings to find the exact code. (Well I said may because you can find it at first trial or last trial, it is unlikely but anything can happen in the limits of probability)</p>
<h2>Getting started with the Idea</h2>
<p>Well my second strike was my own fault at my own captcha system. I typed  nearly 1 page long reply to a comment on one of my websites then entered 3 image letters and bam! wrong image characters. I read the letters in the image correct BUT while I was typing them to the entry I made a typo and all the post contents are gone.. puff.. I know it is my fault but it wasn't the first time while I tried to read the letters and type in the boxes and made typos. Specially in 6-10 letter captchas like Google's you spend an important time on to read and type, if you don't check the letters you wrote in the input you are prone to errors and it can be very frustrating. So I said that's it, time to go for another methodology for my own and visitors sake.</p>
<h3>Challange  is to provide some sort of "are you a human" check that does not irritates humans while eliminating bots correctly.</h3>
<p>What irritates myself while using normal captchas ?</p>
<ul>
<li>Trying to read  retardish crooked and distorted images while having a brain fry!</li>
<li>Yet to see that I have failed to read the image!</li>
<li>Having to type all those random letters and numbers and upper - lower case stuff and have finger cramps!</li>
<li>Double check the stupid image to see if I made a typo and have a double brain fry from reading and checking this time</li>
<li>Copy my every post before posting in any case stupid captcha fails</li>
</ul>
<p>What satisfies a human lazy bum like me?</p>
<ul>
<li>Just leave a tick says "I m human dammit! cant you see me?" before clicking the button and it should check itself when it sees me!</li>
</ul>
<h3>So the resulting check should be</h3>
<ul>
<li>User and eye friendly</li>
<li> Less or minimum input required</li>
<li>Completely eliminating human error from  check procedure</li>
<li>Easy and fun to use</li>
</ul>
<p>I could use audio, flash and images again to check against the epic "are you human" control. Then I remembered the audio checks I have tried on Google and recaptcha, I didn't understand a WORD! Never trusted flash also.</p>
<p>Best kind of checks I like are the ones that asks  you 2 + 3 = ? or some simple mathematical operations but they are so easy to hunt with bots. I could use it inside an image but as a user thinking "after all the typing finished and I took control of the mouse and I am ready to click away ! please don't interrupt me". so I sailed away from that..</p>
<p>There are some academic works about captcha also, one includes rotating images to correct degree by a slider other one is usual captcha divided by clickable zones for mobile browsers. Rotating image is a good one and degree of angle is 360 possibilities also but arranging an image with a slider to nearly perfect degree sounds annoying to me. And that slider should be cross browser JavaScript supported one more headache because there are people out there still using Internet Explorer! Please be aware of them. And it is not hard to tell the rotation degree of an image as a computer program once u have the image and manually set it to 0 degrees.</p>
<p>I remembered once in a while like 2 years ago I stumbled on an project like page and read about some cutekittens protection method. ( I searched it all over the internet, again and now again to provide links and credits to the website, but no results :/ ). It was just an idea talking about if it is possible to make people type how many kitties are shown in the image to pass the captcha test, instead of making them read distorted letters.</p>
<p>I said, hell I got better idea, lets make them select the cats against dogs in a visual way so u just type your post and click on the cats and ready to go. Methodology is simple, <strong>In order to confuse a cat with a dog you must be mentally challenged or a spam bot</strong>. Two types of visitor comments which I don't want to see in any of my websites.</p>
<h2>First Prototype</h2>
<p>So I gathered around 100 80 * 80 cat pictures manually, and 200 80 * 80 dog pictures, Named and clustered them nicely then coded my Class to construct a X x Y grid of randomly selected <strong>Given</strong> number of cats from randomly selected <strong>grid - given</strong> number of dogs, positioned  and stitched randomly all together in one (X * 80) X ( Y * 80 ) captcha image. Of course the answer were recorded before last randomization.</p>
<p>Image was dynamically created on the visitor's session and assigned as  the background of a big DIV tag. Bıg div contents were again DIVs which are divided by grid's dimension, with transparent backgrounds to click and select the imaginary cells. Assigned with custom CSS rules and a simple JavaScript, it was selecting images ( DIV borders in reality ) and highlighting selection, then writing the selection combination to the hidden variables of course to check on the evaluation part.</p>
<h2>First Feedback</h2>
<p>I put the script on folderland.com and all member websites of it. (I had to passivize the script for now due to server overload from another website)</p>
<p>First, I did not receive any complaints about "I can not post comment, arghh my whole comment is gone" which I usually have due to human error and you can check my current ImHuman replacement captcha there, it is pretty big and readable for everyone. But as I said, we are human we make errors and blame the machine.</p>
<p>Secondly all the member websites had a boost of 26% comment rate increase. People were intrigued about the <strong>thing</strong> and wanted to comment to see how it functions <img src='http://www.elxsy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I have faced several comments where people thanked the author for the "<strong>puzzle</strong>" provided and how cute and easy it is <img src='http://www.elxsy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  And my mobile browser tests all functioned correctly also.</p>
<p>Lastly, well this is kinda only to my favor: I had cuilbots and lots of useless bots which even I ban them through IPs or user agent they kept crawling the websites, leeching my bandwidth and clicking on every link, filling on forms etc.. because they do not produce click events on JavaScript, they could not send out empty or spam filled forms.</p>
<h2>Changing to a global API</h2>
<p>I was happy with the new system so I have decided to implement it to my other website at that point I realized I have to duplicate 300+ files of database for just one website (Well I am lazy and thought it unorganized for the first time) then I have updated the new website with extra 100+ manual entries of images and realized I didn't do the same for first one. The time I said well it is the last anyway no more update, my friend told me that he wants to use the system on his 2 website too.</p>
<p>So I decided to write an API and assign a domain for its usage for us and then other  request of an other friend made me realize, who is going to update the entries manually? It is really irritating to search and find images, cut, trim to exact shape and upload them via [place doesn't matter]. Whose server is going to handle all the heavy duty image operations? and plus all the bandwidth required to serve them through all the websites and 100K visits a day through 4+ websites with image size of 30KB per image and of course images are not cached. Well you do the math, it is a number I didn't want to put my hosting package under it.</p>
<h2>Using the power of Flickr</h2>
<p>While I was thinking on how to overcome these and checking the documentation of a class on the internet, I saw the authors flickr images on the right of his website and I found the answer. Images were pre sized, Flickr would do the hosting them and mostly importantly they were already pre-tagged [categorized] by their uploaders ! It was the perfect solution for our problem and after I prepared the API and its management and humanizer management it was working like a charm.</p>
<p>So did the flickr did all good to the project? well no, it reduced our security ratio. Because I used to stich images on the fly to a random generated image but flickr is showing images one by one, enabling people to see its path/source. So lets see the security disadvantage of flickr.</p>
<h2>How about security</h2>
<p>Like everything well ImHuman is crackable too, nothing is bulletproof in this world. I believe the key is to create such  big of a job and vast probability, so people  simply will not even think to try. I am not going to explain how to hack or exploit ImHuman of course but using manual classification it can be done. That is the weakness flickr puts into our chain, by showing image sources 1 by 1, it helps the manual identification. Manual classification of flickr images, that's a <strong>time saver</strong> for you <img src='http://www.elxsy.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  and if you are still thinking about doing it, well here is a <strong>hair saver</strong> for you. I do not play it fair also, there is <strong>no golden ratio</strong> in APIs randomness. There is no destiny in the API its all part of a big plan (LOST reference)</p>
<p>Adding Humanizers are pretty pretty easy. I have added 730 humanizers to the API while having my coffee. Considering at least 10 people will add 50 in lets say 10 minutes in a day.. with the lowest grow, our sample goes to HUGE.</p>
<p>Can computer vision techniques be used to classify our images and tags? Yes they can but in 20 years maybe. CV fails catastrophically when it comes to classification. Because they don't have active neurons ( ha ha ) in their CPUs we cant teach them learning from experience in parallel computing to classify vast range of information like we do.</p>
<p>Brute force, again back to 8th grade mathematics again with <a href="http://en.wikipedia.org/wiki/Permutation">Permutations</a> with the <a href="http://www.mathsisfun.com/combinatorics/combinations-permutations.html">mathisfun</a> for who forgot the old tricks. The magic formula is <strong>n! / r!(n-r)!</strong> where n is how many humanizer you want and r is how many to select. In simple words, if you want 5 humanizer and 3 to select. For first one 5 possibilities to chose from * second one this time 4 left to chose from * third time only 3 left to chose from = 60 possibilities but we dont care for the order so 1/3! and possibility goes to <strong>10</strong>.</p>
<p>It is not  tough because of its <strong>selection</strong> property but I and most developers usually block the access to a commentator with 3  consecutive fails. Means you are not a human, you are a bot just trying to spam. Furthermore, humanizer possibilities are renewed everytime you fail, meaning brand new 10 to chose from if you go with that sample size.</p>
<p>I have prepared a table for the grid, selection values and possibilities to chose from that can help you choose your level. My concern is - which I said  blocking after 3 consecutive fails and brand new set at every fail - is the display area and its size that's why I use 5 * 1 grid with 3 selection. Easy, user friendly and simple.</p>
<table class="dttb" border="0" width="200">
<tbody>
<tr>
<th>GRID</th>
<th>SELECTION</th>
<th>POSSIBILITIES</th>
</tr>
<tr>
<td>5</td>
<td>2-3</td>
<td>10</td>
</tr>
<tr>
<td>6</td>
<td>2-4</td>
<td>15</td>
</tr>
<tr>
<td>6</td>
<td>3</td>
<td>20</td>
</tr>
<tr>
<td>7</td>
<td>3-4</td>
<td>35</td>
</tr>
<tr>
<td>8</td>
<td>4</td>
<td>70</td>
</tr>
<tr>
<td>9</td>
<td>4-5</td>
<td>126</td>
</tr>
<tr>
<td>25</td>
<td>12-13</td>
<td>5200300</td>
</tr>
</tbody>
</table>
<h3>But! not easy to force by possibility</h3>
<p>In order to spam, auto complete or attack a form and its return values you need to know what form posts as parameters. Lets explain it with example, in a normal comment form you have COMMENT_PARENT_ID, NAME, COMMENT.  You can spam the pages by posting these values via software or automated methods. (well I guess lots of people know about this already so I wont feel bad to explain how spamming works). Anyhow with normal captcha, you would put an extra field like CATPCHA and its value should match the string shown on the image.</p>
<p>Although your bot doesn't know the captcha value, or didn't use any OCR methods to read its value, if captcha its a low string and not designed properly (like refreshing, session tracking, auto clear, one time entry) you can still brute force that form with known values and SUCCEED.</p>
<p>Now why ImHuman not easy to force? Well it is because we produce a 6 character hashed unique random <strong>name</strong> identifier for each of the images we provided and 12 character hashed unique random <strong>value</strong> for each of them. Meaning, 1st step: even the entry names are a security check, you can not post a form with same values twice, it is impossible! Without even checking values or anything, we just look what came to our doormat and if its not what we expected, we don't even get up from the couch. If the package properties are correct, then we check if the information inside is correct.</p>
<p>Even when you use AJAX based methods to check and submit forms, you should regenerate a new CAPTCHA (doesn't matter ImHuman or any other captcha, its a global security method and necessity) at EVERY FAILED check. That just climbs your "force by possibility" possibility to impussible. So after the tip here is two runs for the post values from WordPress Plugin of ImHuman. ImHuman generated values are shown in <strong>BOLD.</strong> These are two separate comment posting, as you can see, if three is no ImHuman on the system, all the parameters are known and stays there for good, thus ready to spam.</p>
<table class="dttb" border="1" width="100%">
<tbody>
<tr>
<th width="52%">Wrong Answer Given with 4 selections</th>
<th width="48%">Correct Answer Given with 3 selections</th>
</tr>
<tr>
<td>
<table class="dttb" border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<th>Param</th>
<th>Value</th>
</tr>
<tr>
<td><strong>2c83a5</strong></td>
<td><strong>9c3901aa1901</strong></td>
</tr>
<tr>
<td><strong>3dcc1b</strong></td>
<td><strong>73b60b45135c</strong></td>
</tr>
<tr>
<td><strong>53990c</strong></td>
<td><strong>439613e3a47b</strong></td>
</tr>
<tr>
<td>_wp_unfiltered_html_comment</td>
<td>f151b1ce0c</td>
</tr>
<tr>
<td>comment</td>
<td>abcdef</td>
</tr>
<tr>
<td>comment_parent</td>
<td>0</td>
</tr>
<tr>
<td>comment_post_ID</td>
<td>37</td>
</tr>
<tr>
<td><strong>e4ab72</strong></td>
<td><strong>b513ffbedc9d</strong></td>
</tr>
<tr>
<td>submit</td>
<td>Submit</td>
</tr>
</tbody>
</table>
</td>
<td valign="top">
<table class="dttb" border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<th>Param</th>
<th>Value</th>
</tr>
<tr>
<td><strong>1461e6</strong></td>
<td><strong>b216694abc3c</strong></td>
</tr>
<tr>
<td><strong>511ebf</strong></td>
<td><strong>4eaf0d6e9aa0</strong></td>
</tr>
<tr>
<td><strong>991384</strong></td>
<td><strong>60b7fa17aeaa</strong></td>
</tr>
<tr>
<td>_wp_unfiltered_html_comment</td>
<td>f151b1ce0c</td>
</tr>
<tr>
<td>comment</td>
<td>jklmno</td>
</tr>
<tr>
<td>comment_parent</td>
<td>0</td>
</tr>
<tr>
<td>comment_post_ID</td>
<td>37</td>
</tr>
<tr>
<td>submit</td>
<td>Submit</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h2>Can we increase the possibilities and make it helishly secure?</h2>
<p>Sure:</p>
<ul>
<li>Visitor will enter the number shown in the picures into the box below</li>
<li>Visitor will click on the correct humanizers from left - to right or rigt to left in order</li>
<li>we can ask visitors to order animals, objects by size by dragging around</li>
<li>or compare objects in order or re categorize them</li>
<li>or  like banks, we can ask them to enter <strong>"First letter of third image, the last second letter of second image from right, forth letter of first image"</strong></li>
</ul>
<p>and make your visitor <strong>regret</strong> his/her choice of posting some information on your website. Our main point was to create a user friendly,  less input required, eliminating human error from  check procedure, easy and fun to use security check not a torture in <strong>hellnet</strong>.</p>
<h2>Demo</h2>
<p>Well you can see the active API running right at the bottom, in the comments section.</p>
<h2>Download</h2>
<p><a href="http://www.elxsy.com/wp-content/uploads/2009/06/imhuman-php-class.zip">imhuman-php-class</a> Sample ImHuman PHP - Class implementation</p>
<p><span style="text-decoration: line-through;">ImHuman WordPress Plugin (0.0.6)</span></p>
<p><a href="http://wordpress.org/extend/plugins/imhuman-a-humanized-captcha/">ImHuman WordPress Plugin (0.0.7) from wordpress.org plugins page</a> (16.06.2009)<span style="text-decoration: line-through;"><br />
</span></p>
<p><em>Problem with WordPress is, lots of people using it with different versions and plugins and preferences and its limited playground. Some want JavaScript and fancy options while some doesn't want JavaScript in order to use from mobile devices etc.  This leads to a poorly cache handling. Well I guess it is going to take votings and feedbacks then 1-2 versions of the plugin to satisfy <strong>most </strong>of the people.</em></p>
<h2>Support</h2>
<p>Support for the project will be given throughout its documentation, FAQ and API pages.</p>
<p>There are implemented versions of its API already in the downloads section.</p>
<h2>If you liked the project and want to support it</h2>
<p>You can support the project in several ways</p>
<ol>
<li>Use the ImHuman Project in your website and give us a link, feedback</li>
<li>Spread the word, link to us, put up our banners in your website, publish posts about it, ping us, tell your friends etc..</li>
<li>Go to control panel and add some fun humanizers in your free time!</li>
<li>Help us translate the ImHuman into your language</li>
<li>Write your own code of clients, prettifies and selection scripts and share with people</li>
<li>If you have couple bucks to spare for the growing hosting expenses then make a donation<br />
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="5830691" />
<input style="width: 92px;" alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" type="image" /> <img src="https://www.paypal.com/en_GB/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /><br />
</form>
</li>
</ol>


<div class="promote clear" style="background:#EDEDED"><h3>Related posts</h3><ol><li><a href='http://www.elxsy.com/2009/06/imhuman-wordpress-plugin-0-0-9-test-run/' rel='bookmark' title='ImHuman WordPress Plugin 0.0.9 Test Run'>ImHuman WordPress Plugin 0.0.9 Test Run</a></li>
<li><a href='http://www.elxsy.com/2009/06/imhuman-multilanguage-and-new-wordpress-plugin/' rel='bookmark' title='ImHuman multilanguage and new wordpress plugin'>ImHuman multilanguage and new wordpress plugin</a></li>
<li><a href='http://www.elxsy.com/2009/07/imhuman-in-russian/' rel='bookmark' title='ImHuman in Russian'>ImHuman in Russian</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.elxsy.com/2009/05/imhuman-humanized-security-and-spam-check/feed/</wfw:commentRss>
		<slash:comments>57</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
