<?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>I-Am-Bot &#187; download</title>
	<atom:link href="http://iambot.net/tag/download/feed/" rel="self" type="application/rss+xml" />
	<link>http://iambot.net</link>
	<description>Code, technology and life</description>
	<lastBuildDate>Sat, 28 Aug 2010 16:00:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Introducing TinyPop</title>
		<link>http://iambot.net/2010/08/introducing-tinypop/</link>
		<comments>http://iambot.net/2010/08/introducing-tinypop/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 11:34:58 +0000</pubDate>
		<dc:creator>Srinath</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://iambot.net/?p=434</guid>
		<description><![CDATA[&#160; TinyPop is a lightweight (1.5 KB minified) JavaScript for Growl like notifications. It can be used as an alternative to jGrowl when you don't want to use jQuery for a simple task. Details Download Demo]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>TinyPop is a lightweight (1.5 KB minified) JavaScript for <a href="http://en.wikipedia.org/wiki/Growl_%28software%29">Growl</a> like notifications. It can be used as an alternative to <a href="http://www.stanlemon.net/projects/jgrowl.html">jGrowl</a> when you don't want to use jQuery for a simple task. </p>
<p><strong><a href="http://iambot.net/projects/tinypop/">Details</a></strong></p>
<p><strong><a href="http://iambot.net/dScript/download.php?fname=./tinypop.zip">Download</a></strong></p>
<p><strong><a href="http://iambot.net/demo/tinypop/">Demo</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://iambot.net/2010/08/introducing-tinypop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpUserAuth Released!</title>
		<link>http://iambot.net/2010/07/phpuserauth-released/</link>
		<comments>http://iambot.net/2010/07/phpuserauth-released/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 02:04:13 +0000</pubDate>
		<dc:creator>Srinath</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://iambot.net/?p=426</guid>
		<description><![CDATA[It's finally done! The package is up for grabs, with a quick starter guide. Details Download Demo Please go through the project page for more details! The Readme.txt file inside folder "readme" contains instructions for installation and usage Leave your comments/questions/suggestions on the project page. Out.]]></description>
			<content:encoded><![CDATA[<p>It's finally done! The package is up for grabs, with a quick starter guide.</p>
<p><strong><a href="http://iambot.net/projects/phpuserauth/">Details</a></strong></p>
<p><strong><a href="http://iambot.net/dScript/download.php?fname=./phpuserauth.zip">Download</a></strong></p>
<p><strong><a href="http://iambot.net/demo/phpuserauth/">Demo</a></strong></p>
<p>Please go through the project page for more details!</p>
<p>The Readme.txt file inside folder "readme" contains instructions for installation and usage</p>
<p>Leave your comments/questions/suggestions on the project page.</p>
<p>Out.</p>
]]></content:encoded>
			<wfw:commentRss>http://iambot.net/2010/07/phpuserauth-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing phpUserAuth</title>
		<link>http://iambot.net/projects/phpuserauth/</link>
		<comments>http://iambot.net/projects/phpuserauth/#comments</comments>
		<pubDate>Sun, 23 May 2010 03:23:44 +0000</pubDate>
		<dc:creator>Srinath</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://iambot.net/?p=383</guid>
		<description><![CDATA[Update: Please visit the project page for more details After weeks of fighting with myself, I finally got down to work on something that has been on my mind for sometime now. Yes, it is yet another user authentication/management system in PHP. There are already some great ones out there, and some not so good [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update: Please visit the <a href="http://iambot.net/projects/phpuserauth/">project page</a> for more details</strong></p>
<p>After weeks of fighting with myself, I finally got down to work on something that has been <a href="http://iambot.net/2010/03/status-update/">on my mind</a> for sometime now. Yes, it is <em>yet</em> another user authentication/management system in PHP. There are already some great ones out there, and some not so good ones. I wanted a system that was secure, flexible, and easy to work with. What took me an entire week of effort is presented below. Without further delay, presenting <strong>phpUserAuth</strong></p>
<p><strong>Features</strong></p>
<ul>
<li> Secure with support for sessions based and/or cookie based authentication</li>
<li> Tons of configuration option for those who know what they are doing. For others, its easy as a cake!</li>
<li> Passwords are *always* hashed before they are sent over the network, with fallback to plain text if JavaScript is not supported in the browser</li>
<li> Only salted, hashed passwords are saved in the database. Even if the DB is stolen, it is almost impossible to get the original password</li>
<li> Support for multiple simultaneous sessions or a single active session </li>
<li> Administrator can choose how users are activated after they signup. It can be automatic activation, manual activation by the admin, or an activation mail can be sent to the user </li>
<li> Password is <strong>NEVER</strong> sent over the email. If the user forgets his password, he can request a password reset mail. </li>
<li> User defined access control levels</li>
<li> Flexible. If the administrator wants to add another field, simply updated the configuration file, and put the field in the signup form! The rest is taken care of by the script!</li>
<li> Prevention from XSS attacks - all data sent to the server is cleaned using the excellent <a href="http://www.phpclasses.org/package/2189-PHP-Filter-out-unwanted-PHP-Javascript-HTML-tags-.html">InputFilter</a> class</li>
<li> Support for template based HTML email notifications with changeable templates</li>
<li> Emailing done through the excellent <a href="http://sourceforge.net/projects/phpmailer/">PHPMailer</a> with support for SMTP+SSL</li>
<li> Custom redirection after login/logout </li>
<li> Pre-designed forms </li>
<li> Snap in install - Simply drop the folder into your existing application, configure a few site options and database settings, and you are done! </li>
</ul>
<p><strong>Requirements</strong></p>
<ul>
<li> PHP 5+ as the core classes are OO </li>
<li> MySQLi support </li>
<li> MySQL 5+ database server </li>
</ul>
<p>Is that too much to ask? That being said, if you run a fairly recent server, all these should be there by default. For testing, you can check out <a href="http://apachefriends.org">XAMPP</a> which is available for Windows, Mac and Linux!</p>
<p><strong> License </strong><br />
I'm planning to release it under some open source license. If that doesn't work out, it will still be <strong>FREE</strong></p>
<p><strong> Download </strong><br />
It is not <em>completely</em> done yet. The admin area needs some work. So it will be released, when its done</p>
<p><strong> Notes</strong><br />
1) As always, it isn't perfect! If you find any bugs, errors, or know a way where things can be done better, please leave a comment!<br />
2) The application hasn't been profiled yet. There WILL be places where I might have  complicated things. Will be taken care of after its been released</p>
]]></content:encoded>
			<wfw:commentRss>http://iambot.net/projects/phpuserauth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loud SMS/Ringtones for iPhone</title>
		<link>http://iambot.net/2010/05/loud-smsringtones-for-iphone/</link>
		<comments>http://iambot.net/2010/05/loud-smsringtones-for-iphone/#comments</comments>
		<pubDate>Thu, 06 May 2010 06:14:21 +0000</pubDate>
		<dc:creator>Srinath</dc:creator>
				<category><![CDATA[apple]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[mobiles]]></category>

		<guid isPermaLink="false">http://iambot.net/?p=349</guid>
		<description><![CDATA[If you use an iPhone, you know the ringtones that come with it suck. Big time. They aren't loud enough to hear if you carry the phone in your pocket. After much searching, I've stumbled upon a ringtone that is really loud, and does the job well. As a bonus, there are 3 tones for [...]]]></description>
			<content:encoded><![CDATA[<p>If you use an iPhone, you know the ringtones that come with it suck. Big time. They aren't loud enough to hear if you carry the phone in your pocket. After much searching, I've stumbled upon a ringtone that is really loud, and does the job well. As a bonus, there are 3 tones for SMS which are slightly louder than the ones built in.</p>
<p>For the ringtone, download the .m4r file <a href="http://iambot.net/dScript/download.php?fname=./iPhone/Tritone.m4r">here</a>. Simply drag the file to iTunes, and it will show up as a new ringtone. Then you can sync your iPhone and voila, the tone will magically pop up in the Settings -&gt; Sounds -&gt; Ringtone menu.</p>
<p>To replace the SMS tones, you will need to access the filesystem on the iPhone, and then replace a couple of files.</p>
<ul>
<li>This can be done either via <a href="http://www.appleiphoneschool.com/openssh/" target="_blank">openSSH</a> (if your phone is jailbroken) or you can use a program like <a href="http://code.google.com/p/iphonebrowser/" target="_blank">iPhoneBrowser</a></li>
<li>Navigate to /System/Library/Audio/UISounds directory</li>
<li>The tones have the extension .caf. You will find 6 files named as sms-received1.caf to sms-received6.caf</li>
<li>The iPhone OS does not allow us to add new SMS tones. Even if you drop in a new tone as sms-received7.caf, the tone will not pop up in the menu. So you will have to replace the tones that you do not like with the newer tones</li>
<li>Get the 3 tones <a href="http://iambot.net/dScript/" target="_blank">here</a>. Expand the iPhone tab, and download the 3 .caf files</li>
<li>Rename the files to the tones you want to replace (by default, the files will replace the last 3 tones, that is Horn, bell and electronic)</li>
<li>Make a backup of the original files in the directory and replace the new files</li>
<li>Goto Settings -&gt; Sounds -&gt; New Text Message and select the tones that you replaced. Note that the name of the tones will still be the same, but the actual tone would have changed by now</li>
</ul>
<p>And thats that. Drop in your comments/doubts if any.</p>
]]></content:encoded>
			<wfw:commentRss>http://iambot.net/2010/05/loud-smsringtones-for-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a Mac OSX finder like download script using PHP</title>
		<link>http://iambot.net/2009/05/mac-osx-finder-download-script/</link>
		<comments>http://iambot.net/2009/05/mac-osx-finder-download-script/#comments</comments>
		<pubDate>Thu, 21 May 2009 16:26:20 +0000</pubDate>
		<dc:creator>Srinath</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://iambot.net/?p=83</guid>
		<description><![CDATA[This is a small tutorial/article on how to create a Mac OSX Finder like navigation page and to use it to list and download files that you have.  A screen shot below for people who do not know how it looks. It can be used as a simple yet elegant download script. DEMO DOWNLOAD Before [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">This is a small tutorial/article on how to create a Mac OSX Finder like navigation page and to use it to list and download files that you have.  A screen shot below for people who do not know how it looks. It can be used as a simple yet elegant download script.</p>
<p style="text-align: center;"><a href="http://mercury.indservers.com/~iambotne/wp-content/uploads/2009/05/500px-osx_finder_columnview.jpg"><img class="size-medium wp-image-85 aligncenter" title="500px-osx_finder_columnview" src="http://iambot.net/wp-content/uploads/2009/05/500px-osx_finder_columnview-300x229.jpg" alt="500px-osx_finder_columnview" width="300" height="229" /></a></p>
<p style="text-align: center;"><span id="more-83"></span></p>
<h3 style="text-align: center;"><a href="http://iambot.net/demo/finder/" target="_blank">DEMO</a></h3>
<h3 style="text-align: center;"><a href="http://iambot.net/dScript/download.php?fname=./finder.zip" target="_blank">DOWNLOAD<br />
</a></h3>
<h2 style="text-align: left;"><strong>Before you start</strong></h2>
<p>This script uses PHP/jQuery and a couple of its plugins, and some help from the internet. Since I don't remember all the sources I've used, I'd like to thank the original authors of parts of this script.</p>
<h2><strong>Step 1:</strong></h2>
<p>We first need to create a list of all files and folders within the current directory. Let us assume your main directory is "download" and you need to list all the files and folders inside it. Create a new file in your favourite text editor and name it as index.php. Copy the following 'scan_directory_recursively' function which returns an array containing a list of all directories and files</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> scan_directory_recursively<span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory</span><span style="color: #339933;">,</span> <span style="color: #000088;">$filter</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory</span><span style="color: #339933;">,-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$directory</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_readable</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$directory_list</span> <span style="color: #339933;">=</span> <span style="color: #990000;">opendir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">readdir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory_list</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'.'</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$file</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'..'</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$directory</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$file</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_readable</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$subdirectories</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span><span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
					<span style="color: #009900;">&#123;</span>
						<span style="color: #000088;">$directory_tree</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
							<span style="color: #0000ff;">'path'</span>      <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$path</span><span style="color: #339933;">,</span>
							<span style="color: #0000ff;">'name'</span>      <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">end</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$subdirectories</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
							<span style="color: #0000ff;">'kind'</span>      <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'directory'</span><span style="color: #339933;">,</span>
							<span style="color: #0000ff;">'content'</span>   <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> scan_directory_recursively<span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #339933;">,</span> <span style="color: #000088;">$filter</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_file</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
					<span style="color: #009900;">&#123;</span>
						<span style="color: #000088;">$extension</span> <span style="color: #339933;">=</span> <span style="color: #990000;">end</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">,</span><span style="color: #990000;">end</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$subdirectories</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
						<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filter</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">FALSE</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$filter</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$extension</span><span style="color: #009900;">&#41;</span>
						<span style="color: #009900;">&#123;</span>
							<span style="color: #000088;">$directory_tree</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
							<span style="color: #0000ff;">'path'</span>		<span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$path</span><span style="color: #339933;">,</span>
							<span style="color: #0000ff;">'name'</span>		<span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">end</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$subdirectories</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
							<span style="color: #0000ff;">'extension'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$extension</span><span style="color: #339933;">,</span>
							<span style="color: #0000ff;">'size'</span>		<span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">filesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
							<span style="color: #0000ff;">'kind'</span>		<span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'file'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
						<span style="color: #009900;">&#125;</span>
					<span style="color: #009900;">&#125;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #990000;">closedir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory_list</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #339933;">@</span><span style="color: #000088;">$directory_tree</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;</span>strong<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>strong<span style="color: #339933;">&gt;</span></pre></div></div>

<h2><strong>Step 2</strong></h2>
<p>Once we have the array containing all the files and folders, we have to create a DIV for the navigation window. Create a div with id="fileTree". Now we need another recursive function that takes the array from the above function as input, and prints the files and folders with the correct nested tags. Remember, to create the correct interface, the output should be in the form of:</p>
<blockquote><p>&lt;div id="fileTree"&gt;<br />
&lt;ul&gt;&lt;div&gt;<br />
&lt;li&gt; Folder 1<br />
&lt;ul&gt;&lt;div&gt;<br />
&lt;li&gt; Folder 1/A<br />
&lt;ul&gt;&lt;div&gt;<br />
&lt;li&gt; Folder 1/A File 1&lt;/li&gt;<br />
&lt;li&gt; Folder 1/A File 2&lt;/li&gt;<br />
&lt;/div&gt;&lt;/ul&gt;<br />
&lt;/li&gt;<br />
&lt;li&gt; Folder 1/B &lt;/li&gt;<br />
&lt;/li&gt;<br />
&lt;li&gt; Folder 2 &lt;/li&gt;<br />
&lt;li&gt; File 1 &lt;/li&gt;<br />
&lt;li&gt; File 2 &lt;/li&gt;<br />
&lt;/div&gt;&lt;/ul&gt;<br />
&lt;/div&gt;</p></blockquote>
<p>There is an extra div for each column as the columnnav plugin requires it. Each nested &lt;ul&gt;&lt;div&gt; creates a new column. We now have to print the files and folders in the correct format. The following function does just that</p>
<blockquote><p>function create_nested_list($items) {<br />
$out = '&lt;ul&gt;';<br />
global $ignore;<br />
foreach ($items as $item) {<br />
if (in_array($item['name'],$ignore)) {<br />
continue;<br />
}<br />
$out .= '&lt;li&gt;';<br />
if ($item['kind'] == 'directory') {<br />
$out .= '&lt;a href="#"&gt;';<br />
$out .= $item['name'];<br />
$out .= '&lt;/a&gt;';<br />
if ($item['content']) {<br />
$out .= create_nested_list($item['content']);<br />
}<br />
}<br />
else if($item['kind'] == 'file') {<br />
$out .= '&lt;a href="download.php?file=' . $item['path'] . '"&gt;';<br />
$out .= $item['name'];<br />
$out .= '&lt;/a&gt;';<br />
}<br />
$out .= '&lt;/li&gt;';<br />
}<br />
$out .= '&lt;/ul&gt;';<br />
return $out;<br />
}</p></blockquote>
<p>What it does is for each array item with entry 'content' which means that its a directory and has files within it, the function calls itself, creates another div for the next column, and prints the file. For files, the download link is set as download.php with file name sent as GET parameter. To download a file one will have to double click the entry.</p>
<h2><strong>Step 3:</strong></h2>
<p>Now that the PHP functions are created, time for some javascript. Include the jquery.js, jquery-columnnav.js and jquery-scrollto.js files to the header of index.php. Now include the following javascript withing the &lt;script type="text/javascript"&gt;&lt;/script&gt; tags</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">		$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div#fileTree&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">columnNavigation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
			containerPosition<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;relative&quot;</span><span style="color: #339933;">,</span>
			containerWidth<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;600px&quot;</span><span style="color: #339933;">,</span>
			containerHeight<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;400px&quot;</span><span style="color: #339933;">,</span>
			containerBackgroundColor<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;rgb(255,255,255)&quot;</span><span style="color: #339933;">,</span>
			containerFontColor<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;rgb(50,50,50)&quot;</span><span style="color: #339933;">,</span>
			columnWidth<span style="color: #339933;">:</span><span style="color: #CC0000;">250</span><span style="color: #339933;">,</span>
			columnFontFamily<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;'Helvetica Neue', 'HelveticaNeue', Helvetica, sans-serif&quot;</span><span style="color: #339933;">,</span>
			columnFontSize<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;90%&quot;</span><span style="color: #339933;">,</span>
			columnSeperatorStyle<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;1px solid rgb(220,220,220)&quot;</span><span style="color: #339933;">,</span>
			columnDeselectFontWeight<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;normal&quot;</span><span style="color: #339933;">,</span>
			columnDeselectColor<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;rgb(50,50,50)&quot;</span><span style="color: #339933;">,</span>
			columnSelectFontWeight<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;normal&quot;</span><span style="color: #339933;">,</span>
			columnSelectColor<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;rgb(255,255,255)&quot;</span><span style="color: #339933;">,</span>
			columnSelectBackgroundColor<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;rgb(27,115,213)&quot;</span><span style="color: #339933;">,</span>
			columnSelectBackgroundImage<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;url('Includes/list-selected-background.jpg')&quot;</span><span style="color: #339933;">,</span>
			columnSelectBackgroundRepeat<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;repeat-x&quot;</span><span style="color: #339933;">,</span>
			columnSelectBackgroundPosition<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;top&quot;</span><span style="color: #339933;">,</span>
			columnItemPadding<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;3px 3px 5px 3px&quot;</span><span style="color: #339933;">,</span>
			columnScrollVelocity<span style="color: #339933;">:</span><span style="color: #CC0000;">50</span><span style="color: #339933;">,</span>
	 	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The above code sets many options of the columnnav plugin to match it with finder's looks and styling. Play around with the options for a customized look.</p>
<h2><strong>Step 4:</strong></h2>
<p>Include some CSS for styling</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">        body
	<span style="color: #00AA00;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">rgb</span><span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">100</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">100</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
		<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #993333;">rgb</span><span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">255</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">255</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
		<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">1em</span><span style="color: #00AA00;">;</span>
		<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span><span style="color: #ff0000;">'Helvetica Neue'</span><span style="color: #00AA00;">,</span> <span style="color: #ff0000;">'HelveticaNeue'</span><span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
	div<span style="color: #cc00cc;">#fileTree</span> a
	<span style="color: #00AA00;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">25px</span><span style="color: #00AA00;">;</span>
        <span style="color: #00AA00;">&#125;</span></pre></div></div>

<h2><strong>Step 5:</strong></h2>
<p>Put it all together, and call the PHP functions, print the output</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$fileList</span> <span style="color: #339933;">=</span> scan_directory_recursively<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Get list of files and folders in the current directory recursively</span>
<span style="color: #990000;">sort</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileList</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Sort the list</span>
<span style="color: #000088;">$out</span> <span style="color: #339933;">=</span> create_nested_list<span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileList</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Display details of the files/folders with the necessary column formatting</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$out</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Print the output</span></pre></div></div>

<h2><strong>Step6: </strong></h2>
<p>Now that the main page is ready, create another file download.php to initiate the file download</p>
<blockquote><p>&lt;?php<br />
$path = getcwd();<br />
// Get name of file to be downloaded<br />
$fname = $_GET['file'];<br />
//Check for various invalid files, and loop holes like ../ and ./<br />
if($fname == '.' || $fname == './' || $fname == "$path/download.php" || $fname == "$path/index.php" || !file_exists($fname) || empty($fname) || preg_match('/\..\/|\.\/\.|assets/',$fname))<br />
{<br />
echo "Invalid File or File Not Specified";<br />
exit(0);<br />
}</p>
<p>// Initiate force file download<br />
@header("Pragma: public");<br />
@header("Expires: 0");<br />
@header("Cache-Control: must-revalidate, post-check=0, pre-check=0");<br />
@header("Content-Type: application/force-download");<br />
@header("Content-Type: application/octet-stream");<br />
@header("Content-Type: application/download");<br />
@header("Content-Disposition: attachment; filename=\"".basename($fname)."\";" );<br />
@header("Content-Transfer-Encoding: binary");<br />
@header("Content-Length: ".filesize($fname));<br />
@readfile($fname);<br />
exit(0);<br />
?&gt;</p></blockquote>
<p>And Voila! Your files are now displayed in a easy to use page, and all files are forced to download and will NOT open in the browser. You can also link your files directly as "http://yoursite.com/download/download.php?file=&lt;filename&gt;". Customization is very easy, and can produce interesting results! So all the best!</p>
<p>Write your comments/suggestions/corrections below or email them to srinath [AT] iambot [DOT] net</p>
]]></content:encoded>
			<wfw:commentRss>http://iambot.net/2009/05/mac-osx-finder-download-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
