<?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>Josh's Random Non-sense! &#187; str_replace</title>
	<atom:link href="http://josh.thespiffylife.com/tag/str_replace/feed/" rel="self" type="application/rss+xml" />
	<link>http://josh.thespiffylife.com</link>
	<description>my crazy life :)</description>
	<lastBuildDate>Tue, 29 Dec 2009 23:52:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Annoying Coding Methods (solved)</title>
		<link>http://josh.thespiffylife.com/annoing-coding-methods-solved-46/</link>
		<comments>http://josh.thespiffylife.com/annoing-coding-methods-solved-46/#comments</comments>
		<pubDate>Sat, 22 Mar 2008 20:42:39 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[base64_decode]]></category>
		<category><![CDATA[eval]]></category>
		<category><![CDATA[gzinflate]]></category>
		<category><![CDATA[str_replace]]></category>
		<category><![CDATA[str_rot13]]></category>

		<guid isPermaLink="false">http://josh.thespiffylife.com/annyoing-coding-methods-solved-46/</guid>
		<description><![CDATA[So I finally figured out how to decrypt the insanity of the footer for this theme.
To see what I started out with see the first post &#8211;&#62; Annyoing Coding Methods
Simply changing the eval() to echo just printed out a ?&#62; because I found out the first thing in the code was a ?&#62;, so it [...]<br /><a href="http://josh.thespiffylife.com/annyoing-coding-methods-solved-46/#comments" title="Comments on &quot;Annoying Coding Methods (solved)&quot;"><img src="http://josh.thespiffylife.com/wp-content/plugins/feed-comments-number/image.php?46" alt="Comments" /></a>]]></description>
			<content:encoded><![CDATA[<p>So I finally figured out how to decrypt the insanity of the footer for this theme.</p>
<p>To see what I started out with see the first post &#8211;&gt; <a href="http://josh.thespiffylife.com/annyoing-coding-methods-35/">Annyoing Coding Methods</a></p>
<p>Simply changing the eval() to echo just printed out a ?&gt; because I found out the first thing in the code was a ?&gt;, so it ended the PHP tag and simply printed out the ending ?&gt; tag.</p>
<p>So&#8230; I decided to remove all PHP tags&#8230; like <code>&lt;?php &lt;?</code> and <code>?&gt;</code> with:</p>
<pre><span style="color: #000000;">
<span style="color: #0000bb;">&lt;?php
$remove </span><span style="color: #007700;">= array(</span><span style="color: #dd0000;">"&gt;"</span><span style="color: #007700;">,</span><span style="color: #dd0000;">"&lt;"</span><span style="color: #007700;">);
</span><span style="color: #0000bb;">$replace </span><span style="color: #007700;">= array(</span><span style="color: #dd0000;">"&amp;gt;"</span><span style="color: #007700;">,</span><span style="color: #dd0000;">"&amp;lt;"</span><span style="color: #007700;">);
</span><span style="color: #0000bb;">$string </span><span style="color: #007700;">= </span><span style="color: #dd0000;">'FREAKISHLY LONG ENCRYPTED STRING HERE'</span><span style="color: #007700;">;
echo </span><span style="color: #0000bb;">str_replace</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$remove</span><span style="color: #007700;">,</span><span style="color: #0000bb;">$replace</span><span style="color: #007700;">,</span><span style="color: #0000bb;">gzinflate</span><span style="color: #007700;">(</span><span style="color: #0000bb;">str_rot13</span><span style="color: #007700;">(</span><span style="color: #0000bb;">base64_decode</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$string</span><span style="color: #007700;">))));
</span><span style="color: #ff8000;"># echo str_replace($remove,$replace,gzinflate(base64_decode($string)));&lt;br /&gt;
</span><span style="color: #0000bb;">?&gt;</span>
</span></pre>
<p>So that worked liked I hoped it would, BUT it prints out nearly the exact same thing I had to begin with, just with another random string. So I keep replacing cryptic  code in the <code>$string</code> variable over and over. The output varied from <code>eval(gzinflate(str_rot13(base64_decode($string))));</code> to <code>eval(gzinflate(base64_decode($string)));</code> Hence the extra (commented) line in the above code. I probably repeated this method at least 50 times until I actually saw the real source code. (And yes, after doing that I realize that I could have just written a little code to loop through it, but I had no idea how many iterations it would take)</p>
<p>The string of data got smaller and smaller each time. The last string before the real code is only about a fifth of the length of the original:</p>
<p><textarea style="color:#DD0000" onclick="this.focus();this.select();" rows="7" cols="70">tVRdb5swFH3OpP2HOx6WRCrQZm8ZpdKkVX1opCqNtr5FBi7g1djMNk3z73exE5q0Vbs97AXM/Tgcn3vsi3SUFPwBeHEebHhRoTVB+vHDyEdzwYzZJ4o+kVy0dQu8hAmUncwtV3KNj9xYMxkXW8kanq8NLzBjejyFz5/hWXAyvsbSwqVSFvuKKcwBhUF6Xbj/jpJO+MUoEdzxYsFApArSpJ4d87LcCgzSJeYoLbSKuCRxPduBHODR2rGnnjXTec0fkFj3Ddm2f45Pxmen9Mg7Y1VDCyKQ9q+4f0+/7hkSTvxEsk964j7o/4Gy4GXfAU7MmNT8v7IueVX/o675X+m6QMte6ukhHetNu9ZYEVfUk51IPkvCDBVCVVyqzvqKA9H6Iga1xvI8qK1t53H8wAQvmFU62nyJlK7ivMb8PqYS1KgDcMTOg1XNDbSsQtg1oAFm4O5qtbiGs+gUbq3muQ3SH30aEpZlet+Ldxal4ZlAuNq2qFf4aGHB9H3XwjWTVUewQfocKol7DGLP3tnBRumi1WiMoz8wvlEb2kEB2RZ+UsVNX3ECxhL1UJWhrTFk2oLBhknLcyBiRkkmoO0ywU3NZQWtYLZUuomCdMA4IHQ8l4ZmdzSTt637ZNRXTDx4eLgvSme23XXhGjI35lJNxuRO9EcGQnja9xzekep4U8Bk8bJjs4l+YVkKLsQ2ylUTN3RgaWghtZFrWH96CGnho7B8ijrM8FVEi3kttRKiRwzSFX2ChCUF3mgiDnTqrMpUobvGd166GFgF31y0b4+cRKZlcqf3HqtELObPtdPGzNadFl6/IP0uyX1k7sny9nbqZz1AOVA/jVlwlPgUEmc/xrxW7tKTXbP+3WEP5l0Bu69oV2l5g3pNcrWTM19gMFeyoIIwTA9MMDjMe2DvsSEdkyJbt6htI+ga+AM=</textarea></p>
<p>I repeated the workflow one more time and was excited to see real code!<br />
<textarea rows="20" cols="70"></p>
<div id="widgets">
<div class="widgetd">
<php if ( function_exists('dynamic_sidebar') &#038;&#038; dynamic_sidebar('Left Footer') ) : else : ?>
<ul>
<li id="a" class="wg">
<h2 class="widgettitle">Recent posts</h2>
<p>
<ul><span style="color: #0000BB" mce_style="color: #0000BB"><?php get_archives</span><span style="color: #007700" mce_style="color: #007700">(</span><span style="color: #DD0000" mce_style="color: #DD0000">&#8216;postbypost&#8217;</span><span style="color: #007700" mce_style="color: #007700">,</span><span style="color: #DD0000" mce_style="color: #DD0000">&#8216;10&#8242;</span><span style="color: #007700" mce_style="color: #007700">,</span><span style="color: #DD0000" mce_style="color: #DD0000">&#8216;custom&#8217;</span><span style="color: #007700" mce_style="color: #007700">,</span><span style="color: #DD0000" mce_style="color: #DD0000">&#8216;
<li>&#8216;</span><span style="color: #007700" mce_style="color: #007700">,</span><span style="color: #DD0000" mce_style="color: #DD0000">&#8216;</li>
<p>&#8216;</span><span style="color: #007700" mce_style="color: #007700">); </span><span style="color: #0000BB" mce_style="color: #0000BB">?><br /></span></ul>
<p></li>
<p></ul>
<p><span style="color: #0000BB" mce_style="color: #0000BB"><?php </span><span style="color: #007700" mce_style="color: #007700">endif; </span><span style="color: #0000BB" mce_style="color: #0000BB">?><br /></span></div>
<p>
<div class="widgetd"><span style="color: #0000BB" mce_style="color: #0000BB"><?php </span><span style="color: #007700" mce_style="color: #007700">if ( </span><span style="color: #0000BB" mce_style="color: #0000BB">function_exists</span><span style="color: #007700" mce_style="color: #007700">(</span><span style="color: #DD0000" mce_style="color: #DD0000">&#8216;dynamic_sidebar&#8217;</span><span style="color: #007700" mce_style="color: #007700">) &#038;&#038; </span><span style="color: #0000BB" mce_style="color: #0000BB">dynamic_sidebar</span><span style="color: #007700" mce_style="color: #007700">(</span><span style="color: #DD0000" mce_style="color: #DD0000">&#8216;Right Footer&#8217;</span><span style="color: #007700" mce_style="color: #007700">) ) : else : </span><span style="color: #0000BB" mce_style="color: #0000BB">?><br /></span>
<ul>
<li id="c" class="wg">
<h2 class="widgettitle">Meta</h2>
<p>
<ul></p>
<p><span style="color: #0000BB" mce_style="color: #0000BB"><?php wp_register</span><span style="color: #007700" mce_style="color: #007700">(); </span><span style="color: #0000BB" mce_style="color: #0000BB">?><br /></span>
<li><span style="color: #0000BB" mce_style="color: #0000BB"><?php wp_loginout</span><span style="color: #007700" mce_style="color: #007700">(); </span><span style="color: #0000BB" mce_style="color: #0000BB">?></span></li>
<p>
<li><a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Strict">Valid <abbr title="eXtensible HyperText Markup Language">XHTML 1.0 Strict</abbr></a></li>
<p>
<li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress</a></li>
</p>
<p><span style="color: #0000BB" mce_style="color: #0000BB"><?php wp_meta</span><span style="color: #007700" mce_style="color: #007700">(); </span><span style="color: #0000BB" mce_style="color: #0000BB">?><br /></span></ul>
<p></li>
<p></ul>
<p></div>
<p><span style="color: #0000BB" mce_style="color: #0000BB"><?php </span><span style="color: #007700" mce_style="color: #007700">endif; </span><span style="color: #0000BB" mce_style="color: #0000BB">?><br /></span></div>
<p>
<div id="footer"><span style="color: #0000BB" mce_style="color: #0000BB"><?php bloginfo</span><span style="color: #007700" mce_style="color: #007700">(</span><span style="color: #DD0000" mce_style="color: #DD0000">&#8216;name&#8217;</span><span style="color: #007700" mce_style="color: #007700">); </span><span style="color: #0000BB" mce_style="color: #0000BB">?></span>  &#8211; Powered by: <a href="http://wordpress.org/">WordPress</a> and <a href="http://www.jefflilly.com/mustang-restoration/">Mustang Restoration</a> &#8211; <a href="http://www.technroll.com">Tech n Roll</a> &#8211; <a href="http://www.flighttobodrum.com">Flight to Bodrum</a>.<br /><span><br /><a href="feed:<span style="color: #0000BB" mce_style="color: #0000BB"><?php bloginfo</span><span style="color: #007700" mce_style="color: #007700">(</span><span style="color: #DD0000" mce_style="color: #DD0000">&#8216;rss2_url&#8217;</span><span style="color: #007700" mce_style="color: #007700">); </span><span style="color: #0000BB" mce_style="color: #0000BB">?></span>&#8220;>Entries (RSS)</a></span><br /><span id="f2"></span><br /><!-- <span style="color: #0000BB" mce_style="color: #0000BB"><?php </span><span style="color: #007700" mce_style="color: #007700">echo </span><span style="color: #0000BB" mce_style="color: #0000BB">get_num_queries</span><span style="color: #007700" mce_style="color: #007700">(); </span><span style="color: #0000BB" mce_style="color: #0000BB">?></span> queries. <span style="color: #0000BB" mce_style="color: #0000BB"><?php timer_stop</span><span style="color: #007700" mce_style="color: #007700">(</span><span style="color: #0000BB" mce_style="color: #0000BB">1</span><span style="color: #007700" mce_style="color: #007700">); </span><span style="color: #0000BB" mce_style="color: #0000BB">?></span> seconds. &#8211;></div>
<p><span style="color: #0000BB" mce_style="color: #0000BB"><?php wp_footer</span><span style="color: #007700" mce_style="color: #007700">(); </span><span style="color: #0000BB" mce_style="color: #0000BB">?><br /></span></div>
<p></body><br /></html></textarea></p>
<p><del datetime="2008-04-04T04:49:43+00:00">You&#8217;ll notice instead of <code>&lt;?php</code> it printed out php because they were removed with the <code>str_replace</code> function. There&#8217;s also no ending <code>?&gt;</code> tags at the end of the PHP code but simply replace them where they belong and remove the links in the end and you&#8217;re done!</del><br /> Update: changed the <code>str_replace()</code> search/replace terms so now everything will look like it should (for some reason I overlooked this simple correction a week ago &#8230; lol<br />
I&#8217;ve got no idea why the person that made this theme felt it necessary to keep their blasted links so sacred &#8230; whatever.</p>
<br /><a href="http://josh.thespiffylife.com/annyoing-coding-methods-solved-46/#comments" title="Comments on &quot;Annoying Coding Methods (solved)&quot;"><img src="http://josh.thespiffylife.com/wp-content/plugins/feed-comments-number/image.php?46" alt="Comments" /></a>]]></content:encoded>
			<wfw:commentRss>http://josh.thespiffylife.com/annoing-coding-methods-solved-46/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
