<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Code Garage Blog</title>
	
	<link>http://codegarage.com/blog</link>
	<description />
	<lastBuildDate>Tue, 27 Sep 2011 16:39:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/CodeGarage" /><feedburner:info uri="codegarage" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>The WordPress $Post Object and You</title>
		<link>http://feedproxy.google.com/~r/CodeGarage/~3/3JRNT66VX6o/</link>
		<comments>http://codegarage.com/blog/2011/09/the-wordpress-post-object-and-you/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 21:59:17 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Functions]]></category>
		<category><![CDATA[The Loop]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[get_post()]]></category>
		<category><![CDATA[post object]]></category>

		<guid isPermaLink="false">http://codegarage.com/blog/?p=384</guid>
		<description><![CDATA[Ah, fair $post object. Lets talk about how great you are. The What What? Post Object. WordPress stores all post data (think content, author, tags, etc) in a single object, accessible to themes and plugins on each page load. Basically, this is the place you&#8217;re going to go to if you want to get some ...]]></description>
			<content:encoded><![CDATA[<p>Ah, fair $post object.  Lets talk about how great you are.</p>
<h2>The What What?</h2>
<p>Post Object.  WordPress stores all post data (think content, author, tags, etc) in a single object, accessible to themes and plugins on each page load. Basically, this is the place you&#8217;re going to go to if you want to get some extra information about a post for whatever clever scheme you&#8217;ve got cooked up. Need to know how many &#8220;n&#8221;s are in this particular post?  Talk to the post object.  Not sure when this post was originally published?  Post object.  Looking for lawyers who ride?  Now we&#8217;re talking &#8211; but you want the <a href="http://www.lawtigers.com/">Law Tigers</a>, not the $post object.  Watch their commercials.  You won&#8217;t regret it.</p>
<h2>How do I get at this mystical post object?</h2>
<h3>Single Posts</h3>
<p>The post object is available nearly everywhere you&#8217;re likely to be looking at a post.  If you&#8217;re working with a single post page, or an actual page, you&#8217;ve got access to that post&#8217;s (or page&#8217;s) post object anywhere within your theme file.  It&#8217;s all held in a variable named $post.</p>
<h3>Multiple Posts</h3>
<p>If you&#8217;re on a page with multiple posts, things are a little trickier but not much.  If you&#8217;re inside the loop, you&#8217;ve got access to a $post object (named $post) referring to the <strong>current</strong> post in the loop.</p>
<h3>Elsewhere</h3>
<p>What if you want to get at a post that <strong>isn&#8217;t</strong> the one you&#8217;re looking at on a particular page &#8211; or what if you want to get at one from a plugin, or somewhere where there isn&#8217;t a current post explicitly defined? There&#8217;s a function for that:</p>
<pre class="brush: php">
$id = 41;
$mypost = get_post($id);
print_r($mypost);
</pre>
<p>get_post() to the rescue!  There are, however, a couple of gotchas with get_post. </p>
<ol>
<li><strong>You have to pass it a variable &#8211; not an integer</strong>.  See how in the example above, I set $id to 41, an then used $id as the argument to get_post(), instead of just saying get_post(41)?  That&#8217;s important.  If you try to pass an integer to get_post(), it will blow up.  No Joke.</li>
<li><strong>You probably shouldnt use the variable $post.</strong>  Why not?  Because WordPress uses $post all the time, and chances are you&#8217;ll either overwrite WordPress&#8217; version of $post, or they&#8217;ll overwrite yours &#8211; either way, somebody is going to be mad.  Choose something more clever than $post (like $mypost!).  I know you can do it.</li>
</ol>
<h3>What if I don&#8217;t like getting the data back as an object?  I&#8217;m an associative array kind of guy.</h3>
<p>get_post() gets you.  So do I.  There&#8217;s a second, optional argument to get_post that determines what it spits out at you.  It defaults to OBJECT, but you can also pass in ARRAY_A, or ARRAY_N to get an associative array or a numeric array version of the post data.</p>
<h2>Ok, I&#8217;ve got a post object &#8211; what kind of data is in there?</h2>
<p>Find out for yourself!  The snippet above uses the function <strong>print_r()</strong> &#8211; it will show you the structure AND data of a particular post object &#8211; very useful stuff.  Surround it in a &lt;pre&gt; tag, and you&#8217;ll be in even better shape &#8211; it will display nicely in your browser.</p>
<h3>I&#8217;m too lazy for that.  Didn&#8217;t I come here for <strong>you</strong> to teach <strong>me</strong> about this?</h3>
<p>Well played.  Here&#8217;s a quick rundown on the data the post object gives you:</p>
<table class="small">
<thead>
<tr>
<th>Property</th>
<th>Example</th>
<th>Explanation</th>
</tr>
</thead>
<tr>
<td>$post->post_title</td>
<td>The WordPress $Post Object and You</td>
<td>Title of post.</td>
</tr>
<tr>
<td>$post->post_excerpt</td>
<td>Learn about the WordPress $Post object!</td>
<td><strong>Manually created</strong> post excerpt.  If you didn&#8217;t purposefully create an excerpt on the add post page, you&#8217;re not getting anything here.</td>
</tr>
<tr>
<td>$post->post_status</td>
<td>
<ul>
<li>publish</li>
<li>pending</li>
<li>draft</li>
<li>auto-draft</li>
<li>future</li>
<li>private</li>
<li>inherit</li>
<li>trash</li>
</ul>
</td>
<td>Current status of the post.</td>
</tr>
<tr>
<td>$post->comment_status</td>
<td>
<ul>
<li>open</li>
<li>closed</li>
<li>registered_only</li>
</ul>
</td>
<td>Comment status for this particular post.</td>
</tr>
<tr>
<td>$post->ping_status</td>
<td>
<ul>
<li>open</li>
<li>closed</li>
</ul>
</td>
<td>Does the current post accept pingbacks and trackbacks?</td>
</tr>
<tr>
<td>$post->post_password</td>
<td>
123456
</td>
<td>The plaintext password for this post, if there is one.  Empty otherwise.</td>
</tr>
<tr>
<td>$post->post_name</td>
<td>
the-wordpress-post-object-and-you
</td>
<td>A normalized, sanitized version of the post title, used to generate pretty permalinks.</td>
</tr>
<tr>
<td>$post->to_ping</td>
<td>
http://technorati.com http://someothersitetoping.com
</td>
<td>Space separated list of sites to ping <strong>which have not been pinged yet</strong>.  Modified by &#8220;Send Trackbacks&#8221; field on add post page.</td>
</tr>
<tr>
<td>$post->pinged</td>
<td>
http://technorati.com http://someothersitetoping.com
</td>
<td>Space separated list of sites already pinged for this post.</td>
</tr>
<tr>
<td>$post->post_modified</td>
<td>
2011-09-15 21:21:59
</td>
<td>Time this post was last modified, based on local server time. MySQL timestamp format.</td>
</tr>
<tr>
<td>$post->post_modified_gmt</td>
<td>
2011-09-15 21:21:59
</td>
<td>Time this post was last modified, based on GMT timezone. MySQL timestamp format.</td>
</tr>
<tr>
<td>$post->post_content_filtered</td>
<td>
Post Content
</td>
<td>This field is designed to hold a version of the post for caching, in situations where filters are being run on the post that are &#8220;expensive&#8221; (slow), and undesireable to run every time.  Not used in WP core, may be used by plugins.</td>
</tr>
<tr>
<td>$post->post_parent</td>
<td>
0
</td>
<td>ID of the parent post.  Posts that have parents are generally revisions, or attachments.  If the post_parent is 0, this is a bona-fide, original post.</td>
</tr>
<tr>
<td>$post->guid</td>
<td>
<p>http://codegarage.com/blog/?p=41</p>
</td>
<td>Global Unique Identifier for the post.  According to the documentation page on wordpress.org, this can&#8217;t be relied on to actually work as a link to the post, but I&#8217;m not totally sure why.  Maybe in cases where the site url has changed?</td>
</tr>
<tr>
<td>$post->menu_order</td>
<td>
0
</td>
<td>Integer determining the order in a list of posts.  Generally used for pages in menus, but can be used by plugins for special ordering.</td>
</tr>
<tr>
<td>$post->post_type</td>
<td>
<ul>
<li>post</li>
<li>page</li>
<li>attachment</li>
</ul>
</td>
<td>The particular type of post this is.  Attachments are generally images, pdfs, etc.  Posts and pages are self explanatory.</td>
</tr>
<tr>
<td>$post->mime_type</td>
<td>
image/png
</td>
<td>Mime type for attachments.</td>
</tr>
<tr>
<td>$post->comment_count</td>
<td>
14
</td>
<td>Number of comments on this post currently.</td>
</tr>
<tr>
<td>$post->post_ancestors</td>
<td>
array
</td>
<td>Array of parent posts for this post.</td>
</tr>
</table>
<h2>Whew!</h2>
<p>I think that about covers it.  One last question you might have:<br />
<a href="http://codegarage.com/blog/2009/05/how-to-display-properly-formatted-content-from-a-post-object-in-wordpress/" title="How to Display Properly Formatted Content From a $post Object in WordPress">How do I get WordPress to spit out properly formatted post content?</a></p>
<p>Good luck!</p>
<img src="http://feeds.feedburner.com/~r/CodeGarage/~4/3JRNT66VX6o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/09/the-wordpress-post-object-and-you/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://codegarage.com/blog/2011/09/the-wordpress-post-object-and-you/</feedburner:origLink></item>
		<item>
		<title>WordPress Timthumb.php Vulnerability Scanner Plugin</title>
		<link>http://feedproxy.google.com/~r/CodeGarage/~3/dyxPUYdqllM/</link>
		<comments>http://codegarage.com/blog/2011/09/wordpress-timthumb-vulnerability-scanner-plugin/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 20:20:47 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Plugin Releases]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[cleanup]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[timthumb]]></category>
		<category><![CDATA[Upgrade]]></category>

		<guid isPermaLink="false">http://codegarage.com/blog/?p=373</guid>
		<description><![CDATA[Over the past few weeks, I&#8217;ve been absolutely inundated with requests to clean up hacks that have exploited the much publicized Timthumb.php vulnerability. I have to assume that the reason most people aren&#8217;t plugging up this security hole on their sites is either They don&#8217;t feel confident in their ability to find the problem They ...]]></description>
			<content:encoded><![CDATA[<p><object width="620" height="349"><param name="movie" value="http://www.youtube.com/v/MFt_XmCMAfI?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/MFt_XmCMAfI?version=3" type="application/x-shockwave-flash" width="620" height="349" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Over the past few weeks, I&#8217;ve been absolutely inundated with requests to clean up hacks that have exploited the much publicized <a href="http://codegarage.com/blog/2011/08/how-to-clean-up-the-timthumb-security-vulnerability/" title="How to Clean Up the TimThumb Security Vulnerability">Timthumb.php vulnerability</a>.  I have to assume that the reason most people aren&#8217;t plugging up this security hole on their sites is either </p>
<ol>
<li>They don&#8217;t feel confident in their ability to find the problem</li>
<li>They feel like the process to fix it is too complicated</li>
</ol>
<p>To combat this, I took a couple of hours this morning to write a plugin that will do the dirty work for you.  The WordPress Timthumb Vulnerability Scanner will check your entire wp-content directory (including all themes, plugins, and uploads) for any vulnerable (pre-2.0) instances of the timthumb script, and give you a one-click upgrade to upgrade each script to the latest, secure version.</p>
<h3>The process is simple:</h3>
<ol>
<li>Download the plugin here:<br />
<a href="http://wordpress.org/extend/plugins/timthumb-vulnerability-scanner/">http://wordpress.org/extend/plugins/timthumb-vulnerability-scanner/</a></li>
<li>Install and activate using either FTP, or the built in WordPress uploader<a href="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-02-at-2.03.16-PM.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-02-at-2.03.16-PM-680x484.png" alt="" title="Install the plugin" width="600" height="427" class="aligncenter size-large wp-image-374" /></a></li>
<li>Go to the &#8220;Timthumb Scanner&#8221; page, under the &#8220;Tools&#8221; menu</li>
<li><a href="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-02-at-2.12.14-PM.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-02-at-2.12.14-PM-680x484.png" alt="" title="Plugin Page" width="600" height="427" class="aligncenter size-large wp-image-375" /></a><br />
Click the &#8220;Scan&#8221; button.</p>
<li>View your scan results<br />
<a href="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-02-at-2.14.55-PM.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-02-at-2.14.55-PM-680x484.png" alt="" title="Screen Shot 2011-09-02 at 2.14.55 PM" width="600" height="427" class="aligncenter size-large wp-image-377" /></a><br />
In this case, I&#8217;ve got one vulnerable (outdated) file, and 2 that have been updated, and are safe.  I&#8217;m going to want to upgrade that one vulnerable file &#8211; to do that, I just need to hit the &#8220;Fix&#8221; button next to it.<br />
You may not have any instances of timthumb on your site, or all of yours may be upgraded &#8211; if so, you&#8217;re all done!</li>
<li>After hitting &#8220;Fix&#8221; for my one problem file, I&#8217;m showing &#8220;No Vulnerabilities Found&#8221;, which means I&#8217;m all set.</li>
</ol>
<p>Just like that, you&#8217;re done.  Quick and painless.</p>
<p>Note: If you&#8217;ve already been hacked, this will NOT clean up your site.  This plugin fixes your door lock &#8211; which doesn&#8217;t matter if the burglars are already in your house.</p>
<p>Let me know of any problems or questions you have in the comments.</p>
<p>Good luck!</p>
<p><strong>EDIT</strong><br />
Looking for a solution to scan a whole server, or a site not running on WordPress?  By sort-of-popular demand, here it is:<br />
<a href="http://codegarage.com/plugins/timthumb-full-server-vulnerability-scanner.zip">http://codegarage.com/plugins/timthumb-full-server-vulnerability-scanner.zip</a><br />
It&#8217;s much less polished, and much less tested, so use at your own risk.</p>
<img src="http://feeds.feedburner.com/~r/CodeGarage/~4/dyxPUYdqllM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/09/wordpress-timthumb-vulnerability-scanner-plugin/feed/</wfw:commentRss>
		<slash:comments>84</slash:comments>
		<feedburner:origLink>http://codegarage.com/blog/2011/09/wordpress-timthumb-vulnerability-scanner-plugin/</feedburner:origLink></item>
		<item>
		<title>Can I Just Replace My Old timthumb.php File With the New Version?</title>
		<link>http://feedproxy.google.com/~r/CodeGarage/~3/KPCmvGddit8/</link>
		<comments>http://codegarage.com/blog/2011/09/can-i-just-replace-my-old-timthumb-php-file-with-the-new-version/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 15:48:26 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codegarage.com/blog/?p=354</guid>
		<description><![CDATA[First things first: Yes, you can just replace your old timthumb.php file with the new version of timthumb, found here. If that&#8217;s all you were after, move along &#8211; if you want a little more explanation, read on: With all of the hubbub around the recent timthumb vulnerability, lots of people are looking for some ...]]></description>
			<content:encoded><![CDATA[<p>First things first:  Yes, you can just replace your old timthumb.php file with the new version of timthumb, found <a href="http://timthumb.googlecode.com/svn-history/r136/trunk/timthumb.php">here</a>.  If that&#8217;s all you were after, move along &#8211; if you want a little more explanation, read on:</p>
<p><object width="620" height="374"><param name="movie" value="http://www.youtube.com/v/C9zdv3M-Cpg?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/C9zdv3M-Cpg?version=3" type="application/x-shockwave-flash" width="620" height="374" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>With all of the hubbub around the recent <a href="http://codegarage.com/blog/2011/08/how-to-clean-up-the-timthumb-security-vulnerability/" title="How to Clean Up the TimThumb Security Vulnerability">timthumb vulnerability</a>, lots of people are looking for some easy instructions on how to get it taken care of.  You should be, because I&#8217;ve cleaned up more hacks in the past 2 weeks related to this vulnerability than I have in the last 2 months &#8211; people ARE getting hacked due to this.</p>
<p>Unfortunately, if you&#8217;re not totally comfortable with code, upgrading this file can be a little scary.  Good news, I&#8217;m here to help.</p>
<h2>How do I know if I&#8217;m using timthumb?</h2>
<p>This one isn&#8217;t too hard &#8211; the easiest way to figure this out is to use a scanner of some sort to search your server for the timthumb script.  I&#8217;ve written a <a href="http://codegarage.com/blog/2011/09/wordpress-timthumb-vulnerability-scanner-plugin/">timthumb scanner that runs as a WordPress Plugin</a> &#8211; you can find that <a href="http://codegarage.com/blog/2011/09/wordpress-timthumb-vulnerability-scanner-plugin/">here</a>.</p>
<p>If you&#8217;re not comfortable with that process, you might be able to just give your blog a once over and figure it out yourself.  Are you showing thumbnails on the homepage?  If so, you might be using timthumb.  Right click one of the thumbnails, and click &#8220;open image in new tab&#8221; (or the equivalent &#8211; that&#8217;s what it says on chrome on a mac).<br />
<a href="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-01-at-9.34.36-AM.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-01-at-9.34.36-AM-680x289.png" alt="" title="Open in new tab" width="600" height="255" class="aligncenter size-large wp-image-358" /></a>In the new tab that opens, check out the url bar &#8211; does it say timthumb.php anywhere in the url (check the text right before the question mark, if there is one)?  Note &#8211; this might also just say &#8220;thumb.php&#8221;<br />
<a href="http://codegarage.com/blog/wp-content/uploads/2011/09/timthumb_url.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/09/timthumb_url-680x84.png" alt="" title="timthumb_url" width="600" height="74" class="aligncenter size-large wp-image-355" /></a></p>
<h2>How do I know if my timthumb script is vulnerable?</h2>
<p><a href="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-01-at-9.41.16-AM.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-01-at-9.41.16-AM.png" alt="" title="Screen Shot 2011-09-01 at 9.41.16 AM" width="213" height="102" class="aligncenter size-full wp-image-363" /></a>Fortunately, this one is pretty easy.  Open up the file in the wordpress theme editor, or using FTP (it&#8217;s probably in your theme directory, called timthumb.php or thumb.php &#8211; the previous step should tell you that).  Look for this code, near the top:</p>
<pre class="brush: php">

// external domains that are allowed to be displayed on your website
$allowedSites = array (
	&#039;flickr.com&#039;,
	&#039;picasa.com&#039;,
	&#039;blogger.com&#039;,
	&#039;wordpress.com&#039;,
	&#039;img.youtube.com&#039;,
	&#039;upload.wikimedia.org&#039;,
);

// STOP MODIFYING HERE!
// --------------------
</pre>
<p>To clarify (or make things more confusing):  If you see this:</p>
<pre class="brush: php">
// If ALLOW_EXTERNAL is true and ALLOW_ALL_EXTERNAL_SITES is false, then external images will only be fetched from these domains and their subdomains.
if(! isset($ALLOWED_SITES)){
	$ALLOWED_SITES = array (
			&#039;flickr.com&#039;,
			&#039;picasa.com&#039;,
			&#039;img.youtube.com&#039;,
			&#039;upload.wikimedia.org&#039;,
			&#039;photobucket.com&#039;,
			&#039;imgur.com&#039;,
			&#039;imageshack.us&#039;,
			&#039;tinypic.com&#039;
	);
}
// -------------------------------------------------------------
// -------------- STOP EDITING CONFIGURATION HERE --------------
// -------------------------------------------------------------
</pre>
<p>You&#8217;re ok.  $allowedSites = Bad, $ALLOWED_SITES = Good.  For another way to check, if you look up near the top of the file and see this:</p>
<pre class="brush: php">
define (&#039;VERSION&#039;, &#039;2.8&#039;);										// Version of this script
</pre>
<p>You&#8217;re good.  Version 2.0 and greater are safe to use.</p>
<p>If it doesnt look like you&#8217;re using the right version, it&#8217;s time to clean it up!</p>
<h2>How do I fix it?</h2>
<p>400 words later, we finally get back to the question posed in the title.  Can I just replace the old, vulnerable code with new, safe code, and have everything still work?  Yes, you can.<br />
From the previous step, you&#8217;ve got the file open in your WordPress theme editor.  All you need to do is replace the entire contents of the file with the code found here:</p>
<p>http://timthumb.googlecode.com/svn/trunk/timthumb.php</p>
<p>Save the file, and you&#8217;re done!  Your thumbnails still work, and you can sleep a little easier at night.</p>
<p><strong>Plug Time</strong>: I do this service for subscribers to my <a href="http://codegarage.com/">WordPress backup and security monitoring service</a> &#8211; so if you&#8217;re not sure you want to take it on yourself, have a look <a href="http://codegarage.com/">here</a>.  If you just have a question, or need some guidance, I&#8217;m happy to give that away for free.  Get in touch with me at <a href="peter@codegarage.com">peter@codegarage.com</a>.  Good luck!</p>
<img src="http://feeds.feedburner.com/~r/CodeGarage/~4/KPCmvGddit8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/09/can-i-just-replace-my-old-timthumb-php-file-with-the-new-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://codegarage.com/blog/2011/09/can-i-just-replace-my-old-timthumb-php-file-with-the-new-version/</feedburner:origLink></item>
		<item>
		<title>Upgrading or Uploading WordPress Via FTP</title>
		<link>http://feedproxy.google.com/~r/CodeGarage/~3/Z-WocMh60Vc/</link>
		<comments>http://codegarage.com/blog/2011/08/upgrading-or-uploading-wordpress-via-ftp/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 19:21:04 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Filezilla]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[Upgrade]]></category>

		<guid isPermaLink="false">http://codegarage.com/blog/?p=338</guid>
		<description><![CDATA[Yesterday we talked about how to access your WordPress site via FTP &#8211; today, we&#8217;ll talk about something more important: Upgrading or reinstalling WordPress using FTP instead of the WordPress backend. Why? Again &#8211; this all comes down to saving your own butt. If an automatic upgrade fails in the middle, you&#8217;re in trouble &#8211; ...]]></description>
			<content:encoded><![CDATA[<p><object width="620" height="490"><param name="movie" value="http://www.youtube.com/v/nQ0qJ3UYpQ8?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/nQ0qJ3UYpQ8?version=3" type="application/x-shockwave-flash" width="620" height="490" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Yesterday we talked about how to <a href="http://codegarage.com/blog/2011/08/wordpress-ftp-access-not-as-scary-as-it-sounds/" title="WordPress FTP Access:  Not as Scary as it Sounds">access your WordPress site via FTP</a> &#8211; today, we&#8217;ll talk about something more important:  Upgrading or reinstalling WordPress using FTP instead of the WordPress backend.</p>
<h3>Why?</h3>
<p>Again &#8211; this all comes down to saving your own butt.  If an automatic upgrade fails in the middle, you&#8217;re in trouble &#8211; chances are that some, but not all of the files necessary have been reinstalled/updated.  Because of this, the Dashboard is often left inaccessible, and you have to fall back on your old friend FTP.</p>
<p>Other reasons you might do this:</p>
<ol>
<li>You got hacked, and you want to make sure your core WP files are clean.</li>
<li>You started tinkering with Core WordPress files, and now the site doesn&#8217;t work</li>
<li>You uploaded a shady plugin which modified core WordPress files, and now the site doesn&#8217;t work</li>
</ol>
<h3>Public Service Announcement</h3>
<p>Back up your site before you do this.  Please.  If you mess it up, and lose all your uploads, you&#8217;re going to be really mad, maybe at me.  Don&#8217;t have a backup service?  Good news &#8211; I have one that I can shamelessly plug.  Check it out at <a href="http://codegarage.com/">the front page</a>.</p>
<p>Lets get to it.  Since we already understand how to <a href="http://codegarage.com/blog/2011/08/wordpress-ftp-access-not-as-scary-as-it-sounds/">access WordPress via FTP</a>, we can get started without fear.</p>
<h3>Step 1:  Download WordPress</h3>
<p>WordPress.org has a handy feature:  the latest version of WordPress is always available at:</p>
<p><a href="http://wordpress.org/latest.zip">http://wordpress.org/latest.zip</a></p>
<p>  If you ever need a copy, just enter that address in the url, and it will start downloading.  The more traditional page for finding your download is here:</p>
<p><a href="http://wordpress.org/download/">http://wordpress.org/download/</a></p>
<p>Need an old version of WordPress?  They&#8217;re nice enough to keep those around too:</p>
<p><a href="http://wordpress.org/download/release-archive/">http://wordpress.org/download/release-archive/</a></p>
<p>So you&#8217;ve downloaded the version of WordPress you need.  Good work!</p>
<h3>Step 2: Unzip it</h3>
<p>Next, you need to extract the zip you downloaded.  Hopefully this isn&#8217;t too tricky &#8211; as long as you know where your downloads end up.  In most cases, it&#8217;s as simple as finding the zip file and double clicking it.  You should end up with a folder titled &#8220;WordPress&#8221;, which has the entirety of a WordPress install inside of it.<br />
<a href="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-17-at-10.59.45-AM.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-17-at-10.59.45-AM-680x459.png" alt="" title="Extracted WordPress Folder" width="600" height="405" class="aligncenter size-large wp-image-342" /></a></p>
<h3>Step 3: Upload it</h3>
<p>All that&#8217;s left is to upload.  Now &#8211; you need to take some special consideration before you just go uploading all these files.  Make sure you&#8217;re:</p>
<ul>
<li>Uploading the right things</li>
<li>To the right place</li>
<ul>
Simple, right?  Here&#8217;s what we need to do:  We want to upload the <strong>contents</strong> of the WordPress folder (which we just extracted) to the directory on our web server where wordpress is installed, with one important caveat:</p>
<h4>We don&#8217;t want to overwrite wp-content</h4>
<p>That deserved to be bolded.  The wp-content folder holds your themes, plugins, and uploads &#8211; and we don&#8217;t want to overwrite it with the default wordpress content.  So, we&#8217;re going to upload everything <strong>except</strong> that.<br />
<div id="attachment_344" class="wp-caption aligncenter" style="width: 610px"><a href="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-17-at-11.07.12-AM.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-17-at-11.07.12-AM-680x459.png" alt="" title="Selecting Files to upload" width="600" height="405" class="size-large wp-image-344" /></a><p class="wp-caption-text">Upload Everything BUT wp-content</p></div><br />
Now that we&#8217;re ready to upload, we&#8217;ll just click and drag that mess into filezilla &#8211; making sure that in filezilla, we&#8217;re looking at the current wordpress install (you should be looking at the inside of a directory that has wp-load.php in it).<br />
<a href="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-17-at-11.10.24-AM.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-17-at-11.10.24-AM-680x496.png" alt="" title="Upload Here" width="600" height="437" class="aligncenter size-large wp-image-345" /></a><br />
When it asks if you&#8217;d like to overwrite files, go ahead and check &#8220;Overwite&#8221;, as well as &#8220;Always use this action&#8221; and click &#8220;Ok&#8221;.  Before clicking &#8220;Ok&#8221; would be a good time to double check that you&#8217;ve backed up, adn you&#8217;re not overwriting wp-content.</p>
<p>Now, this is going to take a while &#8211; WordPress has a lot of files.  Go eat a sandwich, it will be done when you get back.</p>
<h3>All done.  Now what?</h3>
<p>Now head back over to your site and get a feel for your handiwork.  If you were just trying to fix a problem, ideally at this point your site is working again.  If the upload went ok, and your site <strong>still isn&#8217;t working</strong>, the problem lies somewhere else &#8211; check your plugins and themes if you haven&#8217;t already.</p>
<p>If you were doing this to upgrade your WordPress install, you&#8217;ve got one more step.  Head over to yoursite.com/wp-admin, and you should be presented with a screen saying you need to upgrade your database.  Go ahead and approve that, give it a minute to think, and you should be redirected to the login page &#8211; and you&#8217;re done!</p>
<img src="http://feeds.feedburner.com/~r/CodeGarage/~4/Z-WocMh60Vc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/08/upgrading-or-uploading-wordpress-via-ftp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://codegarage.com/blog/2011/08/upgrading-or-uploading-wordpress-via-ftp/</feedburner:origLink></item>
		<item>
		<title>WordPress FTP Access:  Not as Scary as it Sounds</title>
		<link>http://feedproxy.google.com/~r/CodeGarage/~3/IwNuN8N8bgE/</link>
		<comments>http://codegarage.com/blog/2011/08/wordpress-ftp-access-not-as-scary-as-it-sounds/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 23:27:03 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://codegarage.com/blog/?p=324</guid>
		<description><![CDATA[What is FTP? FTP is short for File Transfer Protocol. Pretty self explanatory &#8211; you have files on your computer, you want them on your website, so you transfer them. FTP facilitates this. When and Why do I need to use it? Like I said, WordPress continues it&#8217;s relentless path toward becoming completely free of ...]]></description>
			<content:encoded><![CDATA[<p><object width="620" height="374"><param name="movie" value="http://www.youtube.com/v/XHzO-iPm4fM?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/XHzO-iPm4fM?version=3" type="application/x-shockwave-flash" width="620" height="374" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<h3>What is FTP?</h3>
<p>FTP is short for <strong>File Transfer Protocol</strong>.  Pretty self explanatory &#8211; you have files on your computer, you want them on your website, so you transfer them.  FTP facilitates this.</p>
<h3>When and Why do I need to use it?</h3>
<p>Like I said, WordPress continues it&#8217;s relentless path toward becoming completely free of scary acronyms like FTP, but there are still times when you need it &#8211; mostly when things go wrong:</p>
<ul>
<li>Your WordPress site broke during an upgrade, now you can&#8217;t get in.</li>
<li>You&#8217;ve got a broken plugin that has made your site inaccessible</li>
<li>You were tinkering with your theme, and now you&#8217;ve got a big error message on every page of your site &#8211; or worse, just a <strong>scary blank screen</strong></li>
<li>You keep getting errors and notices about &#8220;Permissions&#8221; issues</li>
</ul>
<h3>Ok, so Maybe I Need It.  Now what?</h3>
<p><strong>Step 1:</strong> Get an FTP client.<br />
&#8220;FTP Client&#8221; is just nerdy talk for &#8220;Program you use to upload your files to your website&#8221;.  There are as many FTP clients as there are fish in the sea, but I&#8217;m just going to tell you to use <a href="http://filezilla-project.org/">FileZilla</a>, because it&#8217;s free, and easy to use.  Download and install it, and get back here.</p>
<p><strong>Step 2:</strong> Figure out your FTP credentials.<br />
More nerd speak &#8211; you just need the login and password (and maybe ftp url) your host gave you for FTP access.  This information is often in your &#8220;Welcome to your new hosting account&#8221; email.</p>
<p><strong>Step 3:</strong> Connect!<br />
Alright &#8211; fire up your FTP Client (See?  You&#8217;re talking like a real nerd! Drop that one on your boss.  He&#8217;ll give you a raise and a new job title.) In filezilla, we&#8217;re just going to use the &#8220;QuickConnect&#8221; bar &#8211; <a href="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-16-at-4.11.47-PM1.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-16-at-4.11.47-PM1-680x59.png" alt="" title="QuickConnect" width="600" height="52" class="aligncenter size-large wp-image-330" /></a><br />
<strong>Host</strong>: This is usually your site&#8217;s url (like codegarage.com), but sometimes it&#8217;s something different.  If it&#8217;s different, they&#8217;d have told you in the same place you found your username and password.  You did find your username and password already, right?<br />
<strong>Username</strong>:  Your username.  Take note:  you might have to include the domain name afterward, like an email address (like peter@codegarage.com).<br />
<strong>Password</strong>: Your Password.</p>
<p>Next stop, the &#8220;Quickconnect&#8221; button.  Go ahead, click it.  You&#8217;re not in a position to break anything.  Yet.</p>
<h3>You&#8217;re In!</h3>
<p>Hopefully.  If not, you&#8217;ve probably got one of those fields wrong &#8211; host, username, or password.  Do some tinkering.<br />
If you got in, you&#8217;ll see the window on the bottom right corner of the screen fill up with some folders (or maybe just a few).  These are the files on your server!  Go ahead, do some exploring.  When you&#8217;re ready to upload a file (send it from your computer to the website), just drag it on into that window on the right, and it will get sent to the website.<br />
<a href="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-16-at-4.16.33-PM1.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-16-at-4.16.33-PM1-680x483.png" alt="" title="Screen Shot 2011-08-16 at 4.16.33 PM" width="600" height="426" class="aligncenter size-large wp-image-331" /></a><br />
That&#8217;s it!  Good work!</p>
<img src="http://feeds.feedburner.com/~r/CodeGarage/~4/IwNuN8N8bgE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/08/wordpress-ftp-access-not-as-scary-as-it-sounds/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://codegarage.com/blog/2011/08/wordpress-ftp-access-not-as-scary-as-it-sounds/</feedburner:origLink></item>
		<item>
		<title>How to Change Your WordPress Table Prefix</title>
		<link>http://feedproxy.google.com/~r/CodeGarage/~3/8G3BQ9q30-4/</link>
		<comments>http://codegarage.com/blog/2011/08/how-to-change-your-wordpress-table-prefix/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 17:30:12 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[Table Prefix]]></category>

		<guid isPermaLink="false">http://codegarage.com/blog/?p=311</guid>
		<description><![CDATA[Lately, WordPress users seem to have had an increased interest in security &#8211; and with good reasons. Yesterday&#8217;s timthumb.php vulnerability, plus a slew of others in the past few months have really put most site owners on edge. Often it&#8217;s recommended that as a WordPress site owner, you change your WordPress database table prefix to ...]]></description>
			<content:encoded><![CDATA[<p>Lately, WordPress users seem to have had an increased interest in security &#8211; and with good reasons.  Yesterday&#8217;s timthumb.php vulnerability, plus a slew of others in the past few months have really put most site owners on edge.  </p>
<p>Often it&#8217;s recommended that as a WordPress site owner, you change your WordPress database table prefix to something other than wp_.  It&#8217;s not a bad idea &#8211; in certain situations, doing so might prevent a hacker from gaining more access to your site, or limit his destructive capability, and it&#8217;s a very easy thing to change.</p>
<h3>If You&#8217;re Installing WordPress</h3>
<p>If you&#8217;re installing WordPress, and you havent run through the install process, changing your table prefix is incredibly simple.  During the install process, just set the Table Prefix to anything you&#8217;d like:<br />
<img src="http://codegarage.com/blog/wp-content/uploads/2011/08/wp_prefix_change_install.png" alt="" title="wp_prefix_change_install" width="600" height="423" class="aligncenter size-full wp-image-314" /></p>
<h3>If You&#8217;ve Already Installed WordPress</h3>
<p>If you&#8217;ve already installed WordPress, you can still change your table prefix, but it&#8217;s a little more complicated.  You&#8217;re going to need to have access to your database through PHPMyAdmin or a similar system.</p>
<ol>
<li>First, open your wp-config.php file (You&#8217;ll need to download this via FTP, or get at it from your host&#8217;s file manager).  This file is usually located in the web root of your site.</li>
<li>Now, scan down until you see a line that starts with &#8216;$table_prefix&#8217;.  It will look something like this:
<pre class="brush: php">
/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each a unique
 * prefix. Only numbers, letters, and underscores please!
 */
$table_prefix  = &#039;wp_&#039;;
</pre>
<p>Change the value between the quotes (after the = sign) to whatever you&#8217;d like:</p>
<pre class="brush: php">
/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each a unique
 * prefix. Only numbers, letters, and underscores please!
 */
$table_prefix  = &#039;mysecretprefix_&#039;;
</pre>
</li>
<li>Upload the file to your site, replacing the old wp-config.php file (If you made these changes from the built in file editor for your host &#8211; like cPanel, you just need to click the &#8220;save&#8221; button).
<p>At this point, your site will totally stop working.   Yikes!  Fortunately, we can fix that by changing some things in the database (Remember how you were supposed to make sure you had database access before we started?  If you don&#8217;t, change wp_config.php back to the way it was, quick!).
</li>
<li>Fire up PHPMyAdmin (or the MySQL client of your choice), and connect to the database for this WordPress install.</li>
<li>Run through each table starting with wp, and rename it, as follows:
<ol>
<li>Click on the table name in the left sidebar</li>
<li>Click on the &#8220;Operations&#8221; tab</li>
<li>Change &#8220;wp_&#8221; to &#8220;mysecretprefix_&#8221; in the upper right field<img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-shot-2011-08-03-at-11.04.39-AM.png" alt="" title="Change Table Prefix" width="600" height="393" class="aligncenter size-full wp-image-319" /></li>
<li>Repeat for each table</li>
<p>At this point, your site should be working properly again, with one important caveat:  You get a permissions error when you try to log in.  That leads us to our last set of steps:
</li>
<p> Choose the mysecretprefix_usermeta table, and look for a row with a user_id of 1 (or whatever your user&#8217;s id is &#8211; it&#8217;s probably 1), and a &#8220;meta_key&#8221; value of &#8220;wp_capabilities&#8221;.  Once you&#8217;ve found this.  Click the pencil toward the left (edit)</li>
<li>Replace the wp_ in the meta_key row to &#8220;mysecretprefix_&#8221;<br />
<img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-shot-2011-08-03-at-11.12.02-AM.png" alt="" title="Screen-shot-2011-08-03-at-11.12.02-AM" width="600" height="393" class="aligncenter size-full wp-image-320" /></li>
<li>You need to make this same change to 2 more records &#8211; wp_user_level (located in wp_usermeta &#8211; again, make sure you&#8217;re changing it for the right user), and wp_user_roles, which is in the mysecretprefix_options table.  Both of them should have wp_ replaced with mysecretprefix_.</li>
<li>All done!</li>
</ol>
<h3>If You&#8217;re Installing WordPress, and You&#8217;re Not Interested in all that Hassle:</h3>
<p>This one probably should have gone first:  The plugin <a href="http://www.google.com/search?sourceid=chrome&#038;ie=UTF-8&#038;q=wp+security+scan">WP Security Scan</a> from <a href="http://www.websitedefender.com/blog/">WebsiteDefender</a> will do all the dirty work for you in most cases.  Just go to the &#8220;Database&#8221; page, and switch your prefix.<br />
<img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-shot-2011-08-03-at-11.26.38-AM.png" alt="" title="WP Security Scan" width="600" height="343" class="aligncenter size-full wp-image-321" /></p>
<img src="http://feeds.feedburner.com/~r/CodeGarage/~4/8G3BQ9q30-4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/08/how-to-change-your-wordpress-table-prefix/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://codegarage.com/blog/2011/08/how-to-change-your-wordpress-table-prefix/</feedburner:origLink></item>
		<item>
		<title>How to Clean Up the TimThumb Security Vulnerability</title>
		<link>http://feedproxy.google.com/~r/CodeGarage/~3/n7dTMdX5On0/</link>
		<comments>http://codegarage.com/blog/2011/08/how-to-clean-up-the-timthumb-security-vulnerability/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 16:56:25 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Locker]]></category>
		<category><![CDATA[Vulnerabilities]]></category>

		<guid isPermaLink="false">http://codegarage.com/blog/?p=300</guid>
		<description><![CDATA[Yesterday, Mark Maunder over at markmaunder.com managed to track down the source of a pretty clever hack on his site, where the hacker gained access through the massively popular TimThumb image thumbnail creation library. You can read his full post on the matter here: Zero Day Vulnerability in Many WordPress Themes He&#8217;s made an interesting ...]]></description>
			<content:encoded><![CDATA[<p>Yesterday, Mark Maunder over at <a href="http://markmaunder.com/">markmaunder.com</a> managed to track down the source of a pretty clever hack on his site, where the hacker gained access through the massively popular TimThumb image thumbnail creation library.  You can read his full post on the matter here:<br />
<a href="http://markmaunder.com/2011/zero-day-vulnerability-in-many-wordpress-themes/">Zero Day Vulnerability in Many WordPress Themes</a><br />
He&#8217;s made an interesting post detailing the work he did to catch the hack &#8211; If you have the time, give it a read.</p>
<p>More importantly &#8211; this hack has the potential to affect hundreds of thousands of WordPress installs.  Unfortunately, because the timthumb library is generally included in themes (both free and premium), it&#8217;s not going to be very easy to get patched.  Premium theme sellers will no doubt release updates and notify their users, but free theme users are less likely to have such good luck.  As such, it&#8217;s going to be a good idea to check your site out for this vulnerability, and fix it as soon as possible.</p>
<p>(Note &#8211; Subscribers to <a href="http://codegarage.com/plans-pricing">Locker</a> have had their sites scanned for this vulnerability, and are being automatically notified if they&#8217;ve got a problem right now.)</p>
<h3>How do I know if I&#8217;m vulnerable?</h3>
<p>Nearly anyone using the timthumb library, who downloaded it before yesterday (8/1/11) is likely to be vulnerable.  How do you know if you&#8217;re using timthumb?  The easiest way is probably to check out your theme folders for a file called timthumb.php, using FTP, or your host&#8217;s file browser.  If you&#8217;re using a host with cPanel (like Hostgator), it&#8217;s very easy &#8211; just load up the file manager, and then use the &#8220;Find&#8221; box in the upper right corner to search for timthumb.php.  No results?  Chances are good that you&#8217;re safe.<br />
<img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-shot-2011-08-02-at-10.46.52-AM1.png" alt="" title="Timthumb Check" width="678" height="291" class="aligncenter size-full wp-image-303" /><br />
Make sure you check every folder in your theme &#8211; it&#8217;s likely that if your theme has a lot of included files, this file would be in a directory inside your main theme folder.</p>
<h3>Ok, the file is there &#8211; now what?</h3>
<p>Fortunately, thanks to the hard work of Mark in finding this and bringing it to light, Ben (the creator of TimThumb), and a few other folks, there is a more secure version of the script now available for download here:<br />
<a href="http://timthumb.googlecode.com/svn/trunk/timthumb.php">http://timthumb.googlecode.com/svn/trunk/timthumb.php</a><br />
To secure your site, save that file (File->Save Page As in most browsers) to your computer, and then upload it to your site via FTP, replacing every instance of timthumb.php with the new version you just downloaded.  If that&#8217;s beyond you, or you want to be absolutely sure that you&#8217;ve closed the hole up, send me an email at peter@codegarage.com, or hit me on twitter @peterbutler, and I&#8217;ll help get you straightened out.</p>
<p>Good luck!</p>
<h4>Resources</h4>
<ul>
<li><a href="http://www.binarymoon.co.uk/projects/timthumb/">Timthumb Project Homepage</a></li>
<li><a href="http://markmaunder.com/2011/zero-day-vulnerability-in-many-wordpress-themes/">Original Post about the vulnerability (there&#8217;s some interesting discussion in the comments &#8211; have a look)</a></li>
</ul>
<img src="http://feeds.feedburner.com/~r/CodeGarage/~4/n7dTMdX5On0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/08/how-to-clean-up-the-timthumb-security-vulnerability/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		<feedburner:origLink>http://codegarage.com/blog/2011/08/how-to-clean-up-the-timthumb-security-vulnerability/</feedburner:origLink></item>
		<item>
		<title>Dealing with Curly Quotes in WordPress by Changing Your Site’s Character Encoding.</title>
		<link>http://feedproxy.google.com/~r/CodeGarage/~3/5VJjMMB-V_g/</link>
		<comments>http://codegarage.com/blog/2011/05/dealing-with-curly-quotes-in-wordpress-by-changing-your-sites-character-encoding/#comments</comments>
		<pubDate>Sat, 21 May 2011 17:30:04 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codegarage.com/blog/?p=294</guid>
		<description><![CDATA[Here&#8217;s a problem I run into every few months with a customer: Their site is suddenly showing strange characters (strange question marks, accented characters, general gibberish) in place of quotation marks, dashes, etc. Oftentimes this happens after a move, but it could also be the result of a few other things. The Problem The problem ...]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a problem I run into every few months with a customer:  Their site is suddenly showing strange characters (strange question marks, accented characters, general gibberish) in place of quotation marks, dashes, etc.  Oftentimes this happens after a move, but it could also be the result of a few other things.  </p>
<h2>The Problem</h2>
<p>The problem is generally a result of pasting straight from Microsoft Word (or similar) into WordPress.  Word generates lots of evil characters that WordPress and web servers don&#8217;t deal with properly.  As a result, you end up with gibberish.  And frustration.</p>
<h2>The Solution</h2>
<p>The best solution is to stop pasting formatted text from Word into WordPress.  That is, however, not useful if you&#8217;re already dealing with the problem.  You could manually replace the problem characters, but that takes FOREVER, and writing a script to get into the database and do it for you is a chore I havent been confident enough to take on, because of the relative obscurity of the problem ( and how difficult it is to find every problem instance ).  So, I generally take the easy way out, which is this:</p>
<h3>Change your site&#8217;s character encoding</h3>
<p>Yep.  Just trick wordpress/web browsers to treat the content with Microsoft&#8217;s character set, brush your hands off, and be on your way.  Here&#8217;s how:</p>
<ol>
<li><strong>Navigate to yoursite.com/wp-admin/options.php</strong><br />You&#8217;re goign to have to type this in, there are no links from the WP backend to this page.</li>
<li><strong>Seach for &#8220;blog_charset&#8221;:</strong><img src="http://codegarage.com/blog/wp-content/uploads/2011/05/Screen-shot-2011-05-21-at-11.26.15-AM.png" alt="" title="blog_charset" width="807" height="111" class="aligncenter size-full wp-image-295" /></li>
<li><strong>Change the value to &#8220;windows-1252&#8243; and save.</strong></li>
<li><strong>Move on to more interesting problems</strong></li>
</ol>
<p>There you go:  Band aid applied.  Again, this isn&#8217;t an ideal solution, it&#8217;s more like the &#8220;quick, dirty, I&#8217;m tired of dealing with it solution&#8221;.  </p>
<img src="http://feeds.feedburner.com/~r/CodeGarage/~4/5VJjMMB-V_g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/05/dealing-with-curly-quotes-in-wordpress-by-changing-your-sites-character-encoding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://codegarage.com/blog/2011/05/dealing-with-curly-quotes-in-wordpress-by-changing-your-sites-character-encoding/</feedburner:origLink></item>
		<item>
		<title>How to 301 Redirect all Subdomains</title>
		<link>http://feedproxy.google.com/~r/CodeGarage/~3/tO4vBHTnTGw/</link>
		<comments>http://codegarage.com/blog/2011/03/how-to-301-redirect-all-subdomains/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 15:00:14 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[301]]></category>
		<category><![CDATA[redirection]]></category>

		<guid isPermaLink="false">http://yourcodegarage.com/blog/?p=288</guid>
		<description><![CDATA[Just a quick post &#8211; I recently had a friend who was moving from a WP MultiUser setup, where each blog had its own subdomain, to one consolidated blog. He wanted to maintain links pointed to his old blogs, so he needed to 301 redirect all the pages on the old subdomains to the appropriate ...]]></description>
			<content:encoded><![CDATA[<p>Just a quick post &#8211; I recently had a friend who was moving from a WP MultiUser setup, where each blog had its own subdomain, to one consolidated blog.  He wanted to maintain links pointed to his old blogs, so he needed to 301 redirect all the pages on the old subdomains to the appropriate pages on the main domain using his .htaccess file.  The code to put it together wasn&#8217;t too tricky:</p>
<pre class="brush: php">
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^yourdomain.com$ [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]
</pre>
<p>This will take any request your site receives, and make sure that the url starts (after the http://) with yourdomain.com.  If it starts with anything else (say blog.yourdomain.com, or even www.yourdomain.com), it will be redirected to http://yourdomain.com.  This code also allows for deep redirection &#8211; that is, if the user typed in </p>
<p>blog.yourdomain.com/my-favorite-page/</p>
<p>they&#8217;ll be redirected to </p>
<p>yourdomain.com/my-favorite-page/</p>
<p>which is definitely what you want.</p>
<img src="http://feeds.feedburner.com/~r/CodeGarage/~4/tO4vBHTnTGw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/03/how-to-301-redirect-all-subdomains/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://codegarage.com/blog/2011/03/how-to-301-redirect-all-subdomains/</feedburner:origLink></item>
		<item>
		<title>Customizing WordPress:  an Introduction</title>
		<link>http://feedproxy.google.com/~r/CodeGarage/~3/jB_kc4hVilI/</link>
		<comments>http://codegarage.com/blog/2011/03/customizing-wordpress-an-introduction/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 16:00:42 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Tweaking Your Theme]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Premium themes]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[Wordpress Customization]]></category>

		<guid isPermaLink="false">http://yourcodegarage.com/blog/?p=274</guid>
		<description><![CDATA[WordPress is an amazingly flexible, powerful content management system &#8211; it can do a lot of things for a lot of different people, and can can be contorted to match the requirements of impossibly different businesses. All for free. Right, but I just want to change my header Of course. Lets talk about how you ...]]></description>
			<content:encoded><![CDATA[<p>WordPress is an amazingly flexible, powerful content management system &#8211; it can do a lot of things for a lot of different people, and can can be contorted to match the requirements of impossibly different businesses.  All for free.</p>
<h3>Right, but I just want to change my header</h3>
<p>Of course.  Lets talk about how you can go about making small customizations to your WordPress based site. There are routes to take for people of all ability levels &#8211; so don&#8217;t be afraid if you&#8217;re still not exactly sure what &#8220;hosting&#8221; means.</p>
<p>I&#8217;m going to give 2 paths here, one for people who don&#8217;t know html and css from arugula, and one for those who do, even if it&#8217;s just barely.</p>
<h3>The easy way out: Choosing a flexible theme</h3>
<p>Over the past 12-18 months, the WordPress community has exploded with a new class of themes &#8211; heavily customizable and easy to use, even for those with little or no html and css ability.  I&#8217;m going to talk about 3 themes here &#8211; 2 paid, and one free.  Feel free to chime in in the comments with your personal favorite.</p>
<h3>Headway</h3>
<p><a href="http://headwaythemes.com"><img src="http://yourcodegarage.com/blog/wp-content/uploads/2011/03/Screen-shot-2011-03-06-at-3.08.20-PM.png" alt="" title="Screen shot 2011-03-06 at 3.08.20 PM" width="191" height="88" class="alignleft size-full wp-image-280" /></a>Headway is my favorite.  It&#8217;s not free, in fact, it&#8217;s not even cheap &#8211; but in my opinion, their visual editor is really fantastic &#8211; and just what a beginning WordPress user needs to get them up and running with a great looking, customized theme.  <a href="http://headwaythemes.com">Click here to visit Headway</a>.</p>
<h3>Thesis</h3>
<p><a href="http://diythemes.com"><img src="http://yourcodegarage.com/blog/wp-content/uploads/2011/03/Screen-shot-2011-03-06-at-3.08.31-PM.png" alt="" title="Screen shot 2011-03-06 at 3.08.31 PM" width="217" height="57" class="alignleft size-full wp-image-281" /></a>Thesis has been around since the beginning of paid themes.  It&#8217;s hugely popular and has a rabid following.  It&#8217;s not my favorite for a number of reasons, but how wrong can 35,000 people be?  <a href="http://diythemes.com">Click here to visit Thesis</a></p>
<h3>Atahualpa</h3>
<p><a href="http://wordpress.bytesforall.com/?page_id=40"><img src="http://yourcodegarage.com/blog/wp-content/uploads/2011/03/Screen-shot-2011-03-06-at-3.11.57-PM.png" alt="" title="Screen shot 2011-03-06 at 3.11.57 PM" width="206" height="72" class="alignleft size-full wp-image-282" /></a>Atahualpa is another tricky one.  It&#8217;s very popular, and refreshingly, it&#8217;s free!  However, there is a pretty steep learning curve that comes along with it.  If you&#8217;ve got the patience to power through the learning stage, you&#8217;ll no doubt be very excited with the end product. <a href="http://wordpress.bytesforall.com/?page_id=40">Click here to visit the Atahualpa homepage</a></p>
<h3>The Road Less Travelled &#8211; Modifying theme code yourself</h3>
<p>The other option is a little less glamourous, and a lot more migraine inducing, but the possibilities are limitless.  WordPress works on a templating system that is both easy to use, and robust enough to let you do anything you want it to.  The kicker is:  you need to learn how HTML, CSS, and even a little bit of PHP if you&#8217;re going to make this work.  You don&#8217;t exactly need to be an expert in any of them to make small changes to an existing theme though.  Here&#8217;s the quick overview, and some links to get you pointed in the right direction:</p>
<h3>WordPress Theme Files</h3>
<p>Nearly every WordPress theme consists of the same basic set of files, listed here:</p>
<ul>
<li><strong>index.php</strong> Index.php is your theme&#8217;s go-to guy.  Traditionally, it controls the homepage (although if your theme has a file called &#8220;home.php&#8221;, that&#8217;s what will control your homepage).   When all else fails, index.php is the file that WordPress looks to to generate your page.</li>
<li><strong>header.php</strong> This one isn&#8217;t too tough.  Header.php controls &#8211; wait for it &#8211; your header.  In most themes, every single page on your site will share a header &#8211; so if you&#8217;re looking to add an image into your header, this is a good place to start your search.</li>
<li><strong>footer.php</strong> Another no brainer.  Looking for that hard to find copyright text?  Start checking here.</li>
<li><strong>sidebar.php</strong> More easy stuff &#8211; here&#8217;s where your sidebar code traditionally goes.</li>
<li><strong>single.php</strong> This file is in charge of single post pages &#8211; like the one you&#8217;re looking at right now.</li>
<li><strong>page.php</strong> This file is in charge of &#8220;Page&#8221; pages.  </li>
<li><strong>archive.php</strong> This file controls the layout of your archive pages &#8211; for example, the pages displayed when you click the &#8220;March 2011&#8243; link on this blog, or one of the category links in the sidebar.  A warning &#8211; categories are sometimes controlled by another file (category.php).</li>
<li><strong>style.css</strong> Here&#8217;s where things get interesting.  The style.css file is usually the single source of all CSS (which controls the actual look and feel of your blog &#8211; things like colors, layout, fonts, etc) on your theme.  Get comfortable with this file, and the CSS that it uses.</li>
</ul>
<p>That is, unfortunately, not even close to a complete list.  Fortunately, there&#8217;s a <a href="http://codex.wordpress.org/Template_Hierarchy">handy diagram at this page</a> on wordpress.org.</p>
<p>Now, you at least know where to start looking &#8211; all that&#8217;s left is to figure out what to do once you get there. Here are a couple of great tutorials to get you on your way:<br />
<a href="http://www.w3schools.com/html/default.asp">HTML Tutorial</a><br />
<a href="http://www.csstutorial.net/">CSS Tutorial</h3>
<img src="http://feeds.feedburner.com/~r/CodeGarage/~4/jB_kc4hVilI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/03/customizing-wordpress-an-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://codegarage.com/blog/2011/03/customizing-wordpress-an-introduction/</feedburner:origLink></item>
	</channel>
</rss>

