<?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>klauskjeldsen.dk &#187; CSS</title> <atom:link href="http://klauskjeldsen.dk/tag/css/feed/" rel="self" type="application/rss+xml" /><link>http://klauskjeldsen.dk</link> <description>About web... &#38; stuff</description> <lastBuildDate>Sat, 14 Jan 2012 20:22:42 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Avoid HTML form spam using CSS</title><link>http://klauskjeldsen.dk/avoid-html-form-spam-using-css/</link> <comments>http://klauskjeldsen.dk/avoid-html-form-spam-using-css/#comments</comments> <pubDate>Thu, 19 Jul 2007 08:43:40 +0000</pubDate> <dc:creator>Klaus Kjeldsen</dc:creator> <category><![CDATA[Web Development]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[HTML]]></category> <category><![CDATA[Spam]]></category><guid
isPermaLink="false">http://klauskjeldsen.dk/2007/07/19/avoid-html-form-spam-using-css/</guid> <description><![CDATA[An approach of avoiding HTML form spam is using CSS. Non-human spammers usually fills out every input field in a form and submit it, and to overcome this kind of spam you must be able to differ between real human &#8230; <a
href="http://klauskjeldsen.dk/avoid-html-form-spam-using-css/">Continue reading <span
class="meta-nav">&#8594;</span></a><div
class="addthis_toolbox addthis_default_style " addthis:url='http://klauskjeldsen.dk/avoid-html-form-spam-using-css/' addthis:title='Avoid HTML form spam using CSS '  ><a
class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a
class="addthis_button_tweet"></a><a
class="addthis_counter addthis_pill_style"></a></div> Related posts:<ol><li><a
href='http://klauskjeldsen.dk/typo3-making-a-xhtml-valid-menu/' rel='bookmark' title='TYPO3: Making a simple menu as an unordered list in XHTML'>TYPO3: Making a simple menu as an unordered list in XHTML</a></li></ol>]]></description> <content:encoded><![CDATA[<p>An approach of avoiding HTML form spam is using CSS. Non-human spammers usually fills out every input field in a form and submit it, and to overcome this kind of spam you must be able to differ between real human form  submits and non-human spam. A technique to distinguish between non-spam and spam is using CSS; the basic idea is to make an extra dummy input text field in your form, and using CSS to make it invisible to the real human users. Thereby, if a post is sent to your php script handling the request and this extra text field contains information, you know that the submit must be spam, and the script can ignore the post.</p><p>Here is a small example form:</p><pre name="code" class="html">
<form action="requesthandler.php" method="post">
<fieldset><label for="name">Name:</label>
<input id="name" type="text" />

<label for="comment">Comment:</label>
<input id="comment" type="text" />
<input id="human" type="text" />
<input type="submit" value="Send" /></fieldset>
</form>
</pre><p>The <em>human</em> text field is used for detecting spam, you might call it something else than &#8220;human&#8221;, however this should be hidden by using CSS such that it is not visible for the user on the webpage. This can be achieved add the following to your CSS file:</p><pre name="code" class="css">
#human {
visibility:hidden;
display:none;
}
</pre><p>The solution is as you see very to implement and proves to be effective.</p><p><strong>Additional notes:</strong></p><p>Using JavaScript to hide the dummy input text field is also an option. E.g. using a JavaScript Framework like <a
href="http://prototypejs.org/">Prototype.js</a> it can be done with one line of code:</p><pre name="code" class="js">
$('human').hide();
</pre><p>More information on <a
href="http://prototypejs.org/api/element/hide">hiding elements using prototype.js</a>.</p><p></p><div
class="addthis_toolbox addthis_default_style " addthis:url='http://klauskjeldsen.dk/avoid-html-form-spam-using-css/' addthis:title='Avoid HTML form spam using CSS '  ><a
class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a
class="addthis_button_tweet"></a><a
class="addthis_counter addthis_pill_style"></a></div><p>Related posts:<ol><li><a
href='http://klauskjeldsen.dk/typo3-making-a-xhtml-valid-menu/' rel='bookmark' title='TYPO3: Making a simple menu as an unordered list in XHTML'>TYPO3: Making a simple menu as an unordered list in XHTML</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://klauskjeldsen.dk/avoid-html-form-spam-using-css/feed/</wfw:commentRss> <slash:comments>47</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: basic (User agent is rejected)
Database Caching 8/57 queries in 0.037 seconds using disk: basic
Content Delivery Network via N/A

Served from: klauskjeldsen.dk @ 2012-02-04 03:31:32 -->
