<?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>Ardamis &#187; blogging</title>
	<atom:link href="http://www.ardamis.com/tag/blogging/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ardamis.com</link>
	<description>Ardamis is a blog about web development and technology in general.</description>
	<lastBuildDate>Thu, 02 Feb 2012 07:07:02 +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>Ardamis in 2012 &#8211; new look, more microdata, faster code</title>
		<link>http://www.ardamis.com/2012/01/22/ardamis-2012/</link>
		<comments>http://www.ardamis.com/2012/01/22/ardamis-2012/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 05:50:02 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[comment spam]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=1863</guid>
		<description><![CDATA[Ardamis.com is starting out 2012 with a new look, better structured data markup, and a revamped anti-spam system.]]></description>
			<content:encoded><![CDATA[<p>Just a few weeks behind schedule, but a long time in the works, I&#8217;ve finally pushed the new WordPress theme for Ardamis live.  Basic and elegant (I&#8217;m trying to establish a trend here), the theme also should outperform its predecessors in both page load times and SEO-potential.  The index and archive pages should appear more consistent, and all pages should provide more complete structured data markup (<a href="http://schema.org/">schema.org</a> as well as <a href="http://microformats.org/wiki/existing-classes">microformats.org</a>).  The comment form has been outfitted with <a href="http://www.ardamis.com/2011/08/27/a-cache-proof-method-for-reducing-comment-spam/">an improved approach to reducing comment spam</a>.</p>
<p>The new theme is pretty light on the graphics, due to increased browser support for and subsequently greater use of CSS3 goodness for box shadows and gradients.  I&#8217;ve reduced the number of image files to two: a background and a sprites file.</p>
<p>Only half-implemented in the previous theme, the new look, &#8220;Joy&#8221;, makes much better use of structured data markup, or <a href="http://en.wikipedia.org/wiki/Microdata_(HTML)">microdata</a>.  Google is absolutely looking for ways to display your pages&#8217; semantic markup in its results, so you may as well get on board.</p>
<p>The frequency of spam comments increased dramatically over the past two months, according to my Akismet stats, so I&#8217;ve gone back to the drawing board and developed a better front-line defense against them.  The new method should be more opaque to bots that parse JavaScript while still being invisible to human visitors leaving legitimate comments.</p>
<p>In sum, I think Ardamis should be leaner, faster, and smarter (and maybe prettier) in 2012 than ever before.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2012/01/22/ardamis-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A cache-friendly method for reducing WordPress comment spam</title>
		<link>http://www.ardamis.com/2011/08/27/a-cache-proof-method-for-reducing-comment-spam/</link>
		<comments>http://www.ardamis.com/2011/08/27/a-cache-proof-method-for-reducing-comment-spam/#comments</comments>
		<pubDate>Sat, 27 Aug 2011 08:34:53 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Nonsense]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[comment spam]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[web app]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=1673</guid>
		<description><![CDATA[A safe-for-cached-pages method of filtering out spam comments by requiring at least some time to have passed between the time the page is loaded and the form is submitted.]]></description>
			<content:encoded><![CDATA[<p>In the endless battle against WordPress comment spam, I&#8217;ve developed and then refined a few different methods for preventing spam from getting to the database to begin with.  My philosophy has always been that a human visitor and a spam bot behave differently (after all, we&#8217;re not dealing with <a href="http://en.wikipedia.org/wiki/Do_Androids_Dream_of_Electric_Sheep%3F#Androids">Nexus-6 model androids</a> here), and an effective spam-prevention method should be able to recognize the differences.  I also have a dislike for CAPTCHA methods that require a human visitor to <em>prove</em>, via an intentionally difficult test, that they aren&#8217;t a bot.  The ideal method, I feel, would be invisible to a human visitor, but still accurately identify comments submitted by bots.</p>
<h2>A history of spam fighting</h2>
<p>The most successful and simple method I found was a server-side system for <a href="http://www.ardamis.com/2007/12/15/using-timestamps-to-reduce-wordpress-comment-spam/">reducing comment spam by using a handshake method involving timestamps</a> on hidden form fields.  The general idea was that a bot would submit a comment more quickly than a human visitor, so if the comment was submitted too soon after the page was loaded, it was rejected.  A human caught in this trap would be able to click the Back button on the browser to resubmit.  This had proven to be very effective on ardamis.com, cutting the number of <a href="http://www.ardamis.com/2010/08/09/reducing-wordpress-spam-comments/">spam comments intercepted by Akismet per day to nearly zero</a>.  For a long time, the only problem was that it required modifying a core WordPress file, <strong>wp-comments-post.php</strong>.  Each time WordPress was updated, the core file was replaced.  If I didn&#8217;t then go back and make my modifications again, <a href="http://www.ardamis.com/2011/01/18/a-chart-illustrating-the-reduction-in-comment-spam-at-ardamis-com/">I would lose the spam protection</a> until I made the changes.  As it became easier to update WordPress (via the admin panel) and I updated it more frequently, editing the core file became more of a nuisance.</p>
<h2>A huge facepalm</h2>
<p>When Google began weighting page load times as part of its ranking algorithm, I implemented the <a href="http://wordpress.org/extend/plugins/wp-super-cache/" title="WP Super Cache">WP Super Cache</a> caching plugin on ardamis.com and configured it to use .htaccess and mod_rewrite to serve cache files.  Page load times certainly decreased, but the amount of spam detected by Akismet increased.  After a while, I realized that this was because the spam bots were submitting comments from static, cached pages, and the timestamps on those pages, which had been generated server-side with PHP, were already minutes old when the page was requested.  The form processing script, which normally rejects comments that are submitted too quickly to be written by a human visitor, happily accepted the timestamps.  Even worse, a second function of my anti-spam method also rejected comments that were submitted 10 minutes or more after the page was loaded.  Of course, most of the visitors were being served cached pages that were already more than 10 minutes old, so even legitimate comments were being rejected.  Using PHP to generate my timestamps obviously was not going to work if I wanted to keep serving cached pages.</p>
<h2>JavaScript to the rescue</h2>
<p>Generating real-time timestamps on cached pages requires JavaScript.  But instead of a reliable server clock setting the timestamp, the time is coming from the visitor&#8217;s system, which can&#8217;t be trusted to be accurate.  Merely changing the comment form to use JavaScript to generate the first timestamp wouldn&#8217;t work, because verifying a timestamp generated on the client-side against one generated with a server-side language would be disastrous.</p>
<p>Replacing the PHP-generated timestamps with JavaScript-generated timestamps would require substantial changes to the system.</p>
<p>Traditional client-side form validation using JavaScript happens when the form is submitted.  If the validation fails, the form is not submitted, and the visitor typically gets an alert with suggestions on how to make the form acceptable.  If the validation passes, the form submission continues without bothering the visitor.  To get our two timestamps, we can generate a first timestamp when the page loads and compare it to a second timestamp generated when the form is submitted.  If the visitor submits the form too quickly, we can display an alert showing the number of seconds remaining until the form can be successfully submitted.  This should hopefully be invisible to most visitors who choose to leave comments, but at the very least, far less irritating than a CAPTCHA system.</p>
<p>It took me two tries to get it right, but I&#8217;m going to discuss the less successful method first to point out its flaws.</p>
<h3>Method One (not good enough)</h3>
<p>Here&#8217;s how the original system flowed.</p>
<ol>
<li>Generate a first JS timestamp when the page is loaded.</li>
<li>Generate a second JS timestamp when the form is submitted.</li>
<li>Before the form is submitted, compare the two, and if enough time has passed, write a pre-determined passcode to a hidden INPUT element, then submit the form.</li>
<li>On the form processing page, use server-side logic to verify that the passcode is present and valid.</li>
</ol>
<p>The problem was that it seemed that certain bots could parse JavaScript enough to drop the pre-determined passcode into the hidden form field before submitting the form, circumventing the timestamps completely and defeating the system.  </p>
<p>It also failed to adhere to one of the basic tenants of form validation &#8211; that the input must be checked on both the client-side and the server-side.</p>
<h3>Method Two (better)</h3>
<p>Rather than having the server-side validation be merely a check to confirm that the passcode is present, method two goes back to comparing the timestamps a second time on the server side. Instead of a single hidden input, we now have two &#8211; one for each timestamp.  This is intended to prevent a bot from figuring out the ultimate validation mechanism by simply parsing the JavaScript.  Finally, the hidden fields are added to the form via jQuery, which makes it easier to implement and may act as another layer of obfuscation. </p>
<ol>
<li>Generate a first JS timestamp when the page is loaded and write it to a hidden form field.</li>
<li>Generate a second JS timestamp when the form is submitted and write it to a hidden form field.</li>
<li>Before the form is submitted, compare the two, and if enough time has passed, submit the form (client-side validation).</li>
<li>On the form processing page, use server-side logic to compare the timestamps a second time (server-side validation).</li>
</ol>
<p>The timestamp handshake works more like it did in the server-side-only method.  We still have to pass something from the comment form to the processing script, but it&#8217;s not too obvious from the HTML what is being done with it.</p>
<h2>The same downside plagues me</h2>
<p>Unfortunately, if we want to have any server-side validation at all, and we do, the core file <strong>wp-comments-post.php</strong> will still have to be modified.  In my experience, the system is not sufficiently effective using just client-side validation.  </p>
<h2>The code</h2>
<p>Two files must be modified to implement the validation.</p>
<p><strong>File 1: The theme&#8217;s comments.php file (older themes) or wp-includes\comment-template.php (newer themes)</strong></p>
<p>Your comment form lives somewhere.  My theme is based on Kubrick, the old default WordPress theme, and my comment form is in my theme folder, in a file named <strong>comments.php</strong>.  If your theme is newer and based on the current default theme, twentyeleven, the form is in <strong>wp-includes\comment-template.php</strong>.  If your theme isn&#8217;t based on either of these, all bets are off.  I know it&#8217;s confusing.  Sorry.</p>
<p>Add the JavaScript that creates and populates the timestamp fields.  Be sure to confirm that your comment form has an ID of <strong>commentform</strong>.  I&#8217;m using jQuery to help fire functions when the page loads.</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function(){
	ardGenTS1();
});

function ardGenTS1() {
	// prepare the form
	$('#commentform').append('&lt;input type=&quot;hidden&quot; name=&quot;ardTS1&quot; id=&quot;ardTS1&quot; value=&quot;1&quot; /&gt;');
	$('#commentform').append('&lt;input type=&quot;hidden&quot; name=&quot;ardTS2&quot; id=&quot;ardTS2&quot; value=&quot;1&quot; /&gt;');
	$('#commentform').attr('onsubmit', 'return validate()');
	// set a first timestamp when the page loads
	var ardTS1 = (new Date).getTime();
	document.getElementById(&quot;ardTS1&quot;).value = ardTS1;
}

function validate() {
	// read the first timestamp
	var ardTS1 = document.getElementById(&quot;ardTS1&quot;).value;
//	alert ('ardTS1: ' + ardTS1);
	// generate the second timestamp
	var ardTS2 = (new Date).getTime();
	document.getElementById(&quot;ardTS2&quot;).value = ardTS2;
//	alert ('ardTS2: ' + document.getElementById(&quot;ardTS2&quot;).value);
	// find the difference
	var diff = ardTS2 - ardTS1;
	var elapsed = Math.round(diff / 1000);
	var remaining = 10 - elapsed;
//	alert ('diff: ' + diff + '\n\nelapsed:' + elapsed);
	// check whether enough time has elapsed
	if (diff &gt; 10000) {
		// submit the form
		return true;
	}else{
		// display an alert if the form is submitted within 10 seconds
		alert(&quot;This site is protected by an anti-spam feature that requires 10 seconds to have elapsed between the page load and the form submission.\n\nPlease close this alert window.  The form may be resubmitted successfully in &quot; + remaining + &quot; seconds.&quot;);
		// prevent the form from being submitted
		return false;
	}
}
&lt;/script&gt;
</pre>
<p><strong>File 2: The wp-comments-post.php file</strong></p>
<p>The wp-comments-post.php file lives in the root of WordPress and handles the form processing.  We need to add a few lines that check the contents of our new validation input field.</p>
<p>Somewhere after line 53 or so (where <em>$comment_content</em> is defined), insert the following code.</p>
<pre class="brush: php; title: ; notranslate">
$ardTS1 = ( isset($_POST['ardTS1']) ) ? trim($_POST['ardTS1']) : 1;
$ardTS2 = ( isset($_POST['ardTS2']) ) ? trim($_POST['ardTS2']) : 2;
$ardTS = $ardTS2 - $ardTS1;

if ( $ardTS &lt; 10000 ) {
// If the difference of the timestamps is not more than 10 seconds, exit
    wp_die( __('&lt;strong&gt;ERROR&lt;/strong&gt;:  This site uses JavaScript validation to reduce comment spam.  Either your browser has JavaScript disabled, or the comment was not legitimately submitted.') );
}
</pre>
<p>That&#8217;s it.  Not so bad, right?</p>
<h2>Final thoughts</h2>
<p>One advantage to this method over the old PHP-only method is that even if the core file is replaced and the server-side validation is lost, the client-side validation continues to work, perhaps providing some measure of protection.</p>
<p>The method is safe for use with caching systems that create purely static, HTML pages.  I&#8217;ll follow up later and report on how effective it seems to be at stopping spam comments before they get to Akismet (and into the WordPress database).</p>
<p>Now, for a little extra protection, you can rename the <strong>wp-comments-post.php</strong> file and change the path in the comment form&#8217;s action attribute.  I&#8217;ve <a href="http://www.ardamis.com/2010/08/09/reducing-wordpress-spam-comments/">posted logs</a> showing that some bots just try to post spam directly to the <strong>wp-comments-post.php</strong> file, so renaming that file is an easy way to cut down on spam.  Just remember to come back and delete the <strong>wp-comments-post.php</strong> file each time you update WordPress.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2011/08/27/a-cache-proof-method-for-reducing-comment-spam/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to fix the &#8220;PHP Fatal error:  Call to undefined function  get_header()&#8221; error in WordPress</title>
		<link>http://www.ardamis.com/2011/06/02/fix-for-php-fatal-error-get_header-in-wordpress/</link>
		<comments>http://www.ardamis.com/2011/06/02/fix-for-php-fatal-error-get_header-in-wordpress/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 17:07:13 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[500 error]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=1430</guid>
		<description><![CDATA[Fix the "PHP Fatal error: Call to undefined function get_header()" error in WordPress.]]></description>
			<content:encoded><![CDATA[<p>While making changes to my WordPress theme, I noticed that the error_log file in my theme folder contained dozens of PHP Fatal error lines:</p>
<pre class="brush: plain; title: ; notranslate">
...
[01-Jun-2011 14:25:15] PHP Fatal error:  Call to undefined function  get_header() in /home/accountname/public_html/ardamis.com/wp-content/themes/ars/index.php on line 7
[01-Jun-2011 20:58:23] PHP Fatal error:  Call to undefined function  get_header() in /home/accountname/public_html/ardamis.com/wp-content/themes/ars/index.php on line 7
...
</pre>
<p>The first seven lines of my theme&#8217;s index.php file:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php ini_set('display_errors', 0); ?&gt;
&lt;?php
/**
 * @package WordPress
 * @subpackage Ars_Theme
*/
get_header(); ?&gt;
</pre>
<p>I realized that the error was being generated each time that my theme&#8217;s index.php file was called directly, and that the error was caused by the theme&#8217;s inability to locate the WordPress <strong>get_header</strong> function (which is completely normal).  Thankfully, the descriptive error wasn&#8217;t being output to the browser, but was only being logged to the error_log file, due to the inclusion of the <strong>ini_set(&#8216;display_errors&#8217;, 0);</strong> line.  I had learned this the hard way a few months ago when I found that calling the theme&#8217;s index.php file directly would generate an error message, output to the browser, that would reveal my hosting account username as part of the absolute path to the file throwing the error.</p>
<p>I decided the best way to handle this would be to check to see if the file could find the <strong>get_header</strong> function, and if it could not, simply redirect the visitor to the site&#8217;s home page.  The code I used to do this:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php ini_set('display_errors', 0); ?&gt;
&lt;?php
/**
* @package WordPress
* @subpackage Ars_Theme
*/
if (function_exists('get_header')) {
	get_header();
}else{
    /* Redirect browser */
    header(&quot;Location: http://&quot; . $_SERVER['HTTP_HOST'] . &quot;&quot;);
    /* Make sure that code below does not get executed when we redirect. */
    exit;
}; ?&gt;
</pre>
<p>So there you have it.  No more fatal errors due to <strong>get_header</strong> when loading the WordPress theme&#8217;s index.php file directly.  And if something else in the file should throw an error, <strong>ini_set(&#8216;display_errors&#8217;, 0);</strong> means it still won&#8217;t be sent to the browser.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2011/06/02/fix-for-php-fatal-error-get_header-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Online tools for detecting malware on web sites</title>
		<link>http://www.ardamis.com/2011/05/07/detecting-malware-on-web-sites/</link>
		<comments>http://www.ardamis.com/2011/05/07/detecting-malware-on-web-sites/#comments</comments>
		<pubDate>Sat, 07 May 2011 18:48:22 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Nonsense]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=1275</guid>
		<description><![CDATA[Online tools for detecting infections on web sites and for identifying vulnerabilites.]]></description>
			<content:encoded><![CDATA[<p>Just a few notes to myself about monitoring web sites for infections/malware and potential vulnerabilities.</p>
<h2>Tools for detecting infections on web sites</h2>
<h3>Google Webmaster Tools</h3>
<p>Your first stop should be here, as I&#8217;ve personally witnessed alerts show up in Webmaster Tools, even when all the following tools gave the site a passing grade.  If your site is registered here, and Google finds weird pages on your site, an alert will appear.  You can also have the messages forwarded to your email account on file, by choosing the Forward option under the All Messages area of the Home page.</p>
<div id="attachment_1382" class="wp-caption aligncenter" style="width: 784px"><a href="http://www.ardamis.com/wp-content/uploads/2011/05/google-webmaster-tools-hack-alert.png"><img src="http://www.ardamis.com/wp-content/uploads/2011/05/google-webmaster-tools-hack-alert.png" alt="" title="google-webmaster-tools-hack-alert" width="774" height="435" class="size-full wp-image-1382" /></a><p class="wp-caption-text">Google Webmaster Tools Hack Alert</p></div>
<h3>Google Safe Browsing</h3>
<p>The Google Safe Browsing report for ardamis.com: <a href="http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=ardamis.com">http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=ardamis.com</a></p>
<h3>Norton Safe Web</h3>
<p><a href="https://safeweb.norton.com/">https://safeweb.norton.com/</a></p>
<p>The Norton Safe Web report for ardamis.com: <a href="https://safeweb.norton.com/report/show?url=ardamis.com">https://safeweb.norton.com/report/show?url=ardamis.com</a></p>
<h2>Tools for analyzing a site for vulnerabilities</h2>
<h3>Sucuri Site Check</h3>
<p><a href="http://sitecheck.sucuri.net/scanner/">http://sitecheck.sucuri.net/scanner/</a></p>
<p>The Sucuri report for ardamis.com: <a href="http://sitecheck.sucuri.net/scanner/?scan=www.ardamis.com">http://sitecheck.sucuri.net/scanner/?scan=www.ardamis.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2011/05/07/detecting-malware-on-web-sites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Online tools for testing web page performance</title>
		<link>http://www.ardamis.com/2011/04/10/online-tools-for-testing-web-page-performance/</link>
		<comments>http://www.ardamis.com/2011/04/10/online-tools-for-testing-web-page-performance/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 02:49:53 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web app]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=816</guid>
		<description><![CDATA[A collection of online tools for measuring the performance of web pages, including time to first byte.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve written a few tutorials lately on how to reduce page load times.  While I use Google&#8217;s Page Speed Firefox/Firebug plugin for evaluating pages for load times, there are times when I want a second opinion, or want to point a client to a tool.  This post is a collection of links to online tools for testing web page performance.</p>
<h2>Page Speed Online</h2>
<p><a href="http://pagespeed.googlelabs.com/">http://pagespeed.googlelabs.com/</a></p>
<p>Google&#8217;s wonderful Page Speed tool, once only available as a Firefox browser Add-on, finally arrives as an online tool.  Achieving a high score (ardamis.com is a 96/100) should be on every web developer&#8217;s list of things to do before the culmination of a project.</p>
<p>Enter a URL and Page Speed Online will run performance tests based on a set of best practices known to reduce page load times.</p>
<p>Optimizing caching &#8211; keeping your application&#8217;s data and logic off the network altogether<br />
Minimizing round-trip times &#8211; reducing the number of serial request-response cycles<br />
Minimizing request overhead &#8211; reducing upload size<br />
Minimizing payload size &#8211; reducing the size of responses, downloads, and cached pages<br />
Optimizing browser rendering &#8211; improving the browser&#8217;s layout of a page</p>
<h2>WebPagetest</h2>
<p><a href="http://www.webpagetest.org/">http://www.webpagetest.org/</a></p>
<p>WebPagetest is an excellent application for users who want the same sort of detailed reporting that one gets with Page Speed.</p>
<p>Load time speed test on first view (cold cache) and repeat view (hot cache), first byte and start render<br />
Optimization checklist<br />
Enable keep-alive, HTML compression, image compression, cache static content, combine JavaScript and CSS, and use of CDN<br />
Waterfall<br />
Response headers for each request</p>
<h2>Load Impact</h2>
<p><a href="http://loadimpact.com/pageanalyzer.php">http://loadimpact.com/pageanalyzer.php</a></p>
<p>Load Impact is an online load testing service that lets you load- and stress test your website over the Internet.  The page analyzer analyzes your web page performance by emulating how a web browser would load your page and all resources referenced in it. The page and its referenced resources are loaded and important performance metrics are measured and displayed in a load-bar diagram along with other per-resource attributes such as URL, size, compression ratio and HTTP status code.</p>
<h2>ByteCheck</h2>
<p><a href="http://www.bytecheck.com/">http://www.bytecheck.com/</a></p>
<p>ByteCheck is a super minimal site that return your page&#8217;s all-important time to first byte (TTFB). Time to first byte is the time it takes for a browser to start receiving information after it has started to make the request to the server, and is responsible for a visitor&#8217;s first impression that a page is fast- or slow-loading.</p>
<h2>Web Page Analyzer</h2>
<p><a href="http://websiteoptimization.com/services/analyze/">http://websiteoptimization.com/services/analyze/</a></p>
<p>My opinion is that the Web Page Analyzer report is good for beginners without much technical knowledge of things like gzip compression and Expires headers.  It&#8217;s a bit dated, and is primarily concerned with basics like how many images a page contains.  It tells you how fast you can expect your page to load for dial-up visitors, which strikes me as quaint and not particularly useful.</p>
<p>Total HTTP requests<br />
Total size<br />
Total size per object type (CSS, JavaScript, images, etc.)<br />
Analysis of number of files and file size as compared to recommended limits.</p>
<h2>The Performance Grader</h2>
<p><a href="http://www.joomlaperformance.com/component/option,com_performance/Itemid,52/">http://www.joomlaperformance.com/component/option,com_performance/Itemid,52/</a></p>
<p>This is another simplistic analysis of a site, like Web Page Analyzer, that returns its analysis in the form of pass/fail grades on about 14 different tests.  I expect that it would be useful for developers who want to show a client a third-party&#8217;s analysis of their work, if the third-party is not terribly technically savvy.  </p>
<p>One unique thing about this tool, though, is that it totals up the size of all images referenced in CSS files (even those that the current page isn&#8217;t using).</p>
<p>HTML Size<br />
Total Size<br />
Total Requests<br />
Generation Time<br />
Number of Hosts<br />
Number of Images<br />
Size of Images<br />
Number of CSS Files<br />
Size of CSS Files<br />
Number of Script Files<br />
Size of Script Files<br />
HTML Encoding<br />
Valid HTML<br />
Frames</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2011/04/10/online-tools-for-testing-web-page-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Two million inbound links</title>
		<link>http://www.ardamis.com/2011/04/07/two-million-inbound-links/</link>
		<comments>http://www.ardamis.com/2011/04/07/two-million-inbound-links/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 15:28:04 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[blogging]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=1308</guid>
		<description><![CDATA[For posterity, a record of the inbound links and site performance as reported by Google Webmaster Tools in April, 2011.]]></description>
			<content:encoded><![CDATA[<p>As of April, 2011, the home page of ardamis.com has over two million inbound links, with over 2,800,000 total inbound links to all pages on the site.  </p>
<p>This is an increase of 1,200,000 inbound links to the home page alone since July, 2010.  I calculate that the home page is gained an average of 150,000 inbound links a month during the last eight months.  That&#8217;s pretty amazing.</p>
<div id="attachment_1309" class="wp-caption aligncenter" style="width: 830px"><a href="http://www.ardamis.com/wp-content/uploads/2011/04/2011-april-inbound-links.png"><img src="http://www.ardamis.com/wp-content/uploads/2011/04/2011-april-inbound-links.png" alt="" title="2011-april-inbound-links" width="820" height="214" class="size-full wp-image-1309" /></a><p class="wp-caption-text">April 2011 Inbound Links</p></div>
<p>But I continue to be disappointed in the Site Performance area of Webmaster Tools.  Try as I might, Google still thinks my site is crushingly slow, with average load times of 2.9 seconds, even though my independent tests suggest that the site consistently returns pages in less than two seconds.</p>
<div id="attachment_1310" class="wp-caption aligncenter" style="width: 830px"><a href="http://www.ardamis.com/wp-content/uploads/2011/04/2011-april-site-performance.png"><img src="http://www.ardamis.com/wp-content/uploads/2011/04/2011-april-site-performance.png" alt="" title="2011-april-site-performance" width="820" height="352" class="size-full wp-image-1310" /></a><p class="wp-caption-text">April 2011 Site Performance</p></div>
<p>I&#8217;ll keep at it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2011/04/07/two-million-inbound-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A chart illustrating the reduction in comment spam at ardamis.com</title>
		<link>http://www.ardamis.com/2011/01/18/a-chart-illustrating-the-reduction-in-comment-spam-at-ardamis-com/</link>
		<comments>http://www.ardamis.com/2011/01/18/a-chart-illustrating-the-reduction-in-comment-spam-at-ardamis-com/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 19:12:09 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[500 error]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[comment spam]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=1228</guid>
		<description><![CDATA[A screenshot of the Akismet stats graph showing the number of spam comments at ardamis.com identified by Akismet before and after my anti-spam system was implemented.]]></description>
			<content:encoded><![CDATA[<p>In August, 2010, I described <a href="http://www.ardamis.com/2010/08/09/reducing-wordpress-spam-comments/">a simple method for dramatically reducing the number of spam comments</a> that are submitted to a WordPress blog.  The spam comments are rejected before they are checked by Akismet, so they never make it into the database at all.</p>
<p>Now, a few months later, I&#8217;m posting a screenshot of the Akismet stats graph from the WordPress dashboard showing the number of spam comments identified by Akismet before and after the system was implemented.</p>
<div id="attachment_1229" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.ardamis.com/wp-content/uploads/2011/01/akismet-500.jpg"><img src="http://www.ardamis.com/wp-content/uploads/2011/01/akismet-500.jpg" alt="" title="akismet-500" width="500" height="340" class="size-full wp-image-1229" /></a><p class="wp-caption-text">Akismet stats for August - December, 2010</p></div>
<p>The spike in spam comments detected around November 3rd occurred after an update to WordPress overwrote my altered wp-comments.php file.  I replaced the file and the spam dropped back down to single digits per day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2011/01/18/a-chart-illustrating-the-reduction-in-comment-spam-at-ardamis-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sitelinks: gone and back again</title>
		<link>http://www.ardamis.com/2011/01/09/sitelinks-gone-and-back-again/</link>
		<comments>http://www.ardamis.com/2011/01/09/sitelinks-gone-and-back-again/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 04:50:18 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Nonsense]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=1199</guid>
		<description><![CDATA[In January, 2011, I noticed that ardamis.com was again displaying sitelinks in Google, but this time, also for the search phrase "oliver baty".]]></description>
			<content:encoded><![CDATA[<p>The sitelinks on ardamis.com seem to come and go.  I noticed that they were back again a few days ago.  </p>
<a href="http://www.ardamis.com/wp-content/uploads/2011/01/ardamis-sitelinks-ardamis2.png"><img src="http://www.ardamis.com/wp-content/uploads/2011/01/ardamis-sitelinks-ardamis2.png" alt="Google sitelinks for &quot;ardamis&quot;" title="ardamis-sitelinks-ardamis" width="525" height="350" class="size-full wp-image-1207" /></a>
<p>But this time around, a search for &#8220;Oliver Baty&#8221; also returns sitelinks.</p>
<a href=""http://www.ardamis.com/wp-content/uploads/2011/01/ardamis-sitelinks-oliver-baty.png""><img src="http://www.ardamis.com/wp-content/uploads/2011/01/ardamis-sitelinks-oliver-baty.png" alt="Google sitelinks for &quot;oliver baty&quot;" title="ardamis-sitelinks-oliver-baty" width="525" height="372" class="size-full wp-image-1202" /></a>
<p>This is the first time I&#8217;ve noticed that a search for other than the domain name has returned sitelinks for ardamis.com, so I figured it was worth recording for posterity.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2011/01/09/sitelinks-gone-and-back-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sitelinks are back on Ardamis</title>
		<link>http://www.ardamis.com/2010/10/17/sitelinks-are-back-on-ardamis/</link>
		<comments>http://www.ardamis.com/2010/10/17/sitelinks-are-back-on-ardamis/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 04:33:48 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=1079</guid>
		<description><![CDATA[Ardamis.com once again has three Google sitelinks, as it did in mid-2009, and is approaching two million inbound links.]]></description>
			<content:encoded><![CDATA[<p>As of early October, Ardamis.com has its Google sitelinks back.  I first noticed them back in July of 2009, when <a href="http://www.ardamis.com/2009/07/01/toolbar-page-rank-of-6-and-3-one-line-sitelinks/">Ardamis had a toolbar PageRank of 6</a>.  Changes to Google&#8217;s algorithm later cost the site the sitelinks and reduced the PR to 5, which is how the site has appeared for the last year or so.  Three months ago, in July of 2010 and one year after the sitelinks appeared, I noticed that all of the pages combined had over <a href="http://www.ardamis.com/2010/07/13/one-million-inbound-links/">one million inbound links</a>.</p>
<p>This is what a <a href="http://www.google.com/search?q=ardamis">Google search for ardamis</a> returns:</p>
<div id="attachment_1080" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.ardamis.com/wp-content/uploads/2010/10/ardamis-100310-sitelinks.png"><img src="http://www.ardamis.com/wp-content/uploads/2010/10/ardamis-100310-sitelinks.png" alt="Ardamis' Google sitelinks" title="ardamis-100310-sitelinks" width="500" height="414" class="size-full wp-image-1080" /></a><p class="wp-caption-text">Ardamis' Google sitelinks</p></div>
<p>The second result returned, <a href="http://www.ardamis.com/2010/03/12/final-fantasy-xiii-freezing-xbox-360/">Final Fantasy XIII freezing on Xbox 360</a>, is among my longest posts, has 91 comments, and enjoys some of the best inbound links of any page on the site, including from the <a href="http://forums.xbox.com/31685195/PrintPost.aspx">forums at Xbox.com</a>, <a href="http://kotaku.com/5494326/rumor-final-fantasy-xiii-ps3-has-freezing-issues">Kotaku</a> and <a href="http://www.gamesradar.com/ps3/final-fantasy-xiii/news/potentially-major-final-fantasy-xiii-freezing-issue-emerges/a-20100316104130477028/g-20060508175846527007">GamesRadar</a>.</p>
<p>The third result is my primary competition for the term <strong>ardamis</strong>, which briefly held the number one ranking a few months ago.   That site has some <a href="http://googlewebmastercentral.blogspot.com/2009/04/one-line-sitelinks.html">one-line site links</a>.</p>
<p>The actual mechanics of obtaining <a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&#038;answer=47334">sitelinks</a> remains a mystery, but there are plenty of people who are willing to speculate (and a few brave enough to promise they can deliver them for a price).</p>
<p>I&#8217;ve been posting more frequently, the site uses the <a href="http://wordpress.org/extend/plugins/wp-paginate/">WP-Paginate plugin</a> and according to <a href="http://www.google.com/webmasters/tools">Google&#8217;s Webmaster Tools</a>, the home page alone now has well over one million inbound links, but otherwise it&#8217;s been business as usual here.</p>
<div id="attachment_1081" class="wp-caption aligncenter" style="width: 511px"><a href="http://www.ardamis.com/wp-content/uploads/2010/10/ardamis-100310-inbound-links.png"><img src="http://www.ardamis.com/wp-content/uploads/2010/10/ardamis-100310-inbound-links.png" alt="Ardamis home page one million links" title="ardamis-100310-inbound-links" width="501" height="273" class="size-full wp-image-1081" /></a><p class="wp-caption-text">Over one million inbound links to the home page of Ardamis.com</p></div>
<p>I&#8217;m not going to speculate about how to get sitelinks or whether one or more of the changes in the last year was the catalyst, but Google does say to use descriptive and non-repetitive anchor and alt text in a site&#8217;s internal links and to keep important pages within a few clicks of the home page.  These are very basic, fundamental things that any site should do, but it bears repeating.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2010/10/17/sitelinks-are-back-on-ardamis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A massive reduction in the number of spam comments</title>
		<link>http://www.ardamis.com/2010/08/09/reducing-wordpress-spam-comments/</link>
		<comments>http://www.ardamis.com/2010/08/09/reducing-wordpress-spam-comments/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 05:57:51 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[comment spam]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[themes]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=920</guid>
		<description><![CDATA[How to reduce the number of spam comments that make it into your WordPress database without annoying your visitors.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve written a number of posts on ways to reduce the number of spam comments a blog receives.  In this post, I&#8217;ll revisit an old method that has almost completely stopped spam comments at ardamis.com before they get to the database.</p>
<p><a href="http://www.ardamis.com/2007/09/12/defeating-wordpress-comment-spam/">My first system</a> for blocking WordPress comment spam was an overly complex combination of JavaScript and a <a href="http://en.wikipedia.org/wiki/Challenge-response_authentication">challenge-response</a> to test that the comment was being submitted by a person.  The value of the action attribute in the form was not in the HTML when the page was loaded, so the form couldn&#8217;t be immediately submitted, then JavaScript was used to write the path to a renamed wp-comments-post.php file only after a certain user action was performed.  I was never really satisfied with it.  I didn&#8217;t like relying on JavaScript, I had doubts that any human being (meaning of any mental or physical capacity, speaking any language, etc.) could correctly answer the question, and I was concerned that <a href="http://blog.akismet.com/2009/02/04/make-commenting-easy/">any obstacle to submitting a form discourages legitimate commenting</a>.  </p>
<p>A few months later, I posted a simpler <a href="http://www.ardamis.com/2007/12/15/using-timestamps-to-reduce-wordpress-comment-spam/">timestamp method for reducing WordPress comment spam</a> that compares two timestamps and then rejects any form submission that occurrs within 60 seconds of the post page being loaded.  The visitor wasn&#8217;t bothered by an additional form field solely for anti-spam and there was no JavaScript involved.</p>
<p>Both methods were very effective at blocking spam before it made it to the database.  In the five months leading up to the implementation of the first method, Akismet was catching an average of 1418 spam comments per month.  In the first five months after these methods were put in place, Akismet was catching only 54 spam comments per month.  But I also noticed a reduction in legitimate comments, from an average of 26 per month to 20 per month, which led me to suspect that real visitors attempting to leave comments were being discouraged from doing so.</p>
<p>The timestamp method required changing a core file, which was overwritten each time WordPress was updated.  As time went on, I forgot to replace the file after upgrading WordPress, so the protection was lost and I once again had only Akismet blocking spam.  A few months later, while doing work on the database in an attempt to <a href="http://www.ardamis.com/2010/08/03/how-to-speed-up-wordpress/">speed up WordPress</a>, I happened to check my historical stats and found that Akismet had detected 4,144 comments in July, 2010.  Yikes.  It was time to revisit these old methods.</p>
<p>At 2:30 AM on August 1, 2010, I again implemented my timestamp method, but this time I also renamed the <strong>wp-comments-post.php</strong> file that processes the form.  I changed my theme&#8217;s <strong>comments.php</strong> file to submit the form to the new page, deleted the <strong>wp-comments-post.php</strong> file from the server and tested to make sure that comments could still be submitted.  And then I waited to see what would happen.</p>
<p>The effect was pretty amazing. The spam had almost completely stopped.</p>
<p>My Akismet stats look like this:</p>
<table>
<tr>
<th>Date</th>
<th>Spam</th>
</tr>
<tr>
<td>7.30.10</td>
<td>192</td>
</tr>
<tr class="even">
<td>7.31.10</td>
<td>196</td>
</tr>
<tr>
<td>8.1.10</td>
<td>32</td>
</tr>
<tr class="even">
<td>8.2.10</td>
<td>0</td>
</tr>
<tr>
<td>8.5.10</td>
<td>4</td>
</tr>
<tr class="even">
<td>8.8.10</td>
<td>4</td>
</tr>
<tr>
<td>8.10.10</td>
<td>4</td>
</tr>
<tr class="even">
<td>8.11.10</td>
<td>4</td>
</tr>
<tr>
<td>8.13.10</td>
<td>0</td>
</tr>
<tr class="even">
<td>8.14.10</td>
<td>0</td>
</tr>
</table>
<p>(I don&#8217;t know why so many dates in August are skipped in the log, but whatever.)</p>
<h2>Fast, but only partial protection</h2>
<p>The quick and easy way to reduce the number of spam comments that your WordPress blog receives is to merely change the location of the comment form processing script.</p>
<ol>
<li>Rename <strong>wp-comments-post.php</strong> to anything else.  I like using a string of <a href="https://www.grc.com/passwords.htm">random hexadecimal characters</a>, like: <strong>z1t0zVGuaCZEi.php</strong>.</li>
<li>Edit your current theme&#8217;s <strong>comments.php</strong> so that the form is submitted to this new file.</li>
<li>Upload these files to their respective directories, then delete the <strong>wp-comments-post.php</strong> file from your server.
</ol>
<p>This method works well to stop spam submitted by bots that assume the comment form processing script used by WordPress is always at the same location.  More advanced bots will read the actual location of the file from the <code>action</code> attribute of the <code>form</code> element, but that can be countered by using either the JavaScript or <a href="http://www.ardamis.com/2007/12/15/using-timestamps-to-reduce-wordpress-comment-spam/">timestamp method</a>.</p>
<h2>Access log analysis</h2>
<p>To illustrate the effectiveness of the renamed wp-comments-post file + timestamp check, below are some events from my 06 August 2010 access log.</p>
<h3>Bot defeated by renamed file alone</h3>
<p>Here is a form submission to the non-existent wp-comments-post file that occurs 2 seconds after the post page is requested.</p>
<pre>
173.242.112.44 - - [06/Aug/2010:23:21:37 -0700] "GET www.ardamis.com/2007/07/12/defeating-contact-form-spam/ HTTP/1.0" 200 32530 "http://www.google.com" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.50"
173.242.112.44 - - [06/Aug/2010:23:21:39 -0700] "POST www.ardamis.com/wp-comments-post.php HTTP/1.0" 404 15529 "http://www.ardamis.com/2007/07/12/defeating-contact-form-spam/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.50"
</pre>
<p>The bot is sent a 404 HTTP status code, which is widely understood to mean that the page isn&#8217;t there and you can stop asking for it.  But that doesn&#8217;t stop this bot!  Two minutes later, it&#8217;s back at another page, trying again.</p>
<pre>
173.242.112.44 - - [06/Aug/2010:23:23:01 -0700] "GET www.ardamis.com/2007/03/29/xbox-360-gamercard-wordpress-plugin/ HTTP/1.0" 200 101259 "http://www.google.com" "Opera/9.64(Windows NT 5.1; U; en) Presto/2.1.1"
173.242.112.44 - - [06/Aug/2010:23:23:05 -0700] "POST www.ardamis.com/wp-comments-post.php HTTP/1.0" 404 15529 "http://www.ardamis.com/2007/03/29/xbox-360-gamercard-wordpress-plugin/" "Opera/9.64(Windows NT 5.1; U; en) Presto/2.1.1"
</pre>
<p>Again, it gets a 404 back.  Some bots never learn. </p>
<h3>Bot defeated by timestamp check</h3>
<p>Here is a form submission to the renamed wp-comments-post file that occurs 4 seconds after the post page is requested.</p>
<pre>
91.201.66.6 - - [06/Aug/2010:23:30:41 -0700] "GET www.ardamis.com/2007/03/29/xbox-360-gamercard-wordpress-plugin/ HTTP/1.1" 200 21787 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)"
91.201.66.6 - - [06/Aug/2010:23:30:45 -0700] "POST www.ardamis.com/wp-comments-post-timestamp-3.0.1.php HTTP/1.1" 500 1227 "http://www.ardamis.com/2007/03/29/xbox-360-gamercard-wordpress-plugin/" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)"
</pre>
<p>The 500 HTTP header indicates that this submission was denied and the comment never made it to the database.  This access log doesn&#8217;t indicate which check stopped the POST (eg: the email validation or the timestamp function), but my money is on the timestamp.</p>
<p>Here&#8217;s another form submission to the renamed wp-comments-post file that occurs one second after the post page is requested.  Speed reader or bot?</p>
<pre>
95.220.185.210 - - [06/Aug/2010:23:56:54 -0700] "GET www.ardamis.com/2010/02/26/fixing-word-2007-add-in-issues/ HTTP/1.1" 200 23977 "-" "Opera/9.01 (Windows NT 5.0; U; en)"
95.220.185.210 - - [06/Aug/2010:23:56:55 -0700] "POST www.ardamis.com/wp-comments-post-timestamp-3.0.1.php HTTP/1.1" 500 1213 "http://www.ardamis.com/2010/02/26/fixing-word-2007-add-in-issues/" "Opera/9.01 (Windows NT 5.0; U; en)"
</pre>
<p>The submission is rejected.</p>
<h2>Taking the method even further</h2>
<p>To take this method even further, one could send a 200 OK header even when the comment is blocked, so the bots never know their mission failed.  But this seems unnecessary at this point, as it doesn&#8217;t appear that they change their behavior after being sent a 404 error, or that they try again after being sent a 500 error.  It also makes it harder to figure out from the access logs which comments were rejected and for what reason.</p>
<p>If you still want to do this, first implement the <a href="http://www.ardamis.com/2007/12/15/using-timestamps-to-reduce-wordpress-comment-spam/">timestamp method</a>, then make the following modifications.</p>
<h3>Sending a 200 header</h3>
<pre class="brush: php; title: ; notranslate">
$comment_timestamp    = trim($_POST['timestamp']);
$submitted_timestamp  = time();

if ( $comment_timestamp == '' ) {
// If the value for $_POST['timestamp'] is an empty string, exit (the form wasn't submitted by the theme's comments.php)
	header('HTTP/1.1 200 OK');
	echo '&lt;p style=&quot;text-align:center;&quot;&gt;Error: It looks like this form was not submitted by the form at ' . get_option('siteurl') . '.&lt;/p&gt;';
	exit;
}
if ( $submitted_timestamp - $comment_timestamp &lt; 60 ) {
// If the form was submitted within 60 seconds of page load, exit
	header('HTTP/1.1 200 OK');
	echo '&lt;p style=&quot;text-align:center;&quot;&gt;Error: The comment was posted too soon after the page was loaded.  Please press the Back button on your browser and try again in a few seconds.&lt;/p&gt;';
	exit;
}
// If the form was submitted more than 10 minutes after page load, die
if ( $submitted_timestamp - $comment_timestamp &gt; 600 ) {
	header('HTTP/1.1 200 OK');
	echo '&lt;p style=&quot;text-align:center;&quot;&gt;Error: You waited too long before posting a comment.&lt;/p&gt;';
	exit;
}
</pre>
<p>One could also write a record to a database each time the old wp-comments-post.php file is requested or any of the timestamp checks block a form submission, and pretty quickly generate a list of IP addresses for a black list.  At the same time, one could log which timestamp check caught the spam attempt, which is interesting enough that I&#8217;ll probably do it eventually.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2010/08/09/reducing-wordpress-spam-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

