<?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>Resources, Guides and Information | Max Morgan Design</title>
	<atom:link href="http://maxmorgandesign.com/resources/feed/" rel="self" type="application/rss+xml" />
	<link>http://maxmorgandesign.com</link>
	<description>Get the latest scoop!</description>
	<lastBuildDate>Fri, 18 May 2012 17:45:57 -0700</lastBuildDate>
	<generator>http://maxmorgandesign.com/mmd-cms/</generator>
	<language>en</language>
	<sy:updatePeriod>daily</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
    				<item>
				<title>PHP Unserializer</title>
				<link>http://maxmorgandesign.com/php_unserialize/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/php_unserialize//</guid>
				<comments>http://maxmorgandesign.com/php_unserialize/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ Threw together because I needed it. ]]></description>
                                <content:encoded><![CDATA[ <p>Threw together because I needed it.</p> ]]></content:encoded>
                </item>
							<item>
				<title>How To: Quickly Add a New PHP Extension Via SSH</title>
				<link>http://maxmorgandesign.com/how_to_add_php_extension_via_ssh_ubuntu/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/how_to_add_php_extension_via_ssh_ubuntu//</guid>
				<comments>http://maxmorgandesign.com/how_to_add_php_extension_via_ssh_ubuntu/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ Had a developer friend ask me how to do this the other day - figured I would post it here on the site ]]></description>
                                <content:encoded><![CDATA[ <p>Had a developer friend ask me how to do this the other day - figured I would post it here on the site. In this situation, the mysql, curl, and gd extensions were not installed on the server ( Running Ubuntu ). Adding the new extension is incredibly quick to do.</p>
<p><strong>You will need root access to do this - I assume that by reading this tutorial, you have your own dedicated server and know how to SSH and access as a root or elevated user with access.</strong></p>
<h2>
	Step 1: Get And Install Your Extension</h2>
<p>Curl:</p>
<div class="code">
	sudo apt-get install php5-curl</div>
<p>MYSQL Functions:</p>
<div class="code">
	sudo apt-get install php5-mysql</div>
<p>GD Library:</p>
<div class="code">
	sudo apt-get install php5-gd</div>
<h2>
	Step 2: Restart Apache</h2>
<p>If you don&#39;t restart apache, PHP will not see the new extension.</p>
<div class="code">
	sudo service apache2 restart</div>
<h2>
	Aaaannd... Done!</h2>
<p>You are all set and good to go. I nabbed this information form a great forum post here: <a href="http://ubuntuforums.org/showthread.php?t=391313" target="_blank">http://ubuntuforums.org/showthread.php?t=391313</a></p> ]]></content:encoded>
                </item>
							<item>
				<title>Easily Open A TCP Port On Your Stock cPanel Server</title>
				<link>http://maxmorgandesign.com/cpanel_open_port/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/cpanel_open_port//</guid>
				<comments>http://maxmorgandesign.com/cpanel_open_port/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ I had to open a port to utilize a merchant services gateway, FirstData. If you want a REALLY easy way to do this, without SSHing or doing anything technical, follow the steps here. ]]></description>
                                <content:encoded><![CDATA[ <p>I had to open a port to utilize a merchant services gateway, FirstData. If you want a REALLY easy way to do this, without SSHing or doing anything technical, follow the steps here.</p>
<p>Log Into WHM as root, or a user with elevated access, and head to ConfigServer Security&amp;Firewall. From there, click Edit Firewall Configuration. Add your port to the end of the Incoming/Outgoing TCP Ports List and reset lcf. Your good to go!</p>
<p>Have fun.</p>
<p>&nbsp;</p> ]]></content:encoded>
                </item>
							<item>
				<title>Free Code: Find The Total Line Count Of A Folder Using PHP</title>
				<link>http://maxmorgandesign.com/free_find_line_count_php/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/free_find_line_count_php//</guid>
				<comments>http://maxmorgandesign.com/free_find_line_count_php/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ I was looking for a way to quickly see how many lines I had coded for a project. This will use a recursive function to loop through a directory, scanning for any php/xhtml/css/js files and counting how many lines they might have inside. ]]></description>
                                <content:encoded><![CDATA[ <div class="code">function get_line_count($folder, $pos) {<br />
&nbsp;&nbsp; &nbsp;global $ignoreList, $extList;<br />
&nbsp;&nbsp; &nbsp;if ( !is_dir($folder) ) return false;<br />
&nbsp;&nbsp; &nbsp;$dir = opendir($folder);<br />
&nbsp;&nbsp; &nbsp;while ($thisFile = readdir($dir))<br />
&nbsp;&nbsp; &nbsp;{<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; if ( in_array($thisFile, $ignoreList) ) continue;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; $thisLoc = $folder.&#39;/&#39;.$thisFile;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; if ( is_dir($thisLoc) ) {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $thisCount += get_line_count($thisLoc, $pos+1);&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo &#39;&lt;br/&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for ( $x = 1; $x &lt;= $pos; $x++ ) echo &#39;....&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo $thisFile.&#39;/&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; else {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $thisExt = array_pop(explode(&#39;.&#39;,$thisFile));<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( !in_array($thisExt, $extList) ) continue;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo &#39;&lt;br/&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for ( $x = 1; $x &lt;= $pos; $x++ ) echo &#39;....&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo $thisFile.&#39;/&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $thisContents = file_get_contents($thisLoc);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $thisContents = str_replace(array(&quot;nn&quot;,&quot;r&quot;), &quot;n&quot;,$thisContents);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $thisContents = str_replace(&quot;nn&quot;, &quot;n&quot;,$thisContents);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $thisLines = count(explode(&quot;n&quot;,$thisContents));<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $thisCount += $thisLines;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo &#39; &lt;b&gt;(&#39;.$thisLines.&#39;)&lt;/b&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp; &nbsp;}<br />
&nbsp;&nbsp; &nbsp;return $thisCount;<br />
}<br />
<br />
//File or folder names to ignore<br />
$ignoreList = array(&#39;.htaccess&#39;,&#39;cgi-bin&#39;,&#39;.&#39;,&#39;..&#39;,&#39;error_log&#39;);<br />
//Only files with these extensions will be checked<br />
$extList = array(&#39;php&#39;,&#39;css&#39;,&#39;js&#39;,&#39;html&#39;);<br />
//Set your starting dir<br />
$startDir = $_SERVER[&#39;DOCUMENT_ROOT&#39;];<br />
$lines = get_line_count($startDir, 0);<br />
echo &#39;&lt;p&gt;&#39;.$lines.&#39; lines of code found.&lt;/p&gt;&#39;;</div>
<p>There are probably ten billion ways to do this, BUT I was looking for a way to quickly see how many lines I had coded for a project. This will use a recursive function to loop through a directory, scanning for any php/xhtml/css/js files and counting how many lines they might have inside.</p>
<p>Have fun!</p> ]]></content:encoded>
                </item>
							<item>
				<title>Free Code: ReCaptcha Form Validation With PHP</title>
				<link>http://maxmorgandesign.com/php_recaptcha/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/php_recaptcha//</guid>
				<comments>http://maxmorgandesign.com/php_recaptcha/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ A friend of mine asked me for a quick and simple way to add ReCaptcha to a contact form on her site. For demonstration purposes, I created a form from scratch and tossed ReCaptcha&#039;s PHP API onto it. ]]></description>
                                <content:encoded><![CDATA[ <p>A friend of mine asked me for a quick and simple way to add ReCaptcha to a contact form on her site. For demonstration purposes, I created a form from scratch and tossed ReCaptcha&#39;s PHP API onto it. Check out the example below. This is a very very basic contact form with simple field validation and an html-based email that is sent out.</p>
<h2>
	The Code</h2>
<div class="code">&lt;?php<br />
<br />
//Make sure you put your keys here<br />
$publickey = &#39;YOUR KEY HERE&#39;;<br />
$privatekey = &#39;YOUR KEY HERE&#39;;<br />
$toEmail = &#39;YOUR EMAIL HERE&#39;;<br />
include &#39;recaptchalib.php&#39;;<br />
<br />
//If somebody has posted data, we run verification<br />
if ( isset($_POST[&#39;FirstName&#39;]) ) {<br />
<br />
&nbsp;&nbsp; &nbsp;//PHP will generally add stripslashes to all posted data. This removes it and helps to sanitize data for security reasons.<br />
&nbsp;&nbsp; &nbsp;foreach ( $_POST as $k =&gt; $v ) $_POST[$k] = htmlentities(stripslashes($v),ENT_QUOTES);<br />
<br />
&nbsp;&nbsp; &nbsp;//Basic Validation. We are storing errors in an arrray.<br />
&nbsp;&nbsp; &nbsp;if ( empty($_POST[&#39;FirstName&#39;]) ) $errors[] = &#39;Please enter your first name!&#39;;<br />
&nbsp;&nbsp; &nbsp;if ( empty($_POST[&#39;LastName&#39;]) ) $errors[] = &#39;Please enter your last name!&#39;;<br />
&nbsp;&nbsp; &nbsp;if ( empty($_POST[&#39;Email&#39;]) ) $errors[] = &#39;Please enter your email address!&#39;;<br />
&nbsp;&nbsp; &nbsp;if ( empty($_POST[&#39;Comments&#39;]) ) $errors[] = &#39;Please enter your comments!&#39;;<br />
&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;//Captcha Validation<br />
&nbsp;&nbsp; &nbsp;$resp = recaptcha_check_answer ($privatekey, $_SERVER[&quot;REMOTE_ADDR&quot;], $_POST[&quot;recaptcha_challenge_field&quot;],$_POST[&quot;recaptcha_response_field&quot;]);<br />
&nbsp;&nbsp; &nbsp;if (!$resp-&gt;is_valid) {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; if ( $resp-&gt;error==&#39;incorrect-captcha-sol&#39; ) $errors[] = &#39;The captcha you filled out did not match the image. Please try again.&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; else $errors[] = $resp-&gt;error;<br />
&nbsp;&nbsp; &nbsp;}<br />
&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;//We check to see if we have any errors. If not, send the email<br />
&nbsp;&nbsp; &nbsp;if ( !isset($errors) ) {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; $headers = &#39;Content-type: text/html&#39;; // Allows us to put html in comments<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; $message = &#39;&lt;p&gt;&lt;b&gt;First Name: &lt;/b&gt;&#39;.$_POST[&#39;FirstName&#39;].&#39;&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; $message .= &#39;&lt;p&gt;&lt;b&gt;Last Name: &lt;/b&gt;&#39;.$_POST[&#39;LastName&#39;].&#39;&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; $message .= &#39;&lt;p&gt;&lt;b&gt;Email: &lt;/b&gt;&#39;.$_POST[&#39;Email&#39;].&#39;&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; $message .= &#39;&lt;p&gt;&lt;b&gt;Comments: &lt;/b&gt;&lt;br/&gt;&#39;.$_POST[&#39;Comments&#39;].&#39;&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; mail($toEmail,&#39;New Form Mail From Your Website&#39;,$message,$headers);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; $submitted = true;&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;} else {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; //If we do have errors, loop through our errors array and let the user know what they did wrong.<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; ?&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div id=&quot;formErrors&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &lt;h3&gt;Errors!&lt;/h3&gt;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;ul&gt;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;? foreach ( $errors as $anError ) echo &#39;&lt;li&gt;&#39;.$anError.&#39;&lt;/li&gt;&#39;; ?&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ul&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/div&gt;&nbsp; &nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?<br />
&nbsp;&nbsp; &nbsp;}<br />
&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;<br />
}<br />
// If the form has been submitted successfully , show this information<br />
if ( $submitted == true ) { ?&gt;<br />
<br />
<br />
&lt;h3&gt;Thank You!&lt;/h3&gt;<br />
&lt;p&gt;Your message has been received. We will get back to you within the next 2 business days.&lt;/p&gt;<br />
<br />
<br />
&lt;? }<br />
//Otherwise we show this information<br />
else {<br />
?&gt;<br />
<br />
<br />
&lt;script type=&quot;text/javascript&quot;&gt; &nbsp;<br />
// Completely unnecessary - changes the theme.<br />
var RecaptchaOptions = { &nbsp;<br />
&nbsp;&nbsp; theme : &#39;clean&#39; &nbsp;<br />
}; &nbsp;<br />
&lt;/script&gt; &nbsp;<br />
&lt;form method=&quot;post&quot; action=&quot;&quot;&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;table border=&quot;1&quot; cellpadding=&quot;5&quot; cellspacing=&quot;5&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tr&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;First Name:&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;FirstName&quot; value=&quot;&lt;?php echo $_POST[&#39;FirstName&#39;]; ?&gt;&quot; /&gt;&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tr&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tr&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;Last Name:&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;LastName&quot; value=&quot;&lt;?php echo $_POST[&#39;LastName&#39;]; ?&gt;&quot; /&gt;&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tr&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tr&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;E-Mail:&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;Email&quot; value=&quot;&lt;?php echo $_POST[&#39;Email&#39;]; ?&gt;&quot; /&gt;&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tr&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tr&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;Comments:&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;textarea name=&quot;Comments&quot; cols=&quot;40&quot; rows=&quot;10&quot;&gt;&lt;?php echo $_POST[&#39;Comments&#39;]; ?&gt;&lt;/textarea&gt;&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tr&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tr&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;Captcha&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;?php echo recaptcha_get_html($publickey, $error); ?&gt;&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tr&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tr&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&amp;nbsp;&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;input type=&quot;submit&quot; value=&quot;Send Message&quot; /&gt;&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tr&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;/table&gt;<br />
&lt;/form&gt;<br />
<br />
<br />
<br />
&lt;?php }; ?&gt;</div>
<h2>
	Working Demo</h2>
<p><iframe src="http://playground.maxmorgandesign.com/recaptcha/form.php" style="margin:0 auto; width:96%; display:block; height:600px; background-color:white;">This section of the site uses iframes. Here I am demonstrating a PHP-based ReCaptcha form.</iframe></p>
<h2>
	File Download</h2>
<p><a href="http://playground.maxmorgandesign.com/recaptcha/form.txt" target="_blank">Download form.txt</a></p> ]]></content:encoded>
                </item>
							<item>
				<title>Stop Cron Jobs From Automatically Sending You Emails</title>
				<link>http://maxmorgandesign.com/stop_automatic_cron_job_email/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/stop_automatic_cron_job_email//</guid>
				<comments>http://maxmorgandesign.com/stop_automatic_cron_job_email/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ If you use a lot of cron jobs like I do, you tend to have some that you would like automatically sent over, and some you want to just let run without ever sending you an email and clogging your inbox. This line can be added to the end of your cron job command to stop the command from sending an email out and off to you: ]]></description>
                                <content:encoded><![CDATA[ <p>If you use a lot of cron jobs like I do, you tend to have some that you would like automatically sent over, and some you want to just let run without ever sending you an email and clogging your inbox. This line can be added to the end of your cron job command to stop the command from sending an email out and off to you:</p>
<div class="code">&gt;/dev/null 2&gt;&amp;1</div>
<p>Here would be a quick example for you:</p>
<div class="code">php /home/my_directory_folder/public_html/support/cron/silly-job.php &gt;/dev/null 2&gt;&amp;1</div>
<p>I know that this works for all cPanel hosts - if you have any better methods feel free to post them below.</p> ]]></content:encoded>
                </item>
							<item>
				<title>Google&#039;s New +1 Button</title>
				<link>http://maxmorgandesign.com/google_s_new_+1_button/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/google_s_new_+1_button//</guid>
				<comments>http://maxmorgandesign.com/google_s_new_+1_button/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ Google released it&#039;s new +1 button and has provided yet another way for us to tie into the social media experience. ]]></description>
                                <content:encoded><![CDATA[ <h2>
	What Is It?</h2>
<p>The +1 button is Google&#39;s attempt at not only diving into the social media realm when it comes to search engine results, but also it&#39;s attempt at making it&#39;s results more accurate and more tailored to it&#39;s users.</p>
<h2>
	Why Use It?</h2>
<p>The +1 button will take a page and add your +1 to it. This is public information that will be used to not only suggest the page to others, but to help useful websites gain rankings in Google&#39;s search algorithm. By clicking the +1 on various websites you will not only help out your fellow friends when they are looking for related information, but you will also help fine tune Google&#39;s search algorithm.</p>
<h2>
	Use BOTH Google&#39;s +1 And Facebook&#39;s &#39;Like&#39;</h2>
<p>While we see the same concept between the two buttons, we also see a difference in the way they work and the impact they provide. Facebook&#39;s Like button will take your URL and toss it on your Facebook Wall - sharing it with your friends and allowing it to show up in search results if your wall is public. When you have a few thousand people &#39;Liking&#39; your site, your URL is not only shared among those friends, but it is also tossing your URL onto various pages on Facebook that Google searches. This helps your site spread out to others and helps your site gain a small SEO jump.</p>
<p>Google&#39;s +1 has a similar effect but it ties directly into Google. Rather than showing your approval of the site to your friends, the button will raise your site in search engines. Have you found an article that is related to a search term you were looking for? +1 it - Google will take note and hopefully make that page appear more for that search term.</p>
<p>While the Facebook Like button is great for helping your site spread out to others, Google&#39;s +1 button adds a different way for your site to help spread. One disadvantage I will note is that not everybod has a Google account - Facebook&#39;s userbase is incredibly widespread, while Google&#39;s tends to be more geared towards our tech-savvy audience.</p>
<h2>
	How Do I Use It?</h2>
<p>To use the button, you simply copy and paste the code that google provides onto your site. That&#39;s it! You can not currently customize it to the extent that you can the Facebook Like button, but it looks like Google is keeping things simple for now. Choose your size and your language and copy + paste the code onto your site. The button will automatically attach itself to the URL of the page your visitors are on.</p>
<div class="code">&lt;!-- Place this tag in your head or just before your close body tag --&gt;<br />
&lt;script type=&quot;text/javascript&quot; src=&quot;https://apis.google.com/js/plusone.js&quot;&gt;&lt;/script&gt;<br />
<br />
&lt;!-- Place this tag where you want the +1 button to render --&gt;<br />
&lt;g:plusone&gt;&lt;/g:plusone&gt;</div>
<p>You can find out more information and get more customized embed codes for it at <a href="http://www.google.com/webmasters/+1/button/index.html" target="_blank">google&#39;s official page</a>.</p>
<h2>
	Did You Find This Post Useful?</h2>
<p>Follow along with what I just talked to you about and +1 my article!</p>
<p><g:plusone></g:plusone></p> ]]></content:encoded>
                </item>
							<item>
				<title>Quick And Easy SEO Tips</title>
				<link>http://maxmorgandesign.com/quick_easy_seo_tips/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/quick_easy_seo_tips//</guid>
				<comments>http://maxmorgandesign.com/quick_easy_seo_tips/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ A few quick and easy tips to aid you when gearing or simply preparing your site for future SEO work. I tend to follow these principles when designing any site - whether or not I&#039;m gearing it for SEO. ]]></description>
                                <content:encoded><![CDATA[ <p><b>SEO</b>, or <b>Search Engine Optimization</b> has become the art of getting high Google rankings. It can be time consuming, but after becoming experienced enough to really know what you are doing, you can increase your rankings with only an hour or two of work a week. Here are afew quick and easy tips to aid you when gearing or simply preparing your site for future SEO work. I tend to follow these principles when designing any site - whether or not I&#39;m gearing it for SEO.</p>
<h3>
	Use Keyword-Based Filenames</h3>
<p>IF you are going to be linking to different pages around your site, name your files in ways that represents what the page is about. For example, if you have a page about <b>seo tools</b>, name your page something similar to <b>useful_seo_tools.php</b>. This adds on to the keyword relevancy of your page, thus increasing your pagerank. Popular CMS systems such as WordPress allow you to change link structures when creating pages and news posts.</p>
<h3>
	Try To Avoid Dynamic Pages With Query Strings</h3>
<p>Many PHP applications will use query strings to pass data ( news.php?post=44535, for example ). While this works fine for the general use to go to, search engines tend to avoid these and will crawl slower over the pages. If you can, try to use something to turn these into real pagenames. mod_rewrite tricks allow you to dynamically create fake pages for links like this, so you can have <i>/news/my_news_post/</i> link over to <i>news.php?id=455</i>.</p>
<h3>
	Use Your Title Tag!</h3>
<p>Your title tag is one of the first thing Search Engines will look at during user searches. Toss your keywords in here if you can, but keep it RELEVANT to your page content. The title for this page is <b>Free and Easy SEO Tricks And Tips</b> and the page briefly gives a few SEO tricks and tips for Web Campaigns.</p>
<h3>
	Use Header Tags</h3>
<p>Our ever popular header tags ( <em>&lt;h1&gt;,&lt;h2,etc. )</em> are INCREDIBLY useful to us. They tell search engines when a new section comes up and what that section should be about. Never use more than one <em>&lt;h1&gt;</em> per page, and try to limit your use of <em>&lt;h2&gt;</em> tags.</p>
<h3>
	Google Could Care Less About META Tags</h3>
<p>Many web developers and designers are use to tossing their keywords and page content up in META tags at the top of the page, but in reality Google and other search engines tend to completely ignore these. They are starting to look at your actual page content and not just the tags you have at the top of the page. It is useful to have them up there, but Search Engines are more worried about your actual page content. This page has no META tags, but you&#39;re here anyway, right?</p>
<h3>
	Use ALT Tags With Images</h3>
<p>When inserting an image, use ALT tags to tell Search Engines ( and people ) what those images are. You can even utilize these to your advantage and toss some keyword-rich text inside. Search Engines like to see images and REALLY like to see images that are related to your page content.</p>
<h3>
	Link To And From Relevant Web Pages</h3>
<p>This applies to pages on your website and pages on other websites. If you have a site about SEO Tricks and another site about SEO Campaigns, it will help you immensely to link them back and fourth to each other. Relevant sites linking together will get higher search rankings.</p>
<h3>
	Switch Up Content When You Can</h3>
<p>If A Search Engine sees that your site is highly active, it will place you higher up in search results? Why - IT shows that your site is more dynamic and that somebody is still using it. Mots people will build a site and toss it up without touching it for months - this leads to old information. Quick weekly updates will do wonders for your rankings and dynamic, changing content is great as well.</p>
<h3>
	Use Google Analytics</h3>
<p style="text-align:center;"><img alt="Google Analytics" src="http://campaignsareus.com/google-analytics.jpg" /></p>
<p>Use <a href="http://google.com/analytics/" target="_blank">Google Analytics</a> to track page views and user search terms. Analytics is easy to install on your site and was created by google to help you manage your site. It tracks how many users your site gets and where they are coming from - including which search terms they enter into google to get there.</p>
<h3>
	Know Your Audience</h3>
<p>Know your audience and where they come from. If you target keywords that your select audience is using you are bound to get more traffic. For example, if you are targeting &quot;seo tips&quot; and your client market is searching for &quot;seo tricks&quot;, you&#39;ll be out a lot of targeted traffic. There are many tools out there, such as the google keywords tool to help you out with knowing just what your audience is searching for. Use a program like Analytics (mentioned above) to help you with this as well.</p> ]]></content:encoded>
                </item>
							<item>
				<title>GoDaddy Coupon Codes (Updated 4/4/2010)</title>
				<link>http://maxmorgandesign.com/godaddy_coupon_codes/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/godaddy_coupon_codes//</guid>
				<comments>http://maxmorgandesign.com/godaddy_coupon_codes/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ GoDaddy coupon codes, cause we&#039;re all poor students. I pull these from an excellent post on FatWallet.com. ]]></description>
                                <content:encoded><![CDATA[ <ul>
<li><strong>GoDaddy Coupons for $7.49 Domains</strong></li>
<li>cjc749fat (exp 4/30/11)</li>
<li>cjc695dom</li>
<li>IAPtdom1</li>
<li>promo749</li>
<li>goox025afc</li>
<li>NEW3 (renewals too... just used it)</li>
<li>UKPS412 new and renewals</li>
<li>MTECH412</li>
<li>poster412</li>
</ul><ul>
<li><strong>GoDaddy Promo Codes for % of savings</strong></li>
<li>cjcfat10 - 10% off (exp 4/30/11)</li>
<li>cjcfat75 15% off w/ $75 Purchase (4/30/11)</li>
<li>cjccoupon - 10% off Coupon</li>
<li>cjcdeal - 15% off $75 Purchase</li>
<li>NEW1 - 10% off whatever</li>
<li>promo10 - 10% off</li>
<li>gdbb776 10% off code</li>
<li>command10 10% off any order</li>
<li>gdz225a 30% off .com renewals</li>
<li>gdbba1550 15% off $50+ order</li>
<li>gdbb687 20% Off $65+ Purchase</li>
<li>fbgdhome20 20% off $75+ Purchase</li>
<li>gdbb363 10% off Any Order</li>
<li>BB462075 20% off $75+ Purchase</li>
</ul><ul>
<li><strong>Coupons for $ off</strong></li>
<li>cjcfat30 - $5 off $30 (exp 4/30/11)</li>
<li>cjcfat50 - $10 off $50 (exp 4/30/11)</li>
<li>cjctenoff - $10 off $50</li>
<li>cjcdollar - $1 off Coupon</li>
<li>cjconeoff $1 off Any Order</li>
<li>NEW2- $5 off a $30 purchase</li>
<li>GoDaddy Hosting Coupons</li>
<li>cjcfat199 - $1.99 /mo hosting -3 mo (exp 4/30/11)</li>
<li>cjcfat20h 20% off Hosting (exp 4/30/11)</li>
<li>IAPth1 - 20% off Hosting</li>
</ul><ul>
<li><strong>Miscellaneous</strong></li>
<li>GDBBREN8 -.COM &amp; .NET Renewals $7.99, Private Registration $3.99</li>
<li>gd50bbpd5 -.COM &amp; .NET Renewals $7.99, Private Registration $3.99</li>
<li>GROUCHSSL - $12.99 Standard SSL Certificates</li>
<li>gdbb776 -$7.99 .com and $7.50 .org Renewals</li>
</ul>
<p>Pulled From <a href="http://www.fatwallet.com/forums/hot-deals/725207/" target="_blank">http://www.fatwallet.com/forums/hot-deals/725207/</a></p>
<p>While I do recommend godaddy for your domain needs, I absolutely would not recommend them for hosting.</p> ]]></content:encoded>
                </item>
							<item>
				<title>.htaccess Trick: Redirect www Visitors To Your Non-www Site</title>
				<link>http://maxmorgandesign.com/_htaccess_trick:_redirect_www_visitors_to_your_non_www_site/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/_htaccess_trick:_redirect_www_visitors_to_your_non_www_site//</guid>
				<comments>http://maxmorgandesign.com/_htaccess_trick:_redirect_www_visitors_to_your_non_www_site/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ If you want to completely remove the www. from your domain name when visitors visit your website, place the following code snippet into your .htaccess file. ]]></description>
                                <content:encoded><![CDATA[ <p>I use this ALL the time, so It&#39;s nice for me to have a quick place to reference it and I figure there are others out there looking for something like this. If you want to completely remove the www. from your domain name when visitors visit your website, place the following code snippet into your <em>.htaccess</em> file.</p>
<div class="code">RewriteEngine On<br />
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]<br />
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]</div>
<p>This is the same code that my site and my clients&#39; sites use to remove the www from their domain name when a visitor searches. This will simply and cleanly redirect any link to your site to the non-www version. For example, http://www.maxmorgandesign.com/contact/ simply becomes http://maxmorgandesign.com/contact/. Easy,&nbsp; yeah?</p> ]]></content:encoded>
                </item>
							<item>
				<title>Awesome Firefox Plugins For Web Developers</title>
				<link>http://maxmorgandesign.com/awesome_firefox_plugins_for_web_developers/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/awesome_firefox_plugins_for_web_developers//</guid>
				<comments>http://maxmorgandesign.com/awesome_firefox_plugins_for_web_developers/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ I do a LOT of support for other developers, newbies and advanced. One of the biggest questions I get is &#039;What the hell did you just do!?&#039;. I have a handful of awesome Firefox plugins that I like to use to make myself more efficient when it comes to building and debugging websites. Check out what I like to use. ]]></description>
                                <content:encoded><![CDATA[ <p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/03/firefox-logo-sm.png" style="float:right;" />I do a LOT of support for other developers, newbies and advanced. One of the biggest questions I get is &#39;What the hell did you just do!?&#39;. I have a handful of awesome Firefox plugins that I like to use to make myself more efficient when it comes to building and debugging websites. I have compiled a list here for anybody looking for great web development resources. If you want to add anything to this, feel free to add a comment below and I&#39;ll make sure you&#39;re mentioned!</p>
<h2>
	<a href="http://getfirebug.com/" target="_blank">Firebug</a></h2>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/03/firebug-logo-med.jpg" style="width: 300px; height: 106px; float: left;" />Of course, Firebug. When people think FireFox and Web Developers, this is one of the first things that comes to mind. Firebug is one of, if not, the most popular web development tools for Firefox. It allows you to inspect HTML code on pages in real time and allows you to modify it on the fly. Unlike simply hitting View Page Source, this allows you to view the page source as it&#39;s modified and affected by things like Javascript/AJAX. IT has an incredible Javascript debugger, as well as a bunch more goodies that allow you to quickly and easily tear apart your site and test it for all it&#39;s worth. There is a great set of documentation as well as a fully functional support forum. Check it out at <a href="http://getfirebug.com/" target="_blank">getfirebug.com</a>.</p>
<h2>
	<a href="http://chrispederick.com/work/web-developer/" target="_blank">Web Developer Toolbar</a></h2>
<p><img src="https://static.addons.mozilla.net/img/uploads/previews/thumbs/11/11916.png?modified=1246341414" style="float:left;" /></p>
<p>By far my favorite and most used plugin for Firefox. This gives you a HUGE handful of tools you can use when browsing sites to quickly tear them apart and quickly tear things apart or just change a setting. You have the ability to quickly enable and disable settings, from cookies to css, broser size, and even images - turning a few menu transitions into a quick click or two. The information bar panel allows you to check out the information on an element, breaking it down to display it&#39;s parent objects, child obhects, and physical data - height, width, physical position on the page, etc. It has a handy menu to quickly jump to w3c validator&#39;s for CSS/XHMTL/RSS/etc and has a bunch more packed in for you. Check out it&#39;s site <a href="http://chrispederick.com/work/web-developer/" target="_blank">here</a>.</p>
<h2>
	<a href="https://addons.mozilla.org/en-US/firefox/addon/domain-details/" target="_blank">Domain Details</a></h2>
<p>Domain details is an incredible simple plugin with a lot of use. It places a small icon in the bottom left hand bar of the browser that simple displays links to useful information about the site. The icon itself displays a flag of the country the server resides in, the IP address, then an icon with a pullout window. This window contains the links to useful information such as domain whois, website details ( Server Information ), and more. The plugin was created by <a href="http://dndetails.com/" target="_blank">Domain Name Details</a> and runs most of it&#39;s services through their site. Check it out <a href="https://addons.mozilla.org/en-US/firefox/addon/domain-details/" target="_blank">here</a>.</p>
<h2>
	<a href="http://www.screengrab.org/" target="_blank">Screengrab</a></h2>
<p>Screengrab is another simple yet useful plugin I use pretty frequently. It allows you to quickly and easily save a webpage as an image by simply right clicking anywhere on the page and choosing your screenshot type out of the ScreenGrab! menu. You can save the current visible frame, the entire page itself, or just a portion you hand select. It saves images as PNG files you can then quickly send off oto a client or upload to a site. It also handles Flash and Java with no problem. Visit their site at <a href="http://www.screengrab.org/" target="_blank">Screengrab.org</a>.</p>
<h2>
	<a href="http://chrispederick.com/work/user-agent-switcher/" target="_blank">User Agent Switcher</a></h2>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/03/User-Agent-Switcher-med.png" style="width: 300px; height: 117px; float: left;" /></p>
<p>This plugin adds a menu and a toolbar button to allow you to quickly change the user agent content of your browser. You can essentially &quot;trick&quot; servers into thinking that you are using a browser you aren&#39;t. Why is this good? If you are a developer that users conditional code or stylesheets, you can test it out by simply changing your user agent instead of modifying your code to show it off. It allows you to save multiple profiles and comes preloaded with a bunch of useful ones to start with. Check out it&#39;s site <a href="http://chrispederick.com/work/user-agent-switcher/" target="_blank">here</a>.</p>
<h2>
	<a href="http://fireftp.mozdev.org/" target="_blank">FireFTP</a></h2>
<p>While I don&#39;t use this, a good handful of the developers I work with do. Fire FTP is, &quot;The Free FTP Client For Mozilla FireFox.&quot; This plugin will literally insert a fully functional FTP client into your broser, wit functionalities almost mimicking FileZilla. It&#39;s free and quick to install. Check it out <a href="http://fireftp.mozdev.org/" target="_blank">here</a>.</p> ]]></content:encoded>
                </item>
							<item>
				<title>How To Convert A Video To An FLV And Create A Flash Player For It Using Flash and Adobe Media Encoder</title>
				<link>http://maxmorgandesign.com/how_to_convert_a_video_and_create_a_flash_player_for_it/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/how_to_convert_a_video_and_create_a_flash_player_for_it//</guid>
				<comments>http://maxmorgandesign.com/how_to_convert_a_video_and_create_a_flash_player_for_it/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ Student requested this one - he has a movie file ( .avi ) that he wants to upload to his website with controls and a player for his visitors to be able to watch. ]]></description>
                                <content:encoded><![CDATA[ <p>Student requested this one - he has a movie file ( .avi ) that he wants to upload to his website with controls and a player for his visitors to be able to watch. I&#39;m going to show how to take a video file ( any format should work - .avi, .mpg, .mov, etc. ), convert it to an FLV to reduce filesize and then create a video player in flash for it and embed it in your page using Dreamweaver CS5. The actual amount of work you need to do for this is going to take about five minutes.</p>
<p>&nbsp;</p>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/__ENCODER-lg.jpg" /></p>
<p>The first thing we are going to want to do is make sure out video is formatted properly for the web. This involves taking our video file and converting it into either an FLV. We are going to open up a program called Adobe Media Encoder to take care of this for us.</p>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/encoder_s1-lg.jpg" /></p>
<p>Go ahead and open up the encoder and you should see a blank screen like the one above. Click &#39;Add...&#39; and select the video file you want to convert. That will add it to the video convert que.</p>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/encoder_s2-lg.jpg" /></p>
<p>We want to convert our video to an FLV, so check the drop down arrow in the FORMAT column and choose FLV | F4V.</p>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/encoder_s3-lg.jpg" /></p>
<p>We also want to change the preset we are working with so this thing exports correctly. Under PRESET, choose FLV - Web Medium. There is going to be a HUGE amount of presets in here, but we will use this one for this session. Going into different sizes and formats is for another discussion on another day.</p>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/encoder_s4-lg.jpg" /></p>
<p>One that is setup, go ahead and hit Start Queve. By default, the exporter will simply save the created file in the same folder of your document.</p>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/encoder_s5-lg.jpg" /></p>
<p>Depending on the specs of your machine and the size and type of your video, this process can take from a few minutes to a few hours. Sit back and let it run. Once its done we get to move on to the next step.</p>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/flash_s1-lg.jpg" /></p>
<p>Once our video is good to go, go ahead and open Flash. We want to use Flash to import our video and automatically create a nice and clean player for us. While we can create our own players, it does tend to be somewhat time consuming, so this is the easiest step for now. Navigate to File &gt; Import &gt; Import Video...</p>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/flash_s2-lg.jpg" /></p>
<p>We want to choose the file located on our computer, so make sure the first option it checked and click browse. Choose your video.</p>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/flash_s3-lg.jpg" /></p>
<p>Once your video has been chosen, open the file and click Next.</p>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/flash_s4-lg.jpg" /></p>
<p>Here we get to choose the options for our video player skin. All of these are great and they all have a different set of options, though I would use only elements that start with &#39;SkinOver&#39;, for the sake of this tutorial. Anything starting with &#39;SkinOver&#39; puts the playback controls on top of the video, while &#39;SkinUnder&#39; places them below, making the file a little bit taller than expected. In this example, we are going to choose SkinOverPlaySeekFullscreen, which creates a playback controller on top of the video with seek controls, a play/pause button, and a fullscreen button. Click Next and go through the next screen.</p>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/flash_s5-lg.jpg" /></p>
<p>This will go ahead and place our video on the stage in a nice player for us. We want to take note of two areas on the screen now. The first is the ALIGN panel. If you don&#39;t have it, head to Window &gt; Align to make it appear. Click the two options boxed above to align our video to the top left of the document. We do this so when we resize, parts of the video get cut off.</p>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/flash_s7-lg.jpg" /></p>
<p>This next step is SUPER important, so make sure you follow through with it. BY DEFAULT, Flash will use the ABSOLUTE path of your computer when placing video files. This will cause it to break when the video file moves or you upload it to your server? Why does it do this? I have no idea, but its dumb and ANNOYING! Edit the source and pull out the folder structure from the path.</p>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/flash_s6-lg.jpg" /></p>
<p>Now, take a look at the &#39;Position and Size&#39; tab. IF you dont see this, click on your video ONCE for it to re-appear. Take a not of the width (W:) and height (H:) and we are going to make the document the correct size for the video.Head over to Modify &gt; Document and make our document settings match the dimensions from the &#39;Position and Size&#39; tab outlined in the previous step. click &#39;OK&#39; to make the changes.</p>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/flash_s8-lg.jpg" /></p>
<p>We are essentially done with flash now and are going to create our .swf file to handle this. Head to File &gt; Export &gt; Export Movie.</p>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/flash_s9-lg.jpg" /></p>
<p>Save the exported movie in the same folder as your video clip. If you don&#39;t we will have issues trying to play it back. When you export the movie, you will notice that TWO files get created. One is the name of your movie player ( MyVideo.swf ) and the other is the name of the skin you chose ( SkinOverPlaySeekFullscreen.swf ). This is normal. Do not delete any file, as they are BOTH needed. Once saved, we are going to open dreamweaver and place our video player into our document.</p>
<p>Open dreamweaver and either create a new document, or load a previous file. I&#39;m using a blank document for this example.</p>
<p>We want to use an embed code to put the file onto our page. The example below uses one of the most simple examples of an embed code you&#39;ll find. Go ahead and link to the correct file and make sure the dimensions match your movie. Save this new page into the SAME folder as your movie and the player., and you&#39;re set. Open your web page and you&#39;ll see our player placed right onto the page.</p>
<div class="code">&lt;object width=&quot;720&quot; height=&quot;396&quot;&gt;<br />
&lt;param name=&quot;movie&quot; value=&quot;MyVideo.swf&quot;&gt;<br />
&lt;embed src=&quot;MyVideo.swf&quot; width=&quot;720&quot; height=&quot;396&quot;&gt;&lt;/embed&gt;<br />
&lt;/object&gt;</div>
<p><img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/dreamweaver_s4-lg.jpg" /></p>
<p>Keep in mind this is one of the more basic ways to include a file on your page using flash. There are many many ways to encode video and even many ways to place them on the page. I have just shown you one way to do it.</p> ]]></content:encoded>
                </item>
							<item>
				<title>Fix YouTube iFrame Overlay and Z-Index Issues</title>
				<link>http://maxmorgandesign.com/fix_youtube_iframe_overlay_and_z_index_issues/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/fix_youtube_iframe_overlay_and_z_index_issues//</guid>
				<comments>http://maxmorgandesign.com/fix_youtube_iframe_overlay_and_z_index_issues/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ YouTube&#039;s new iFrame player is a nice refresh to the old embed method, but if you are placing it on pages with content that overlaps or overlays on each other or uses things like lightbox, you may notice that the videos appear on top of content. ]]></description>
                                <content:encoded><![CDATA[ <p>YouTube&#39;s new iFrame player is a nice refresh to the ugly embed code that we have been using, but if you are placing it on pages with content that overlaps or overlays on each other or uses things like lightbox, you may notice that the videos appear on top of content. It&#39;s very easy to fix the issue when we use the standard embed code by simply adding a paramater to the code itself. With this new code, we simply don&#39;t have the ability to edit the code directly, but the YouTube team has made it easy for us to control this.</p>
<h3>
	Default Embed Code:</h3>
<div class="code">
	&lt;iframe title=&quot;YouTube video player&quot; width=&quot;640&quot; height=&quot;390&quot; src=&quot;http://www.youtube.com/embed/lZqrG1bdGtg&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;</div>
<h3>
	Modified Embed Code:</h3>
<p>To fix this, we simply add a small snippet to the end of the URL to let the page know that we want it to add these paramaters. Add &quot;?wmode=opaque&quot; to the end of the URL.</p>
<div class="code">
	&lt;iframe title=&quot;YouTube video player&quot; width=&quot;640&quot; height=&quot;390&quot; src=&quot;http://www.youtube.com/embed/lZqrG1bdGtg?wmode=opaque&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;</div>
<p>Hope this helps someone - took me a while to find it. Enjoy!</p>
<p><strong>Update: If this doesn&#39;t seem to work in Chrome, try wmode=transparent instead of wmode=opaque!</strong></p>
<h2>
	<strong>Update 2:</strong> Automate This With jQuery!</h2>
<p>A user posted a jQuery code snippet in the comments that allows us to dynamically make this change! I have not tested this personally, but it looks like it should work fine - jQuery is required for this to work and I reccomend posting this in a $(document).ready(); function or at the bottom of your page.</p>
<div class="code">
	$(&quot;iframe&quot;).each(function(){<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var ifr_source = $(this).attr(&#39;src&#39;);<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var wmode = &quot;?wmode=transparent&quot;;<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(this).attr(&#39;src&#39;,ifr_source+wmode);<br />
	});</div>
<p>This code will automatically apply itself to EVERY iframe element - so if you use iframes frequently ( Facebook Like Buttons, anyone? ), you may want to use jQuery to check to see where the URL is coming from. This is a basic snippet posted to get you started that will take every iframe on the page and adds &#39;?wmode=transparent&#39; to the end of it - it&#39;s quick and easy!</p>
<p><strong>Update Again:</strong> This code snippet will check to see if there is already a query string present - if so, it will simply append the new string and value pair.</p>
<div class="code">
	$(&quot;iframe&quot;).each(function(){<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var ifr_source = $(this).attr(&#39;src&#39;);<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var wmode = &quot;wmode=transparent&quot;;<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(ifr_source.indexOf(&#39;?&#39;) != -1) $(this).attr(&#39;src&#39;,ifr_source+&#39;&amp;&#39;+wmode);<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else $(this).attr(&#39;src&#39;,ifr_source+&#39;?&#39;+wmode);<br />
	});</div>
<p><strong>Update To That: </strong>If you want to place our wmode parameter to the beginning of the query string, we can do something like the following:</p>
<div class="code">
	$(document).ready(function() {<br />
	&nbsp;&nbsp;&nbsp; $(&quot;iframe&quot;).each(function(){<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var ifr_source = $(this).attr(&#39;src&#39;);<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var wmode = &quot;wmode=transparent&quot;;<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(ifr_source.indexOf(&#39;?&#39;) != -1) {<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var getQString = ifr_source.split(&#39;?&#39;);<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var oldString = getQString[1];<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var newString = getQString[0];<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(this).attr(&#39;src&#39;,newString+&#39;?&#39;+wmode+&#39;&amp;&#39;+oldString);<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else $(this).attr(&#39;src&#39;,ifr_source+&#39;?&#39;+wmode);<br />
	&nbsp;&nbsp;&nbsp; });<br />
	});</div>
<p>(Thanks to <a href="http://www.altero.dk/" target="_blank">Michael O</a> for perfecting that last snippet.</p>
<h2>
	Update 3: Concatenating With An Existing String</h2>
<p>As one of my readers points out, some of your URLs will already have a query string attached. As an example:</p>
<div class="code">
	http://www.youtube.com/watch?v=1YmPooYpyQw?rel=0</div>
<p>If you were to attach &quot;?wmode=opaque,&quot; it probably would not work. To get around this, simply use an &amp; instead of a ? to add on to what we would call the <strong>query string</strong>.</p>
<div class="code">
	http://www.youtube.com/watch?v=1YmPooYpyQw?rel=0&amp;wmode=opaque</div> ]]></content:encoded>
                </item>
							<item>
				<title>Starter Guide To Facebook Pages</title>
				<link>http://maxmorgandesign.com/facebook_pages/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/facebook_pages//</guid>
				<comments>http://maxmorgandesign.com/facebook_pages/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ Facebook pages are essentially mini sites on facebook for your company, organization, or even hobby to live on. They allow your business to get out there into the world of social media and integrate right into the facebook user streams ]]></description>
                                <content:encoded><![CDATA[ <h2>
	<img alt="" src="http://maxmorgandesign.com/images/uploaded/2011/02/pages-overview-med.jpg" style="width: 201px; height: 300px; float: right;" />What Is A Facebook Page?</h2>
<p>Facebook pages are essentially mini sites on facebook for your company, organization, or even hobby to live on. They allow your business to get out there into the world of social media and integrate right into the facebook user streams. Facebook users may &#39;LIKE&#39; your page and add it to their list of interests, therefore giving your brand more recognition and spreading it out with the world while also letting users see your latest posts and updates.</p>
<h2>
	How Is It Different From A Profile?</h2>
<p>Profiles are meant for human beings - not businesses. Many companies will go out and register a profile under their business name, and will start adding friends to try and up their web presence. This is the wrong way to do things. Pages have content and features that have been put in place distincly for business owners that let them perform and interact with users in a completely different way. Rather than having &#39;Friends&#39;, they have &#39;Fans&#39;. These fans can share pictures, videos, comments, reviews, etc with the business and the business can create new pages to show off and can place &#39;LIKE&#39; buttons on their website to promote their page. These buttons allow users to form a connection with the click of a button, rather than having to accept a friend request.</p>
<p><strong>Facebook pages repesent a business or organization and Facebook Profiles represent and individual person. Clean and simple.</strong></p>
<p>You might be wondering if your business even needs a page. Generally, I would say - YES. It does. Facebook is one of THE most popular and most visited websites on the planet. You are missing major oppertunities by not creating a page for your business. Facebook not only provides a way for you to interact with your fans and clients, but it helps your business spread out to friends of your fans by showing them, &#39;Hey! Your friend likes this... You might too.&#39; Interacting with your fans and showing them what is going on with your business helps keep your business in their mind and helps drive sales to your store. On top of this, it provides a significant SEO boost to your business when search engines see your page setup and the different users that are interacting and liking it.</p>
<h2>
	Setting Up Your Facebook Page</h2>
<p><a href="http://facebook.com/pages/create.php" target="_blank:"><img alt="Create Your Facebook Page" src="http://maxmorgandesign.com/images/uploaded/2011/02/create-full-med.jpg" style="width: 300px; height: 221px; float: left; margin-right: 6px;" /></a>Head over to <a href="http://facebook.com/pages/create.php" target="_blank">http://facebook.com/pages/create.php</a> to setup your Facebook Page. Here, you will setup the page based on what kind of business or organization you are trying to represent. Never make a page for a business or organization that you are not a representative for!</p>
<p>Once your page has been created, you will want to go in and setup your company information. You can always go in and change this, but it is important information your users will be looking for. Make sure you list your website, your products, a description of what your company does and what it sells. If you have an address, pop that in and you will be able to setup a Places Page to support the physical address of your location. You can post deals and your users can &#39;Check In&#39; to your business from their mobile phones - promoting your store even more.</p>
<p>Once your page has been created and setup, its time to actually let people know that it exists. Go ahead and make your first post - Remember, this will work exactly like a normal Facebook profile. If you login to your facebook account and post on your page&#39;s wall, the post will appear as if the PAGE posted and not your USER ACCOUNT. Make your post to show that yes, you are alive and let&#39;s start letting people know that it exists. There is a button titled &#39;Suggest To Friends&#39;. This will allow you to tell your friends, colleagues, etc. that your page exists. Go ahead and tell your audience about the page and that will put you off to a good start. I would HIGHLY reccomend adding a link to your facebook page to your company website, and a LIKE button (See the FAQ below) to drive even more traffic. If you want to advertise in-store, create a flyer or even <a href="http://maxmorgandesign.com/resources/make_your_own__like_us_facebook_window_decal/" target="_blank">create a window decal</a> to advertise your Facebook Page.</p>
<h3>
	Advanced Features: Place Pages, FBML Pages, and Addon Applications</h3>
<p>Once your page has been setup and you think you&#39;re ready to dive into more it&#39;s time to look at additional applications for your page. FBML Pages allow you to create &#39;SubPages&#39; for your page. You can put just about ANYTHING you want on these - Javascript, XHTML, FBML, etc as long as it is standards compliant and won&#39;t mess with others&#39; computers. This is very useful for displaying additional information to your customers - your current inventory, a contact form, instructions to your store, etc</p>
<p>Place Pages are pages that are built around your business&#39;s address. They allow you to put up deals and coupons for when your customers &#39;Check-In&#39; and cause your business to show up when Facebook users are looking for nearby places on their phones. To create a place page for your business, either wait until people start to check in to your business and Facebook notifies you that it has been created OR goto your business, check in and claim your business. Once your place page has been created you may need to merge it with your existing page.</p>
<p>If you are looking for more advanced features, check out some of the applications that have been made for pages. Edit your page and click on &#39;Apps&#39; to see what you currently have installed.</p>
<h2>
	That Was Easy... Is There More To This?</h2>
<p>Oh, yes. Facebook is CONSTANTLY releasing new features and updates to the page system and there are many topics that were not covered in this guide. You will need to monitor your page, keep your fans entertained and make sure you are always growing. You can look into advertising your page on Facebook or even use your page to boost sales and increase traffic to your site. Create FBML pages to give your customers more informatino about what your company is and create deals for when they come to your store. If you need help with any of this or have simple questions, feel free to contact us - we will continue to update this page.</p>
<h2>
	Frequently Asked Questions About Facebook Pages</h2>
<h3>
	How Do I Get A Facebook Page Username?</h3>
<p>Your username may be used to give yourself and your fans an easier way to get to your page. By default, your facebook page&#39;s URL will be http://facebook.com/pages/your-page-name/9844393483493498. You may sign up for a username to store at http://facebook.com/yourbusiness/. To grab your facebook username, you will need to first attain 25 fans (Why? To cut down on spam and people trying to hoarde page names and sell them off later) and head over to <a href="http://facebook.com/username/" target="_blank">http://facebook.com/username/</a>. The process is incredibly easy and takes only a minute or two to do. Once your username has been set, you cannot change it and no other member or profile may take it.</p>
<p style="text-align: center;"><a href="http://facebook.com/username/" target="_blank"><img alt="How to Create Facebook Username" src="http://maxmorgandesign.com/images/uploaded/2011/02/facebook-username.jpg" /></a></p>
<h3>
	Do I Need A Facebook Account To Make A Page?</h3>
<p>No! While I would fully reccomend you make an account to link all of your pages to, you do not need an account. The creation process for your page would be the same, but you would provide an email address and password to login and administer your page with.</p>
<h3>
	Can I Have Multiple Pages Linked To My Facebook Account?</h3>
<p>Yes! Just keep creating pages and they will all be administerable under your Facebook account when logged in. Facebook has a great management system for all of the pages that you control that may be accessed at <a href="http://www.facebook.com/pages/manage/" target="_blank">http://www.facebook.com/pages/manage/</a></p>
<h2>
	Can I Let Others Control My Page?</h2>
<p>Yes. You may make any Facebook user or any person with an email address an admin on your facebook page. To add and remove admins, head to your page and click &#39;Edit Page&#39;. Choose the &#39;Manage Admins&#39; tab on the left and you will be able to add and remove administrators.</p>
<h3>
	How Do I Make a Like Button?</h3>
<p>If you are a web developer or blog owner, you may be interested in creating a &#39;LIKE&#39; button for your Facebook page, website, or even individual website pages. Head to <a href="http://developers.facebook.com/docs/reference/plugins/like/" target="_blank">http://developers.facebook.com/docs/reference/plugins/like/</a> to create LIKE buttons for single pages. This will generate HTML code that you will need to place on your site. There are many options to choose from to customize your button, from the theme to the font you may use. While we do have these options the display and shape will always stay the same so your users will know exactly what they are clicking. When you make your button, make sure you copy the <strong>IFRAME PLUGIN CODE</strong>. XBFML is a topic for another day.</p>
<p>If you are a developer looking to create a loop for like buttons, you will need to do something like this example in PHP:</p>
<div class="code">&lt;?php echo &#39;&lt;iframe src=&quot;http://www.facebook.com/plugins/like.php?href=&#39;.urlencode(&#39;YOUR URL WOULD GO IN HERE&#39;).&#39;&amp;amp;layout=button_count&amp;amp;show_faces=false&amp;amp;width=80&amp;amp;action=like&amp;amp;font=arial&amp;...amp;colorscheme=light&amp;amp;height=21&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;border:none; overflow:hidden; width:80px; height:21px; float:right; margin-left:10px; &quot; allowTransparency=&quot;true&quot;&gt;&lt;/iframe&gt;&#39;; ?&gt;</div>
<p>WordPress LOOP Example:</p>
<div class="code">&lt;?php echo &#39;&lt;iframe src=&quot;http://www.facebook.com/plugins/like.php?href=&#39;.urlencode(get_permalink()).&#39;&amp;amp;layout=button_count&amp;amp;show_faces=false&amp;amp;width=80&amp;amp;action=like&amp;amp;font=arial&amp;...amp;colorscheme=light&amp;amp;height=21&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;border:none; overflow:hidden; width:80px; height:21px; float:right; margin-left:10px; &quot; allowTransparency=&quot;true&quot;&gt;&lt;/iframe&gt;&#39;; ?&gt;</div>
<p>We need to use urlencode or a similar function to create a URL-friendly link. If we include a URL that has slashes, equal signs, or number signs ( /, = or #), we will hit issues. Trust me!</p>
<p>Example:</p>
<div class="code">&lt;iframe src=&quot;http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmaxmorgandesign.com%2Fresources%2Ffacebook_pages%2F&amp;amp;layout=standard&amp;amp;show_faces=true&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light&amp;amp;height=80&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;border:none; overflow:hidden; width:450px; height:80px;&quot; allowTransparency=&quot;true&quot;&gt;&lt;/iframe&gt;</div>
<h4 class="example-header">OUTPUT:</h4><div class="example"><iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmaxmorgandesign.com%2Fresources%2Ffacebook_pages%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" style="border: medium none; overflow: hidden; width: 450px; height: 80px;"></iframe></div> ]]></content:encoded>
                </item>
							<item>
				<title>Quick Guide To PHP Loops</title>
				<link>http://maxmorgandesign.com/quick_guide_php_loops/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/quick_guide_php_loops//</guid>
				<comments>http://maxmorgandesign.com/quick_guide_php_loops/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ I receive a LOT of questions about loops and how/when to use them. Hopefully this will answer a few of the basic questions. I&#039;ll add more to this as more questions come in. ]]></description>
                                <content:encoded><![CDATA[ <p>I receive a LOT of questions about loops and how/when to use them. Hopefully this will answer a few of the basic questions. I&#39;ll add more to this as more questions come in.</p>
<p>Always be careful with loops and the syntax you use with them. Unterminated or long-lasting loops can cause pages to take long periods of time to load and can even crash servers. Normally, if you have a never-ending loop your PHP.ini settings (max_execution_time) will stop the loop before it executes for too long. By default, this value is set at 30 seconds.</p>
<h2>
	FOR LOOP</h2>
<h3>
	When Do We Use It?</h3>
<p>Want to count to a certain number from a certain number. This is good for showing a certain number of objects or looping through simple arrays.</p>
<h3>
	For Loop Example</h3>
<p>For example, I want to show 10 input boxes for a client I can use the following code:</p>
<div class="code">for ( $boxCount = 0; $boxCount &lt;= 10; $boxCount++ )<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp; echo &#39;Something &#39;.$boxCount.&#39;: &lt;input type=&quot;text&quot; name=&quot;boxes[]&quot; id=&quot;box-&#39;.$boxCount.&#39;&quot; /&gt;&lt;br/&gt;&#39;;<br />
}</div>
<h4 class="example-header">OUTPUT:</h4><div class="example">Something 0: <input id="box-0" name="boxes[]" size="30" type="text" /><br />
Something 1: <input id="box-1" name="boxes[]" size="30" type="text" /><br />
Something 2: <input id="box-2" name="boxes[]" size="30" type="text" /><br />
Something 3: <input id="box-3" name="boxes[]" size="30" type="text" /><br />
Something 4: <input id="box-4" name="boxes[]" size="30" type="text" /><br />
Something 5: <input id="box-5" name="boxes[]" size="30" type="text" /><br />
Something 6: <input id="box-6" name="boxes[]" size="30" type="text" /><br />
Something 7: <input id="box-7" name="boxes[]" size="30" type="text" /><br />
Something 8: <input id="box-8" name="boxes[]" size="30" type="text" /><br />
Something 9: <input id="box-9" name="boxes[]" size="30" type="text" /><br />
Something 10: <input id="box-10" name="boxes[]" size="30" type="text" /><br />
</div>
<h2>
	FOREACH</h2>
<h3>
	When Do We Use It?</h3>
<p>When we want to go through a complex array with no standardized KEY.</p>
<h3>
	For Each Loop Example</h3>
<div class="code">$myArray = array( &#39;Test Text&#39;, &#39;Something&#39; =&gt; &#39;Else&#39;, &#39;Another&#39;, 3453, 234, &#39;Hello!&#39;);<br />
foreach ( $myArray as $KEY =&gt; $VALUE ) {<br />
&nbsp;&nbsp;&nbsp; echo &#39;&lt;b&gt;&#39;.$KEY.&#39;:&lt;/b&gt; &#39;.$VALUE.&#39;&lt;br/&gt;&#39;;<br />
}</div>
<h4 class="example-header">OUTPUT:</h4><div class="example"><b>0:</b> Test Text<br />
<b>Something:</b> Else<br />
<b>1:</b> Another<br />
<b>2:</b> 3453<br />
<b>3:</b> 234<br />
<b>4:</b> Hello!</div>
<h2>
	WHILE LOOP</h2>
<h3>
	When Do We Use It?</h3>
<p>When we want to loop through until a number has hit a certain point or a variable returns false. Commonly used with mysql queries.</p>
<h3>
	While Loop Examples</h3>
<div class="code">$x = 0;<br />
while ( $x != 40 )<br />
{<br />
&nbsp;&nbsp;&nbsp; $x++;<br />
}<br />
echo $x;</div>
<h4 class="example-header">OUTPUT:</h4><div class="example">40</div>
<div class="code">$randomNumber = rand(20,50); //Gives us a random number. In our example, lets say we found 34.<br />
$numberFound = false;<br />
$guessNumber = 0;<br />
while ( !$numberFound&nbsp; )&nbsp; // While NOT Number Found - While loops must remain TRUE to run.<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( $guessNumber == $randomNumber ) $numberFound = true;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else $guessNumber++;<br />
}<br />
echo &#39;The number was: &#39;.$guessNumber;</div>
<h4 class="example-header">OUTPUT:</h4><div class="example">The number was: 34</div> ]]></content:encoded>
                </item>
							<item>
				<title>PHP MD5 Encoder</title>
				<link>http://maxmorgandesign.com/php_md5_encoder/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/php_md5_encoder//</guid>
				<comments>http://maxmorgandesign.com/php_md5_encoder/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ Here&#039;s a quick and easy MD5 Encoder. MD5 is not meant to be de-coded, so it is good for storing passwords and private information you may need to use to verify a user, or even for generating secure keys ]]></description>
                                <content:encoded><![CDATA[ <p>Here&#39;s a quick and easy MD5 Encoder. MD5 is not meant to be de-coded, so it is good for storing passwords and private information you may need to use to verify a user, or even for generating secure keys. MD5 is NOT the most secure way of doing things, but it&#39;s still commonly used today. The form below will simply encode a piece of text to md5.</p>
<h2>
	Encode MD5 With PHP - The Code (Quick &#39;N Dirty):</h2>
<div class="code">&lt;h2&gt;Encode Text Now:&lt;/h2&gt;<br />
&lt;?php<br />
&nbsp;&nbsp;&nbsp;&nbsp; if ( isset($_POST[&#39;encodeThis&#39;])) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo &#39;&lt;h3&gt;Encoded Value Of &quot;&#39;.$_POST[&#39;encodeThis&#39;].&#39;&quot;&lt;/h3&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div class=&quot;code&quot;&gt;&#39;.md5($_POST[&#39;encodeThis&#39;]).&#39;&lt;/div&gt;&#39;;<br />
&nbsp;&nbsp;&nbsp;&nbsp; }<br />
?&gt;<br />
&lt;form name=&quot;userEncode&quot; id=&quot;userEncode&quot; method=&quot;post&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp; &lt;p&gt;&lt;label&gt;Text To Encode:&lt;/label&gt;&lt;/p&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp; &lt;p&gt;&lt;input type=&quot;text&quot; size=&quot;60&quot; name=&quot;encodeThis&quot; id=&quot;encodeThis&quot; /&gt; &lt;input type=&quot;submit&quot; value=&quot;Encode&quot;/&gt;&lt;/p&gt;<br />
&lt;/form&gt;</div>
<h2>
	The Working Example:</h2> ]]></content:encoded>
                </item>
							<item>
				<title>Disabling The Link On YouTube&#039;s Embedded Video Player</title>
				<link>http://maxmorgandesign.com/youtube_disable_link/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/youtube_disable_link//</guid>
				<comments>http://maxmorgandesign.com/youtube_disable_link/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ Sometimes you might want to prevent your users from clicking through a YouTube video away from your site. This code snippet will stop that from happening. ]]></description>
                                <content:encoded><![CDATA[ <p>Sometimes you might want to prevent your users from clicking through a YouTube video away from your site. This code snippet will stop that from happening. It&#39;s a quick and easy addition to the embed code that you pull from YouTube itself.</p>
<p><strong>Place this before the &lt;embed tag starts:</strong></p>
<div class="code">
	&lt;param name=&quot;allowNetworking&quot; value=&quot;internal&quot;&gt;&lt;/param&gt;</div>
<p><strong>Place this inside of the &lt;embed tag:</strong></p>
<div class="code">
	allowNetworking=&quot;internal&quot;</div>
<h2>
	Without This Code:</h2>
<div class="code">
	&lt;object width=&quot;480&quot; height=&quot;385&quot;&gt;<br />
	&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/twYpsdCqRm8?fs=1&amp;amp;hl=en_US&quot;&gt;&lt;/param&gt;<br />
	&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;<br />
	&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;<br />
	&lt;embed src=&quot;http://www.youtube.com/v/twYpsdCqRm8?fs=1&amp;amp;hl=en_US&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;480&quot; height=&quot;385&quot;&gt;&lt;/embed&gt;<br />
	&lt;/object&gt;</div>
<p style="text-align: center;"><object height="385" width="480"><param name="movie" value="http://www.youtube.com/v/twYpsdCqRm8?fs=1&amp;hl=en_US" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><embed allowfullscreen="true" allowscriptaccess="always" height="385" src="http://www.youtube.com/v/twYpsdCqRm8?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" width="480"></embed></object></p>
<h2>
	With This Code:</h2>
<p>You&#39;ll notice that with this code, clicking on the video while playing does not take the user away from your site and over to YouTube.</p>
<div class="code">
	&lt;object width=&quot;480&quot; height=&quot;385&quot;&gt;<br />
	&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/twYpsdCqRm8?fs=1&amp;amp;hl=en_US&quot;&gt;&lt;/param&gt;<br />
	&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;<br />
	&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;<br />
	&lt;param name=&quot;allowNetworking&quot; value=&quot;internal&quot;&gt;&lt;/param&gt;<br />
	&lt;embed src=&quot;http://www.youtube.com/v/twYpsdCqRm8?fs=1&amp;amp;hl=en_US&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;480&quot; height=&quot;385&quot; allowNetworking=&quot;internal&quot;&gt;&lt;/embed&gt;<br />
	&lt;/object&gt;</div>
<p style="text-align: center;"><object height="385" width="480"><param name="movie" value="http://www.youtube.com/v/twYpsdCqRm8?fs=1&amp;hl=en_US" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><embed allowfullscreen="true" allowscriptaccess="always" height="385" src="http://www.youtube.com/v/twYpsdCqRm8?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" width="480"></embed></object></p>
<p>You&#39;ll notice that when we use this code, you can&#39;t click on the video to get over to YouTube. It&#39;s a nice quick and easy feature to add to your site to prevent your users from accidentally clicking away.</p>
<h2>
	Update: This No Longer Works!</h2>
<p>Looks like YouTube has changed the way their player works. I will update this if and when I find a new fix.</p> ]]></content:encoded>
                </item>
							<item>
				<title>Simple PHP Auto-Update System</title>
				<link>http://maxmorgandesign.com/simple_php_auto_update_system/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/simple_php_auto_update_system//</guid>
				<comments>http://maxmorgandesign.com/simple_php_auto_update_system/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ I managed to make this script in about two hours. I hope I saved somebody some time with it. You can download the source files below with an example of a simple update I might put up. Make sure you format these files to work with your system. ]]></description>
                                <content:encoded><![CDATA[ <p>So, we have an in-house content management system (CMS) that we tend to use on client sites. It has many features like that of WordPress, Drupal, etc. that make it work REALLY well for the needs of all of our clients. We give them the ability to control page content, add blogs and news feeds, contact forms, etc. while still adding in those behind the scenes features like caching systems, link structure control, SEO control, image uploading, etc. With the amount of sites on this CMS, it was starting to become difficult to keep them all actively updated, as we would have to login to their site, upload new files, synchronize the database, and then insert any new&nbsp; site settings that were implemented.</p>
<p>All of the big content management systems have auto update systems. Zen Cart, Drupal, WordPress, Joomla, etc. all have this built in as a core function and now we do too. We have simply added a link on our administrator menu that says, &#39;System Update&#39;. When clicked, the site checks our server for a list of available updates and downloads the next update that is needed for the CMS. Quick and painless, right? Well, here&#39;s the code:</p>
<p><strong>Just a note: BACK UP YOUR FILES before you attempt any of this. This is a FREE script I&#39;m handing out. No promises that it will work with your server or your CMS. It will have to be reconfigured a tad to work with anything you might be working with.</strong></p>
<div class="code">&lt;h1&gt;DYNAMIC UPDATE SYSTEM&lt;/h1&gt;<br />
&lt;?<br />
ini_set(&#39;max_execution_time&#39;,60);</p>
<p>//Check for an update. We have a simple file that has a new release version on each line. (1.00, 1.02, 1.03, etc.)<br />
$getVersions = file_get_contents(&#39;http://your-server.com/CMS-UPDATE-PACKAGES/current-release-versions.php&#39;) or die (&#39;ERROR&#39;);<br />
if ($getVersions != &#39;&#39;)<br />
{<br />
&nbsp;&nbsp;&nbsp; //If we managed to access that file, then lets break up those release versions into an array.<br />
&nbsp;&nbsp;&nbsp; echo &#39;&lt;p&gt;CURRENT VERSION: &#39;.get_siteInfo(&#39;CMS-Version&#39;).&#39;&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;echo &#39;&lt;p&gt;Reading Current Releases List&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;$versionList = explode(&quot;\n&quot;, $getVersions);&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;foreach ($versionList as $aV)<br />
&nbsp;&nbsp; &nbsp;{<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; if ( $aV &gt; get_siteInfo(&#39;CMS-Version&#39;)) {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo &#39;&lt;p&gt;New Update Found: v&#39;.$aV.&#39;&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $found = true;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Download The File If We Do Not Have It<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( !is_file(&nbsp; $_ENV[&#39;site&#39;][&#39;files&#39;][&#39;includes-dir&#39;].&#39;/UPDATES/MMD-CMS-&#39;.$aV.&#39;.zip&#39; )) {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo &#39;&lt;p&gt;Downloading New Update&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $newUpdate = file_get_contents(&#39;http://your-server.com/CMS-UPDATE-PACKAGES/MMD-CMS-&#39;.$aV.&#39;.zip&#39;);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( !is_dir( $_ENV[&#39;site&#39;][&#39;files&#39;][&#39;includes-dir&#39;].&#39;/UPDATES/&#39; ) ) mkdir ( $_ENV[&#39;site&#39;][&#39;files&#39;][&#39;includes-dir&#39;].&#39;/UPDATES/&#39; );<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $dlHandler = fopen($_ENV[&#39;site&#39;][&#39;files&#39;][&#39;includes-dir&#39;].&#39;/UPDATES/MMD-CMS-&#39;.$aV.&#39;.zip&#39;, &#39;w&#39;);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( !fwrite($dlHandler, $newUpdate) ) { echo &#39;&lt;p&gt;Could not save new update. Operation aborted.&lt;/p&gt;&#39;; exit(); }<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fclose($dlHandler);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo &#39;&lt;p&gt;Update Downloaded And Saved&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else echo &#39;&lt;p&gt;Update already downloaded.&lt;/p&gt;&#39;;&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ($_GET[&#39;doUpdate&#39;] == true) {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Open The File And Do Stuff<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $zipHandle = zip_open($_ENV[&#39;site&#39;][&#39;files&#39;][&#39;includes-dir&#39;].&#39;/UPDATES/MMD-CMS-&#39;.$aV.&#39;.zip&#39;);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo &#39;&lt;ul&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; while ($aF = zip_read($zipHandle) )<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $thisFileName = zip_entry_name($aF);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $thisFileDir = dirname($thisFileName);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Continue if its not a file<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( substr($thisFileName,-1,1) == &#39;/&#39;) continue;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Make the directory if we need to...<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( !is_dir ( $_ENV[&#39;site&#39;][&#39;files&#39;][&#39;server-root&#39;].&#39;/&#39;.$thisFileDir ) )<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;mkdir ( $_ENV[&#39;site&#39;][&#39;files&#39;][&#39;server-root&#39;].&#39;/&#39;.$thisFileDir );<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;echo &#39;&lt;li&gt;Created Directory &#39;.$thisFileDir.&#39;&lt;/li&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Overwrite the file<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( !is_dir($_ENV[&#39;site&#39;][&#39;files&#39;][&#39;server-root&#39;].&#39;/&#39;.$thisFileName) ) {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo &#39;&lt;li&gt;&#39;.$thisFileName.&#39;...........&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $contents = zip_entry_read($aF, zip_entry_filesize($aF));<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $contents = str_replace(&quot;\r\n&quot;, &quot;\n&quot;, $contents);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $updateThis = &#39;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //If we need to run commands, then do it.<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( $thisFileName == &#39;upgrade.php&#39; )<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $upgradeExec = fopen (&#39;upgrade.php&#39;,&#39;w&#39;);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fwrite($upgradeExec, $contents);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fclose($upgradeExec);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; include (&#39;upgrade.php&#39;);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; unlink(&#39;upgrade.php&#39;);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo&#39; EXECUTED&lt;/li&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $updateThis = fopen($_ENV[&#39;site&#39;][&#39;files&#39;][&#39;server-root&#39;].&#39;/&#39;.$thisFileName, &#39;w&#39;);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fwrite($updateThis, $contents);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fclose($updateThis);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; unset($contents);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo&#39; UPDATED&lt;/li&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo &#39;&lt;/ul&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $updated = TRUE;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else echo &#39;&lt;p&gt;Update ready. &lt;a href=&quot;?doUpdate=true&quot;&gt;&amp;raquo; Install Now?&lt;/a&gt;&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp; &nbsp;}<br />
&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;if ($updated == true)<br />
&nbsp;&nbsp; &nbsp;{<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; set_setting(&#39;site&#39;,&#39;CMS&#39;,$aV);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; echo &#39;&lt;p class=&quot;success&quot;&gt;&amp;raquo; CMS Updated to v&#39;.$aV.&#39;&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;}<br />
&nbsp;&nbsp; &nbsp;else if ($found != true) echo &#39;&lt;p&gt;&amp;raquo; No update is available.&lt;/p&gt;&#39;;<br />
<br />
&nbsp;&nbsp; &nbsp;<br />
}<br />
else echo &#39;&lt;p&gt;Could not find latest realeases.&lt;/p&gt;&#39;;</div>
<p>I&#39;ll walk you through the main key parts of this file to make things a bit simpler when it&#39;s time to use it yourself. Essentially, what we are doing is checking the server for a list of current release versions. This a simple text file with a new line for each release version. (1.00, 1.02, 1.03, etc.) We take this list and turn it into an array and compare it to whatever version we currently have installed. Our CMS stores everything in a variable for us to access, so calling get_setting(&#39;site&#39;,&#39;CMS-Version); returns the numerical version of the CMS we are currently running .</p>
<div class="code">$getVersions = file_get_contents(&#39;http://your-server.com/CMS-UPDATE-PACKAGES/current-release-versions.php&#39;) or die (&#39;ERROR&#39;);<br />
if ($getVersions != &#39;&#39;)<br />
{<br />
&nbsp;&nbsp;&nbsp; //If we managed to access that file, then lets break up those release versions into an array.<br />
&nbsp;&nbsp;&nbsp; echo &#39;&lt;p&gt;CURRENT VERSION: &#39;.get_siteInfo(&#39;CMS-Version&#39;).&#39;&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;echo &#39;&lt;p&gt;Reading Current Releases List&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;$versionList = explode(&quot;\n&quot;, $getVersions);&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;foreach ($versionList as $aV)<br />
&nbsp;&nbsp; &nbsp;{<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; if ( $aV &gt; get_siteInfo(&#39;CMS-Version&#39;)) {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo &#39;&lt;p&gt;New Update Found: v&#39;.$aV.&#39;&lt;/p&gt;&#39;;</div>
<p>We loop through our list of new releases until we find one newer than the current release. When a new release is uploaded to the server, it is uploaded as a ZIP file with the same naming format as the previous - MMD-CMS-[VERSIONNUMBER].zip. We can use PHP to download this file from our update server and save it to a temporary folder. We give the user the option to either update now or later. Since the file is saved, there will be no need to download it again. Of course, we check to make sure our temporary folder exists before trying to save the file there.</p>
<p>Looking at the code below, we first check to make sure the file has not been downloaded already. If it has, then great - let&#39;s continue. Otherwise, let&#39;s download it. We use file_get_contents to download the file. Once downloaded, we create the file to store it if it doesn&#39;t exist. Using fopen and fwrite, we can create the file and then toss this newly uploaed information inside. Close our fwrite, and unset our downloaded file - the user will now get a choice to install now or later.</p>
<div class="code">//Download The File If We Do Not Have It<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( !is_file(&nbsp; $_ENV[&#39;site&#39;][&#39;files&#39;][&#39;includes-dir&#39;].&#39;/UPDATES/MMD-CMS-&#39;.$aV.&#39;.zip&#39; )) {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo &#39;&lt;p&gt;Downloading New Update&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $newUpdate = file_get_contents(&#39;http://your-server.com/CMS-UPDATE-PACKAGES/MMD-CMS-&#39;.$aV.&#39;.zip&#39;);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( !is_dir( $_ENV[&#39;site&#39;][&#39;files&#39;][&#39;includes-dir&#39;].&#39;/UPDATES/&#39; ) ) mkdir ( $_ENV[&#39;site&#39;][&#39;files&#39;][&#39;includes-dir&#39;].&#39;/UPDATES/&#39; );<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $dlHandler = fopen($_ENV[&#39;site&#39;][&#39;files&#39;][&#39;includes-dir&#39;].&#39;/UPDATES/MMD-CMS-&#39;.$aV.&#39;.zip&#39;, &#39;w&#39;);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( !fwrite($dlHandler, $newUpdate) ) { echo &#39;&lt;p&gt;Could not save new update. Operation aborted.&lt;/p&gt;&#39;; exit(); }<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fclose($dlHandler);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo &#39;&lt;p&gt;Update Downloaded And Saved&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unset($newUpdate);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else echo &#39;&lt;p&gt;Update already downloaded.&lt;/p&gt;&#39;;</div>
<p>At this point our file is downloaded, and we toss a link out to our user to see if they want to install now.</p>
<div class="code">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ($_GET[&#39;doUpdate&#39;] == true) {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Open The File And Do Stuff&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else echo &#39;&lt;p&gt;Update ready. &lt;a href=&quot;?doUpdate=true&quot;&gt;&amp;raquo; Install Now?&lt;/a&gt;&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;</div>
<p>We use break; to stop our foreach loop that is looking at our update list. We don&#39;t want to download a bunch of updates at once.</p>
<p>When they click that &#39;Install Now&#39; link, we go ahead come back to this page. Since we have our download check up above, we don&#39;t need to worry about the script re-downloading the file. Now, we open our download and start to utilize the contents of the zip. zip_open was not readily available on our server, so we went ahead and recompiled apache and PHP to support it - that&#39;s another lesson in itself. Most servers will have it available. zip_open(); takes your zip file and opens it. Utilizing a while() loop, we use a mysql-like approach with the file. We loop through all of it&#39;s contents and place them on the server.</p>
<p>zip_entry_name() retrieves the filename of the file that we are currently looking at with zip_read. If our entry name ends with a slash, we skip and goto the next file. A note: zip_entry_name() will give the filename AND directory structure for the file, for example:</p>
<div class="code">/support/includes/functions.php</div>
<p>We will use this to our advantage.</p>
<p>Sometimes when we make updates, we add new folders. For example, our caching plugin added a new folder to hold temporary files. Part of our script is to make sure all of our folders exist, so we go ahead and make sure all of our files have an accompanying dir. Using dirname() with zip_entry_name, and combining it with $_SERVER[&#39;DOCUMENT_ROOT&#39;], we can make sure we have all relative folder trees. On our CMS, we store our DOCUMENT_ROOT in an $_ENV variable for instances where we are installed in a subfolder.</p>
<div class="code">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Open The File And Do Stuff<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $zipHandle = zip_open($_ENV[&#39;site&#39;][&#39;files&#39;][&#39;includes-dir&#39;].&#39;/UPDATES/MMD-CMS-&#39;.$aV.&#39;.zip&#39;);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo &#39;&lt;ul&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; while ($aF = zip_read($zipHandle) )<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $thisFileName = zip_entry_name($aF);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $thisFileDir = dirname($thisFileName);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Continue if its not a file<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( substr($thisFileName,-1,1) == &#39;/&#39;) continue;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Make the directory if we need to...<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( !is_dir ( $_ENV[&#39;site&#39;][&#39;files&#39;][&#39;server-root&#39;].&#39;/&#39;.$thisFileDir ) )<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;mkdir ( $_ENV[&#39;site&#39;][&#39;files&#39;][&#39;server-root&#39;].&#39;/&#39;.$thisFileDir );<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;echo &#39;&lt;li&gt;Created Directory &#39;.$thisFileDir.&#39;&lt;/li&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</div>
<p>After we have made sure our directory exists, we simply place the file we are currently looking at. zip_entry_read() pulls the contents of the file. You need to use this with zip_entry_filesize, which returns the size of the file, or you will end up with only the first few lines of your files. For one reason or another, our unzipped files all ended up with erratic line spacing. We use str_replace to remove this spacing and turn out files back to normal form.</p>
<div class="code">&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Overwrite the file<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( !is_dir($_ENV[&#39;site&#39;][&#39;files&#39;][&#39;server-root&#39;].&#39;/&#39;.$thisFileName) ) {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo &#39;&lt;li&gt;&#39;.$thisFileName.&#39;...........&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $contents = zip_entry_read($aF, zip_entry_filesize($aF));<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $contents = str_replace(&quot;\r\n&quot;, &quot;\n&quot;, $contents);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $updateThis = &#39;&#39;;</div>
<p>At this point we are actually going to place the file. We have included an upgrade.php file that contains PHP code to execute when running an update. This may include database changes, setting changes, etc. or might not exist at all. If our current file name is &#39;upgrade.php&#39;, we grab the contents, write it to our current directory, include it to run any code inside, then delete the file. No big deal ,right?</p>
<div class="code">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //If we need to run commands, then do it.<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( $thisFileName == &#39;upgrade.php&#39; )<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $upgradeExec = fopen (&#39;upgrade.php&#39;,&#39;w&#39;);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fwrite($upgradeExec, $contents);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fclose($upgradeExec);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; include (&#39;upgrade.php&#39;);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; unlink(&#39;upgrade.php&#39;);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo&#39; EXECUTED&lt;/li&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</div>
<p>If our file is NOT &#39;upgrade.php&#39;, we go ahead and overwrite or create the file that already exists. fwrite(); will overwrite an existing file, or create if it doesn&#39;t exist. Since our zip file contains all of our files in the proper directory format, it makes this REALLY easy for us. Again, DOCUMENT_ROOT + our file name (which includes the zip&#39;s document path). Open the file, place the zip&#39;s contents inside, and close your fwrite.</p>
<div class="code">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $updateThis = fopen($_ENV[&#39;site&#39;][&#39;files&#39;][&#39;server-root&#39;].&#39;/&#39;.$thisFileName, &#39;w&#39;);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fwrite($updateThis, $contents);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fclose($updateThis);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; unset($contents);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo&#39; UPDATED&lt;/li&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</div>
<p>At this point our file loop will go through all of our files and do what it needs to do with them. The loop ends and we let the user know. Set a variable to tell the script that we updated, and the code at the bottom of the script will let the user know. Our CMS function, set_setting() will update the database of our new version. Since we stopped our foreach loop, $aV will hold the number of our latest version.</p>
<div class="code"> &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; echo &#39;&lt;/ul&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $updated = TRUE;</div>
<div class="code">&nbsp;&nbsp;&nbsp; if ($updated == true)<br />
&nbsp;&nbsp; &nbsp;{<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; set_setting(&#39;site&#39;,&#39;CMS&#39;,$aV);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; echo &#39;&lt;p class=&quot;success&quot;&gt;&amp;raquo; CMS Updated to v&#39;.$aV.&#39;&lt;/p&gt;&#39;;<br />
&nbsp;&nbsp; &nbsp;}<br />
&nbsp;&nbsp; &nbsp;else if ($found != true) echo &#39;&lt;p&gt;&amp;raquo; No update is available.&lt;/p&gt;&#39;;</div>
<p>I managed to make this script in about two hours. I hope I saved somebody some time with it. You can download the source files below with an example of a simple update I might put up. Make sure you format these files to work with your system.</p>
<h2>
	Download Source Files</h2>
<p><a href="http://maxmorgandesign.com/downloads/php-auto-updater-1.0.zip">&raquo; Download Source Files</a></p>
<h2>
	Screenshots</h2>
<p><img alt="Update Image In Admin Menu" src="http://maxmorgandesign.com/images/uploaded/2011/01/php-updater-1-lg.jpg" /></p>
<p>Our Admin Menu With Update Link</p>
<p><img alt="Update Screen After Download" src="http://maxmorgandesign.com/images/uploaded/2011/01/php-updater-2-lg.jpg" /></p>
<p>Updater Showing New Install Available</p>
<p><img alt="Update Screen During Install" src="http://maxmorgandesign.com/images/uploaded/2011/01/php-updater-3-lg.jpg" /></p>
<p>Update Install Output</p>
<p><img alt="Update Screen After Install" src="http://maxmorgandesign.com/images/uploaded/2011/01/php-updater-4-lg.jpg" /></p>
<p>Update Check After Install</p> ]]></content:encoded>
                </item>
							<item>
				<title>SEO Friendly .htaccess 301 Redirects</title>
				<link>http://maxmorgandesign.com/seo_friendly_htaccess_301_redirects/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/seo_friendly_htaccess_301_redirects//</guid>
				<comments>http://maxmorgandesign.com/seo_friendly_htaccess_301_redirects/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ Quick and easy htaccess code snippet to save you some negative points when doing website redesigns or changing filenames on your websites ]]></description>
                                <content:encoded><![CDATA[ <p>Quick and easy htaccess code snippet to save you some negative points when doing website redesigns or changing filenames on your websites. This is a GOOGLE friendly way of redirecting your old file locations to new ones. Google typically picks up on these in about a week or two after you first upload.</p>
<p>You can toss this in your .htaccess to tell your server where to send your clients when they try and access a file.&nbsp; This is called a &lt;b&gt;301 redirect&lt;/b&gt;, which essentially tells search engines and browsers that your file has been &lt;b&gt;temporarily moved&lt;/b&gt;.</p>
<div class="code">redirect 301 /folder/filename.html http://domain.com/newfolder/newfilename.php</div>
<p>This also works if you want to redirect a folder.</p>
<div class="code">redirect 301 /folder/ http://domain.com/newfolder/</div>
<p>As always, you can put as many of these as necessary in your htaccess file. I have a client with a good twenty or thirty of these with no issues. Just make sure you don&#39;t accidentally redirect a file or folder that is in use.</p> ]]></content:encoded>
                </item>
							<item>
				<title>Forcing File Downloads With htaccess</title>
				<link>http://maxmorgandesign.com/forcing_file_downloads_with_htaccess/</link>
				<category>http://maxmorgandesign.comResources, Guides and Information</category>
				<guid isPermaLink="false">/forcing_file_downloads_with_htaccess//</guid>
				<comments>http://maxmorgandesign.com/forcing_file_downloads_with_htaccess/#comments</comments>
				<pubDate>Fri, 18 May 2012 17:45:57 -0700</pubDate>
				<description><![CDATA[ I was asked how we could force a user to &#039;download&#039; a file without using php to alter the header. This htaccess script will force users to DOWNLOAD anything a folder, rather than viewing it in their browser. Really useful when you want to do things like music downloads, image donwloads, etc. ]]></description>
                                <content:encoded><![CDATA[ <p>I was asked how we could force a user to &#39;download&#39; a file without using php to alter the header. This htaccess script will force users to DOWNLOAD anything a folder, rather than viewing it in their browser. Really useful when you want to do things like music downloads, image donwloads, etc. because it saves the user the step of File &gt; Save As, then navigating back to your site. The example below applies to ANY file in the directory and any children of the directory that your .htaccess file resides.</p>
<div class="code">&lt;files *.*&gt;<br />
ForceType applicaton/octet-stream<br />
&lt;/files&gt;</div>
<p>Simply link to a file in your folder with this snippet, and any file accessed will have to be downloaded. We can even restrict this to certain filetypes. In this case below, it is only applied to mp3 files.</p>
<div class="code">&lt;files *.mp3&gt;<br />
ForceType applicaton/octet-stream<br />
&lt;/files&gt;</div> ]]></content:encoded>
                </item>
				</channel>
</rss>

