<?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>compu.terlicio.us &#187; WordPress</title>
	<atom:link href="http://compu.terlicio.us/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://compu.terlicio.us</link>
	<description>Flying, Computers, and Food</description>
	<lastBuildDate>Fri, 25 Nov 2011 01:16:49 +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>timthumb.php for WordPress Multisite</title>
		<link>http://compu.terlicio.us/2011/04/timthumb-for-wordpress-multisite/</link>
		<comments>http://compu.terlicio.us/2011/04/timthumb-for-wordpress-multisite/#comments</comments>
		<pubDate>Sat, 09 Apr 2011 00:23:56 +0000</pubDate>
		<dc:creator>Christopher O'Connell</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[blogs.dir]]></category>
		<category><![CDATA[timthumb.php]]></category>
		<category><![CDATA[WordPress Multisite]]></category>

		<guid isPermaLink="false">http://compu.terlicio.us/?p=165</guid>
		<description><![CDATA[timthumb.php is awesome. Unfortunately, it doesn&#8217;t work very well with WordPress Multisite. Despite a number of people who have proposed solutions, none of them seem to provide a simple, drop in replacement for timthumb.php which just works. Well, now I have. The Problem timthumb.php doesn&#8217;t know how to deal with the blogs.dir directory in which [...]]]></description>
			<content:encoded><![CDATA[<p><code>timthumb.php</code> is awesome. Unfortunately, it doesn&#8217;t work very well with WordPress Multisite. Despite a number of people who have proposed solutions, none of them seem to provide a simple, drop in replacement for <code>timthumb.php</code> which just works. Well, now I have.<br />
<span id="more-165"></span></p>
<h3>The Problem</h3>
<p><code>timthumb.php</code> doesn&#8217;t know how to deal with the <code>blogs.dir</code> directory in which WordPress stores images in Multisite. Ideally, you should update your theme to point to the correct directory, or even use WordPress&#8217; built in thumbnail handling. However, if you don&#8217;t want to mess around with all of this then simply download <a rel="nofollow" title="Download version 0.1 of timthumb.php" href="http://compu.terlicio.us/http//compu.terlicio.us/downloads/timthumb/timthumb.php">timthumb.php</a> and replace your <code>timthumb.php</code>. Problem solved.</p>
<h3>How it works</h3>
<p>This slightly modifies the function which timthumb uses to find the path to the specified image file. If it detects a <code>blogs.dir</code> directory, it looks through each individual &#8220;site&#8221; directory until it finds the one which contains the image in question.</p>
<p>There is one potential gotcha in this implementation. If you have identically named files, uploaded in the same month in two different &#8220;sites&#8221;, this script will use the first one it finds, which may, or may not be the one you intended.</p>
<h3>Download</h3>
<a rel="nofollow" title="Download version 0.1 of timthumb.php" href="http://compu.terlicio.us/http//compu.terlicio.us/downloads/timthumb/timthumb.php">timthumb.php</a>
]]></content:encoded>
			<wfw:commentRss>http://compu.terlicio.us/2011/04/timthumb-for-wordpress-multisite/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Poor Programming Proliferation</title>
		<link>http://compu.terlicio.us/2009/06/poor-programming-proliferation/</link>
		<comments>http://compu.terlicio.us/2009/06/poor-programming-proliferation/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 20:19:32 +0000</pubDate>
		<dc:creator>Christopher O'Connell</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Plug-ins]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Coding Practices]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://compu.terlicio.us/?p=145</guid>
		<description><![CDATA[It seems, reading the news, that nuclear proliferation will be the end of the world. For a WordPress developer, on the other hand, poor plugin programming seems likely be the end of the world. I rarely take shots at other people online (it seems rather trollish to me), but the sheer horror of Fire Studio&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>It seems, reading the news, that nuclear proliferation will be the end of the world. For a WordPress developer, on the other hand, poor plugin programming seems likely be the end of the world. I rarely take shots at other people online (it seems rather trollish to me), but the sheer horror of <a href="http://fire-studios.com/blog/wordpress-plugin-templates">Fire Studio&#8217;s WordPress Plugin Templates </a>compel me to say something.<br />
<span id="more-145"></span><br />
While I certainly applaud people who make plugin development easier, if one <em>is</em> going to distribute a plugin framework, it should, at the very least, follow the minimum best practices for WordPress programming. Fire Studio&#8217;s WordPress Plugin Templates is an epic fail in this regard. I fall pray to these mistakes from time to time myself, and there may be differences of opinion and style in programming. Nonetheless, as the WordPress Plugin Template is designed to be distributed, I must list out the reasons why NOT to use the WordPress Plugin Templates.</p>
<p><strong>1:</strong> Overuse of the options table:<br />
<code>get_option()</code> and <code>set_option()</code> are wonderfully useful features, if used in moderation. If not used in moderation, they result in a hellish jumble of entries in the wp-options table. Instead of using many discreet entries, an &#8220;options&#8221; object or array should be serialized into a <code>set_option()</code> call. While this <em>may</em> be overkill for a very simple plugin, once you get to any number of options it is a necessity.</p>
<p><strong>2: </strong> No NONCEs<br />
This is such an offensive mistake it makes me cry a little. As <a href="http://compu.terlicio.us/2008/05/stopping-nonces-part-1/">I</a>(and <a href="http://markjaquith.wordpress.com/2006/06/02/wordpress-203-nonces/">Mark Jaquith</a> and <a href="http://www.prelovac.com/vladimir/improving-security-in-wordpress-plugins-using-nonces">Vladimir Prelovac</a> and <a href="http://lorelle.wordpress.com/2009/03/07/firewalling-and-hack-proofing-your-wordpress-blog/">many others</a>) have written, using nonces is a <strong>must</strong> for any plugin which takes options from a user. Strangely enough, the nonce field is included, but then never checked (WTF?). Without the use of nonces, a nefarious user can arbitrarily change your plugin settings, and possibly even take over your database. Particularly if there are</p>
<p><strong>3: </strong> No SQL Injection Security<br />
Not having nonces is one thing. It&#8217;s bad, but I&#8217;ve forgotten from time to time myself. But not even escaping input before putting it in the database is, to quote &#8220;Yahtzee&#8221;, <a href="http://www.splitreason.com/product/582">pants on head retarded</a>!. Escaping user input is probably the single simplest and most basic security. It&#8217;s the last line of defense against people replacing your header image with horrific porn. Don&#8217;t write code without it.</p>
<p><strong>4: </strong> Unnecessary use of <code>global</code> variables<br />
This exists on two levels:<br />
A) In <code>purpose.php</code>, both <code>$wp_query</code> and <code>$post</code> are called into the function via global. While this probably won&#8217;t do any harm, globally including everything everywhere is what made earlier version of php such a nightmare and it looks messy. If you don&#8217;t need a variable, don&#8217;t include it.<br />
B) <code>$var1</code>-<code>$var4</code> are declared to static values at the top of the file where they will clutter up the global namespace. They are never accessed from their global context, they are always <code>get_option()</code>ed. In fact, the only reason they are declared here is so that they can be <code>add_option</code>ed into options. EVERY TIME THE CODE RUNS. That&#8217;s four superfluous function calls every single time the file loads. This should be done once, on plugin install. Not every single time WordPress loads a page.</p>
<p><strong>5: </strong> Include vs. Require<br />
I realize that this is pretty nit-picky, but, when including files that are <strong>required</strong> for the program to function, the appropriate function is <code>require()</code> (or better yet, <code>require_once()</code>. If the file is missing, the code to break while trying to include the file, instead of mysteriously throwing messages about redeclaration of functions.</p>
<p>In conclusion, while the concept of a plugin framework is laudable, Fire Studio&#8217;s implementation falls far short of any reasonable mark of best practices, and only serves to encourage worst practices.</p>
]]></content:encoded>
			<wfw:commentRss>http://compu.terlicio.us/2009/06/poor-programming-proliferation/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>µAudio 0.7 Preview</title>
		<link>http://compu.terlicio.us/2009/05/audio-07-preview/</link>
		<comments>http://compu.terlicio.us/2009/05/audio-07-preview/#comments</comments>
		<pubDate>Fri, 29 May 2009 15:39:59 +0000</pubDate>
		<dc:creator>Christopher O'Connell</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Plug-ins]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[audio player]]></category>
		<category><![CDATA[micro-audio]]></category>
		<category><![CDATA[Software Preview]]></category>
		<category><![CDATA[WordCamp]]></category>
		<category><![CDATA[µAudio]]></category>

		<guid isPermaLink="false">http://compu.terlicio.us/?p=141</guid>
		<description><![CDATA[With several major features now in &#181;Audio 0.7, I wanted to preview what&#8217;s coming up. 1) Static JavaScript. Instead of using the *.js.php which I have been using, javascript templates are being parsed by a small JS templating engine and stored as static files. This should significantly cut down on the amount of time spent [...]]]></description>
			<content:encoded><![CDATA[<p>With several <a href="http://redmine.paintedrockcommunications.com/projects/show/micro-audio">major features</a> now in &micro;Audio 0.7, I wanted to preview what&#8217;s coming up.</p>
<p>1) Static JavaScript. Instead of using the *.js.php which I have been using, javascript templates are being parsed by a small JS templating engine and stored as static files. This should significantly cut down on the amount of time spent processing php. Each file is stored as filename-hashcode.js.</p>
<p>2) Bootstrapper. People have told me a) They don&#8217;t think it&#8217;s fair to count the size without jQuery (it probably isn&#8217;t) and b) They don&#8217;t want to load jQuery on every pageload. To that end, the default install will now include a tiny bootstrapper (hopefully under 200 Bytes) that doesn&#8217;t load the player until and unless someone actually wants to use them.</p>
<p>3) Single audio player. For legacy browsers, there will only be one player, the awesome <a href="http://www.schillmania.com/projects/soundmanager2/">Sound Manager 2</a> player. User interface will be provided via jQuery based controls. Using a single &#8220;invisible&#8221; player allows a consistent JavaScript interface for all the players, and, should help to</p>
<p>4) &lt;audio&gt; tag based player. This will probably be beta only in 0.7, but I want to move towards using the native browser implementation instead of flash. Using a javascript interface and sound manager means it should be a seamless user experience, and the only difference is whether the JavaScript is calling the sound manager js or the &lt;audio&gt; tag.</p>
<p>I&#8217;ll be at WordCamp in San Francisco this weekend, anyone who wants to bend my ear about a feature can do so. Twitter at <a href="http://twitter.com/jwriteclub">jwriteclub</a> to get together.</p>
]]></content:encoded>
			<wfw:commentRss>http://compu.terlicio.us/2009/05/audio-07-preview/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>&#181;Audio 0.6.1 Released</title>
		<link>http://compu.terlicio.us/2009/03/audio-061-released/</link>
		<comments>http://compu.terlicio.us/2009/03/audio-061-released/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 23:53:33 +0000</pubDate>
		<dc:creator>Christopher O'Connell</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Plug-ins]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[audio player]]></category>
		<category><![CDATA[micro-audio]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[wordpress.org]]></category>
		<category><![CDATA[µAudio]]></category>

		<guid isPermaLink="false">http://compu.terlicio.us/?p=120</guid>
		<description><![CDATA[A minor bug fix release for &#181;Audio is out today. Properly validates at W3C now and fixes a couple little bugs in the css parser. Head over the the &#181;Audio page at WordPress.org or grab a copy from my &#181;Audio page. Those of you waiting for the 0.7 release with the new sidebar widget shouldn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>A minor bug fix release for &micro;Audio is out today. Properly validates at W3C now and fixes a couple little bugs in the css parser.</p>
<p>Head over the the <a href="http://wordpress.org/extend/plugins/microaudio/" title="&micro;Audio at WordPress.org">&micro;Audio page at WordPress.org</a> or grab a copy from my <a href="http://compu.terlicio.us/code/plugins/audio/" title="&micro;Audio at Compu.terlicio.us">&micro;Audio page</a>.</p>
<p>Those of you waiting for the 0.7 release with the new sidebar widget shouldn&#8217;t have too much longer to wait. It&#8217;s coming with some major changes to how &micro;Audio handles javascript. There will probably be a 0.6.2 release in the next week or so to fix any lingering bugs with the current implementation, and then 0.7 will have the new code.</p>
]]></content:encoded>
			<wfw:commentRss>http://compu.terlicio.us/2009/03/audio-061-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#181;Audio 0.6 Released</title>
		<link>http://compu.terlicio.us/2009/01/audio-06-released/</link>
		<comments>http://compu.terlicio.us/2009/01/audio-06-released/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 22:56:43 +0000</pubDate>
		<dc:creator>Christopher O'Connell</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Plug-ins]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[audio player]]></category>
		<category><![CDATA[micro-audio]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[µAudio]]></category>

		<guid isPermaLink="false">http://compu.terlicio.us/?p=108</guid>
		<description><![CDATA[Well, at long last it&#8217;s here, &#181;Audio version 0.6. This releases brings a bunch of changes, including support for css skinning, much improved javascript, a complete removal of all browser dependant code and a smaller basic install (just 450 Bytes). Head on over to WordPress.org or grab a copy from my &#181;Audio Page.]]></description>
			<content:encoded><![CDATA[<p>Well, at long last it&#8217;s here, &micro;Audio version 0.6. This releases brings a bunch of changes, including support for css skinning, much improved javascript, a complete removal of all browser dependant code and a smaller basic install (just 450 Bytes).</p>
<p>Head on over to <a href="http://wordpress.org/extend/plugins/microaudio/">WordPress.org</a> or grab a copy from my <a href="http://compu.terlicio.us/code/plugins/audio/">&micro;Audio Page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://compu.terlicio.us/2009/01/audio-06-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>&#181;Mint 0.4 Released</title>
		<link>http://compu.terlicio.us/2008/12/mint-04-released/</link>
		<comments>http://compu.terlicio.us/2008/12/mint-04-released/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 01:20:56 +0000</pubDate>
		<dc:creator>Christopher O'Connell</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Plug-ins]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[micro-mint]]></category>
		<category><![CDATA[mint]]></category>
		<category><![CDATA[mint API]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[wordpress.org]]></category>
		<category><![CDATA[µMint]]></category>

		<guid isPermaLink="false">http://compu.terlicio.us/?p=106</guid>
		<description><![CDATA[Just in time for WordPress 2.7, µMint 0.4. New Dashboard Widget Better number formatting 2.7 Compatible Mosey over to the &#181;Mint page at wordpress.org or grab a copy from my &#181;Mint page.]]></description>
			<content:encoded><![CDATA[<p>Just in time for WordPress 2.7, µMint 0.4.</p>
<ul>
<li>New Dashboard Widget</li>
<li>Better number formatting</li>
<li>2.7 Compatible</li>
</ul>
<p>Mosey over to the <a title="&micro;Mint at WordPress.org" href="http://wordpress.org/extend/plugins/micromint/">&micro;Mint page at wordpress.org</a> or grab a copy from my <a title="&micro;Mint at Compu.terlicio.us" href="http://compu.terlicio.us/code/plugins/mint/">&micro;Mint</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://compu.terlicio.us/2008/12/mint-04-released/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>&#181;Audio 0.5 Released</title>
		<link>http://compu.terlicio.us/2008/10/audio-05-released/</link>
		<comments>http://compu.terlicio.us/2008/10/audio-05-released/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 07:16:07 +0000</pubDate>
		<dc:creator>Christopher O'Connell</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[audio player]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[micro-audio]]></category>
		<category><![CDATA[Plug-ins]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[wordpress.org]]></category>
		<category><![CDATA[µAudio]]></category>

		<guid isPermaLink="false">http://compu.terlicio.us/?p=72</guid>
		<description><![CDATA[A new, improved and super shrunk 0.5 branch is out. Check out my µAudio page, or head over to µAudio at wordpress.org for a copy of your very own. And yes, screenshot 5 is real, the minimal installation is just 495 Bytes! Thanks for all you patience.]]></description>
			<content:encoded><![CDATA[<p>A new, improved and super shrunk 0.5 branch is out. Check out <a href="http://compu.terlicio.us/code/plugins/audio/">my µAudio page</a>, or head over to <a href="http://wordpress.org/extend/plugins/microaudio/">µAudio at wordpress.org</a> for a copy of your very own.</p>
<p>And yes, <a href="http://wordpress.org/extend/plugins/microaudio/screenshots/">screenshot 5</a> is real, the minimal installation is just 495 Bytes!</p>
<p>Thanks for all you patience.</p>
]]></content:encoded>
			<wfw:commentRss>http://compu.terlicio.us/2008/10/audio-05-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stopping nonces with WordPress NONCE: Part 1 &#8212; Basic Nonce Usage</title>
		<link>http://compu.terlicio.us/2008/05/stopping-nonces-part-1/</link>
		<comments>http://compu.terlicio.us/2008/05/stopping-nonces-part-1/#comments</comments>
		<pubDate>Sat, 03 May 2008 22:19:01 +0000</pubDate>
		<dc:creator>Christopher O'Connell</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[Plug-ins]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://compu.terlicio.us/?p=49</guid>
		<description><![CDATA[In the introduction, I provided a brief overview of Numbers used ONCE (nonce) and how they are implemented in WordPress. In this part, I&#8217;ll introduce you to creating and verifying a nonce. To get started with WordPress nonces, we need a plugin administration page. To make life easier for the budding developer, I&#8217;ve created a [...]]]></description>
			<content:encoded><![CDATA[<p>In the introduction, I provided a brief overview of Numbers used ONCE (nonce) and how they are implemented in WordPress. In this part, I&#8217;ll introduce you to creating and verifying a nonce.</p>
<p><span id="more-49"></span></p>
<p>To get started with WordPress nonces, we need a plugin administration page. To make life easier for the budding developer, I&#8217;ve created a basic plugin called &#8220;WP Nonce Playground.&#8221; (<a rel="nofollow" title="Download version Part 1 of wpn.part1.zip" href="http://compu.terlicio.us/downloads/tutorials/wpn/wpn.part1.zip">'WP Nonce Playground: Part 1'</a>). Upload and activate the plugin. Under &#8220;Settings&#8221; you will have a new tab: &#8220;WP Nonce&#8221;. On this screen you can set a check box and some text.</p>
<p>Unfortunately, this is not really secure, because it doesn&#8217;t check any credentials. Lets add some. To create a nonce, we&#8217;ll be using the <code>wp_create_nonce($action)</code> function. The <code>$action</code> parameter is optional, but without it the system is not nearly as secure. <code>$action</code> is a string, and you should create a unique <code>$action</code> for each different action which you will create</p>
<p>Open up wpn.admin.php. On line 61, add:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;input name=&quot;wpn-update_settings&quot; type=&quot;hidden&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> wp_create_nonce<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wpn-update_setting'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;</pre></div></div>

<p>This creates a hidden form field with the name <code>wpn-update_settings</code> and places a custom nonce in the value field. If you save the page, refresh, and examine the source, you&#8217;ll see the nonce in a hidden form field down at the bottom. Of course, we&#8217;re not actually checking it right now, so it&#8217;s not much use at the moment.</p>
<p>It&#8217;s easy enough to start checking the nonce, however. We use the companion to the <code>wp_create_nonce($action)</code> function, <code>wp_verify_nonce($nonce, $action)</code>. Like <code>wp_create_nonce</code>, <code>wp_verify_nonce</code> does not explicitly require the <code>$action</code> parameter, however, whatever <code>$action</code> parameter was used to create the nonce must also be used for successful verification.</p>
<p>Back to wpn.admin.php. Replace lines 13 and 14 with:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wpn-update_settings'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hmm ..., looks like you didn't send any credentials&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>wp_verify_nonce<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wpn-update_settings'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'wpn-update_settings'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hmm ..., looks like you didn't send the right credentials&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Go ahead and save the page. Visit it and update the options.</p>
<p>Well, that didn&#8217;t work! If you copied and pasted exactly what I wrote above, you get the error:</p>
<blockquote><p>Hmm &#8230;, looks like you didn&#8217;t send the right credentials</p></blockquote>
<p>The eagle eyed among you will notice that on line 61, we created a nonce with the <code>$action</code> of &#8216;wp-update-setting&#8217;, but everywhere else, including in <code>wp_verify_nonce</code>, we used &#8216;wp-update-setting<em><strong>s</strong></em>&#8216;.</p>
<p>Update wpn.admin.php, line 61 to:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;input name=&quot;wpn-update_settings&quot; type=&quot;hidden&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> wp_create_nonce<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wpn-update_settings'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;</pre></div></div>

<p>Lo and behold, it works!</p>
<p>If your wpn.admin.php isn&#8217;t working, a working version with all the changes made in the part is also in the plugin folder at wpn.admin.final.php. You can rename this to wpn.admin.php to make the plugin work.</p>
<h3>More:</h3>
<ul>
<li><a href="http://compu.terlicio.us/2008/05/stopping-nonces-part-0/">Part 0 &#8212; Background</a></li>
<li><strong>Part 1 &#8212; Basic Nonce Usage</strong></li>
</ul>
<p><a href="http://compu.terlicio.us/tutorials/wpn">WordPress Nonce Tutorial Home</a></p>
]]></content:encoded>
			<wfw:commentRss>http://compu.terlicio.us/2008/05/stopping-nonces-part-1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Stopping nonces with a WordPress NONCE: Part 0 &#8212; Background</title>
		<link>http://compu.terlicio.us/2008/05/stopping-nonces-part-0/</link>
		<comments>http://compu.terlicio.us/2008/05/stopping-nonces-part-0/#comments</comments>
		<pubDate>Sat, 03 May 2008 21:03:39 +0000</pubDate>
		<dc:creator>Christopher O'Connell</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[Plug-ins]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://compu.terlicio.us/?p=48</guid>
		<description><![CDATA[It is with depressing frequency that blogs get hacked. Even with relatively secure software, like WordPress, it happens all to often. The ability to create plugins, and moreover, the recent fascination with adding AJAX type interfaces to the WordPress administration areas has resulted in a proliferation of ‘unsafe’ plugins which have the potential to provide [...]]]></description>
			<content:encoded><![CDATA[<p>It is with depressing frequency that blogs get hacked. Even  with relatively secure software, like WordPress, it happens all to often. The  ability to create plugins, and moreover, the recent fascination with adding  AJAX type interfaces to the WordPress administration areas has resulted in a  proliferation of ‘unsafe’ plugins which have the potential to provide  unfettered access to hackers.</p>
<p>Fortunately, WordPress supports Numbers used ONCE (nonce) as  a way of keeping nonces (pedophiles, hackers, and people who talk at the  theater) out. Follow along as I show you how to keep your plugin from being the  door to hackers.<br />
<span id="more-48"></span><br />
Since early in the version 2 branch wordpress has supported  nonces, unfortunately, the resources on using them effectively are all too  scarce. In actuality, they are quite easy and simple to use.</p>
<p>According to Wikipedia, a <a title="Crytographic nonce" href="http://en.wikipedia.org/wiki/Cryptographic_nonce">Crytographic nonce</a>:</p>
<blockquote><p>[Is] a <a title="Randomness" href="http://en.wikipedia.org/wiki/Randomness">random</a> or <a title="Pseudo-random" href="http://en.wikipedia.org/wiki/Pseudo-random">pseudo-random</a> number issued in an <a title="Authentication protocol" href="http://en.wikipedia.org/wiki/Authentication_protocol">authentication protocol</a> to ensure that old communications cannot be reused in <em><a title="Replay attack" href="http://en.wikipedia.org/wiki/Replay_attack">replay attacks</a></em>. &#8230; To ensure that a nonce is used only once, it should be time-variant (including a suitably granular <a title="Timestamp" href="http://en.wikipedia.org/wiki/Timestamp">timestamp</a> in its value), or generated with enough random bits to ensure a  probabilistically insignificant chance of repeating a previously  generated value.</p></blockquote>
<p>In WordPress terms, a nonce is either an <a title="HMAC at Wikipedia" href="http://en.wikipedia.org/wiki/HMAC">md5 HMAC</a> or a plain <a title="MD5 at Wikipedia" href="http://en.wikipedia.org/wiki/MD5">md5</a> hash. In general a WP nonce is valid for twelve hours but expires after 24 hours. Thus the current <em>or</em> previous nonce may both be used. While the <code>wp_generate_nonce($action)</code> function includes several internal components to make the nonce more secure, it also allows the developer to specify an <em>action</em> for the nonce. An action is simply a string which is included in the hash calculation. By creating a separate action for each edit page, etc., a hacker needs to intercept the nonce specific to the action they wish to perform. Thus, even if they intercept a nonce, there is only one (or a very limited number) of nefarious actions which they can perform.</p>
<h3>More:</h3>
<ul>
<li><strong>Part 0 &#8212; Background</strong></li>
<li><a href="http://compu.terlicio.us/2008/05/stopping-nonces-part-1/">Part 1 &#8212; Basic Nonce Usage</a></li>
</ul>
<p><a href="http://compu.terlicio.us/tutorials/wpn">WordPress Nonce Tutorial Home</a></p>
]]></content:encoded>
			<wfw:commentRss>http://compu.terlicio.us/2008/05/stopping-nonces-part-0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>&#181;Audio 0.3 Released</title>
		<link>http://compu.terlicio.us/2008/05/audio-03-released/</link>
		<comments>http://compu.terlicio.us/2008/05/audio-03-released/#comments</comments>
		<pubDate>Fri, 02 May 2008 04:42:00 +0000</pubDate>
		<dc:creator>Christopher O'Connell</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Flying]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[audio player]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[micro-audio]]></category>
		<category><![CDATA[Plug-ins]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[wordpress.org]]></category>
		<category><![CDATA[µAudio]]></category>

		<guid isPermaLink="false">http://compu.terlicio.us/?p=47</guid>
		<description><![CDATA[Well, if you were lucky, you missed the entire disaster that was the &#181;Audio 0.2 releases. If not, sorry! A new, improved and very throughly tested 0.3 branch is out. Check out my µAudio page, or head over to µAudio at wordpress.org for a copy of your very own. Thanks to WordPress.org user jonner for [...]]]></description>
			<content:encoded><![CDATA[<p>Well, if you were lucky, you missed the entire disaster that was the &micro;Audio 0.2 releases. If not, sorry!</p>
<p>A new, improved and <em>very</em> throughly tested 0.3 branch is out. Check out <a href="http://compu.terlicio.us/code/plugins/audio/">my µAudio page</a>, or head over to <a href="http://wordpress.org/extend/plugins/microaudio/">µAudio at wordpress.org</a> for a copy of your very own.</p>
<p>Thanks to WordPress.org user <strong>jonner</strong> for pointing out a couple of bugs.</p>
]]></content:encoded>
			<wfw:commentRss>http://compu.terlicio.us/2008/05/audio-03-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

