<?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>PHP User Social Network</title>
	<atom:link href="http://www.phper.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.phper.net</link>
	<description>talk php with friends.</description>
	<lastBuildDate>Mon, 18 Jul 2011 01:58:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How to redirect in php?</title>
		<link>http://www.phper.net/22/how-to-redirect-in-php</link>
		<comments>http://www.phper.net/22/how-to-redirect-in-php#comments</comments>
		<pubDate>Fri, 15 Jul 2011 16:22:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorials & Tips]]></category>
		<category><![CDATA[header php]]></category>
		<category><![CDATA[how to php redirect]]></category>
		<category><![CDATA[php header redirect]]></category>
		<category><![CDATA[php redirect code]]></category>
		<category><![CDATA[php redirect function]]></category>
		<category><![CDATA[php redirect header]]></category>
		<category><![CDATA[php redirect page]]></category>
		<category><![CDATA[php redirect script]]></category>
		<category><![CDATA[php redirect to page]]></category>
		<category><![CDATA[php response.redirect]]></category>
		<category><![CDATA[php timed redirect]]></category>
		<category><![CDATA[redirect in php]]></category>
		<category><![CDATA[redirect php]]></category>
		<category><![CDATA[redirect with php]]></category>
		<category><![CDATA[simple php redirect]]></category>

		<guid isPermaLink="false">http://www.phper.net/?p=22</guid>
		<description><![CDATA[how to redirect in HTML? As you know,redirect to other page in HTML is sample,and have many ways: &#60;head&#62; &#60;!-- Reload page after 10 seconds from page loaded. --&#62; &#60;meta...]]></description>
			<content:encoded><![CDATA[<h1><strong><strong>how to redirect in HTML?</strong></strong></h1>
<p>As you know,<strong>redirect to other page</strong> in HTML is sample,and have many ways:</p>
<p><code>
<pre>&lt;head&gt;
&lt;!-- Reload page after 10 seconds from page loaded. --&gt;
&lt;meta http-equiv="refresh" content="10"&gt;
&lt;!-- after 5 seconds redirect to page hello.html--&gt;
&lt;meta http-equiv="refresh" content="5;url=hello.<strong>html</strong>"&gt;
&lt;/head&gt;</pre>
<p></code></p>
<h1><strong><a title="redirect with php,php redirect function" href="http://www.phper.net/22/how-to-redirect-in-php">how to redirect in php</a>?</strong></h1>
<p>But,I was asked many times:<strong>how to redirect in php?</strong></p>
<p>Actually，there are a <a title="header php,redirect in php" href="http://www.phper.net/22/how-to-redirect-in-php "><strong>php redirect page function</strong></a>,it is <strong>header</strong>()</p>
<p>void <span style="color: #ff0000;"><strong>header</strong></span> ( string <span style="color: #ff6600;"><em><tt>$string</tt></em></span> [, bool <em><span style="color: #ff6600;"><tt>$replace</tt></span></em> = true [, int <em><span style="color: #ff6600;"><tt>$http_response_code</tt></span></em> ]] )</p>
<h3>How to use php header redirect function Parameters?</h3>
<p><span style="color: #ff0000;">Parameter <em><strong>$string</strong></em>:</span></p>
<p>The header string.</p>
<p>There are two special-case header calls. The first is a header that starts with the string &#8220;<em>HTTP/</em>&#8221; (case is not significant), which will be used to figure out the HTTP status code to send. For example, if you have configured Apache to use a PHP script to handle requests for missing files (using the <em>ErrorDocument</em> directive), you may want to make sure that your script generates the proper status code.</p>
<div>
<div>
<blockquote>
<div><code> &lt;?php<br /> header("HTTP/1.0 404 Not Found");<br /> ?&gt; </code></div>
</blockquote>
</div>
</div>
<p>For FastCGI you must use the following for a 404 response:</p>
<div>
<div>
<blockquote>
<div><code> &lt;?php<br /> header("Status: 404 Not Found");<br /> ?&gt; </code></div>
</blockquote>
</div>
</div>
<p>The second special case is the &#8220;Location:&#8221; header. Not only does it send this header back to the browser, but it also returns a <em>REDIRECT</em> (302) status code to the browser unless the <em>201</em> or a <em>3xx</em> status code has already been set.</p>
<div>
<div>
<blockquote>
<div><code> &lt;?php<br /> header("Location: http://www.example.com/"); /* Redirect browser */<br /> /* Make sure that code below does not get executed when we redirect. */<br /> exit;<br /> ?&gt; </code></div>
</blockquote>
</div>
</div>
<p><strong><span style="color: #ff0000;"><tt>Parameter <em>$replace</em></tt></span></strong>:</p>
<p>The optional <em><tt>replace</tt></em> parameter indicates whether the header should replace a previous similar header, or add a second header of the same type. By default it will replace, but if you pass in <strong><tt>FALSE</tt></strong> as the second argument you can force multiple headers of the same type. For example:</p>
<div>
<div>
<blockquote>
<div><code> &lt;?php<br /> header('WWW-Authenticate: Negotiate');<br /> header('WWW-Authenticate: NTLM', false);<br /> ?&gt; </code></div>
</blockquote>
</div>
</div>
<p><strong><span style="color: #ff0000;"><tt><tt>Parameter $</tt>http_response_code</tt></span></strong>:</p>
<p>Forces the HTTP response code to the specified value. Note that this parameter only has an effect if the <em><tt>string</tt></em> is not empty.</p>
<p>This php redirect code Note:</p>
<p>1.Before this fuction header(),can not have any output.</p>
<p>2.After this fuction header(),php code will be execute yet,to make sure stop it,you can add exit function.</p>
<p>Also,you can use this function to download files,just like:</p>
<div>
<blockquote>
<div><code><code> &lt;?php<br /> // We'll be outputting a PDF<br /> header('Content-type: application/pdf');</code></code>// It will be called downloaded.pdf<br /> header(&#8216;Content-Disposition: attachment; filename=&#8221;downloaded.pdf&#8221;&#8216;);// The PDF source is in original.pdf<br /> readfile(&#8216;original.pdf&#8217;);<br /> ?&gt;</div>
</blockquote>
</div>
<div>And read more about <a title="php header redirect,php response.redirect" href="http://www.phper.net/22/how-to-redirect-in-php">simple php redirect code</a> or <a title="php timed redirect" href="http://www.phper.net/22/how-to-redirect-in-php">php redirect script</a>,you can find at this http://php.net/manual/en/function.header.php</div>
<h4>Related Blogs</h4>
<h4>Related Blogs</h4>
<h4>Related Blogs</h4>
<p><!-- pingbacker_start --><br />
<h4>Related Blogs</h4>
<ul class='pc_pingback'></ul>
<p><!-- pingbacker_end --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.phper.net/22/how-to-redirect-in-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Member Script</title>
		<link>http://www.phper.net/18/php-member-script</link>
		<comments>http://www.phper.net/18/php-member-script#comments</comments>
		<pubDate>Fri, 15 Jul 2011 08:44:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[Free PHP Hosting]]></category>
		<category><![CDATA[Programming Books]]></category>
		<category><![CDATA[Scripts & Programs]]></category>
		<category><![CDATA[Software & Servers]]></category>
		<category><![CDATA[Tutorials & Tips]]></category>
		<category><![CDATA[php member]]></category>
		<category><![CDATA[php member code]]></category>
		<category><![CDATA[php member script]]></category>

		<guid isPermaLink="false">http://www.phper.net/?p=18</guid>
		<description><![CDATA[This can be a simple PHP / Mysql membership system where any visitors can register and login with a members area. This script uses PHP sessions and just takes a...]]></description>
			<content:encoded><![CDATA[<p>This can be a simple PHP / Mysql membership system where any visitors can register and login with a members area. This script uses PHP sessions and just takes a few minutes to install on any PHP web hosting.</p>
<p>Read me:<br />
<code>We appreciate you downloading our free membership script, you happen to be free of charge this simple script for your own risk.</code></p>
<p>To get this membership script working you&#8217;ll need a PHP Website Hosting account with one Mysql database.</p>
<p>Step One: Login for your hosting account and create a database and inport the database.sql file.</p>
<p>Step # 2: Open config.php with notepad and change the settings to your database details.</p>
<p>Step Three: Upload each of the files to your web server.</p>
<p>In case you have completed these steps above your free membership system ought to be working.</p>
<p>You should be aware: we do not provide any support because of this free script.</p>
<p>config.php<br />
<code></code><br />
Database.sql<br />
<code>CREATE TABLE IF NOT EXISTS `members` (<br />
`id` int(11) NOT NULL auto_increment,<br />
`username` varchar(255) NOT NULL,<br />
`password` varchar(255) NOT NULL,<br />
`email` varchar(255) NOT NULL,<br />
`ip` varchar(255) NOT NULL,<br />
`date` varchar(255) NOT NULL,<br />
PRIMARY KEY (`id`)<br />
) ENGINE=MyISAM AUTO_INCREMENT=1 ;</code></p>
<p>login.php</p>
<p>&lt;?<br />
// This simple PHP / Mysql membership script was created by www.funkyvision.co.uk<br />
// You are free to use this script at your own risk<br />
// Please visit our website for more updates..<br />
session_start();<br />
include_once&#8221;config.php&#8221;;<br />
if(isset($_POST['login'])){<br />
$username= trim($_POST['username']);<br />
$password = trim($_POST['password']);<br />
if($username == NULL OR $password == NULL){<br />
$final_report.=&#8221;Please complete all the fields below..&#8221;;<br />
}else{<br />
$check_user_data = mysql_query(&#8220;SELECT * FROM `members` WHERE `username` = &#8216;$username&#8217;&#8221;) or die(mysql_error());<br />
if(mysql_num_rows($check_user_data) == 0){<br />
$final_report.=&#8221;This username does not exist..&#8221;;<br />
}else{<br />
$get_user_data = mysql_fetch_array($check_user_data);<br />
if($get_user_data['password'] == $password){<br />
$start_idsess = $_SESSION['username'] = &#8220;&#8221;.$get_user_data['username'].&#8221;";<br />
$start_passsess = $_SESSION['password'] = &#8220;&#8221;.$get_user_data['password'].&#8221;";<br />
$final_report.=&#8221;You are about to be logged in, please wait a few moments.. &lt;meta http-equiv=&#8217;Refresh&#8217; content=&#8217;2; URL=members.php&#8217;/&gt;&#8221;;<br />
}}}}<br />
?&gt;</p>
<p>&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&gt;<br />
&lt;html xmlns=&#8221;http://www.w3.org/1999/xhtml&#8221;&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=iso-8859-1&#8243; /&gt;<br />
&lt;title&gt;Funky Vision Membership Script&lt;/title&gt;<br />
&lt;/head&gt;</p>
<p>&lt;body&gt;&lt;form action=&#8221;" method=&#8221;post&#8221;&gt;<br />
&lt;table width=&#8221;312&#8243; align=&#8221;center&#8221;&gt;<br />
&lt;? echo &#8220;&lt;tr&gt;&lt;td colspan=&#8217;2&#8242;&gt;&#8221;.$final_report.&#8221;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&#8221;;?&gt;<br />
&lt;tr&gt;<br />
&lt;td width=&#8221;120&#8243;&gt;Username:&lt;/td&gt;<br />
&lt;td width=&#8221;180&#8243;&gt;&lt;input type=&#8221;text&#8221; name=&#8221;username&#8221; size=&#8221;30&#8243; maxlength=&#8221;25&#8243;&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;Password:&lt;/td&gt;<br />
&lt;td&gt;&lt;input type=&#8221;password&#8221; name=&#8221;password&#8221; size=&#8221;30&#8243; maxlength=&#8221;25&#8243;&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;&amp;nbsp;&lt;/td&gt;<br />
&lt;td&gt;&lt;input type=&#8221;submit&#8221; name=&#8221;login&#8221; value=&#8221;Login&#8221; /&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;</p>
<p>&lt;/form&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>logout.php</p>
<p>&lt;?<br />
// This simple PHP / Mysql membership script was created by www.funkyvision.co.uk<br />
// You are free to use this script at your own risk<br />
// Please visit our website for more updates..<br />
session_start();<br />
include_once&#8221;config.php&#8221;;;<br />
session_unset(&#8216;username&#8217;);<br />
session_unset(&#8216;password&#8217;);<br />
echo &#8220;&lt;meta http-equiv=&#8217;Refresh&#8217; content=&#8217;2; URL=login.php&#8217;/&gt;&#8221;;<br />
?&gt;<br />
&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&gt;<br />
&lt;html xmlns=&#8221;http://www.w3.org/1999/xhtml&#8221;&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=iso-8859-1&#8243; /&gt;<br />
&lt;title&gt;Funky Vision Membership Script&lt;/title&gt;<br />
&lt;/head&gt;</p>
<p>&lt;body&gt;<br />
You are now logging out..<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>member.php</p>
<p>&lt;?<br />
// This simple PHP / Mysql membership script was created by www.funkyvision.co.uk<br />
// You are free to use this script at your own risk<br />
// Please visit our website for more updates..<br />
session_start();<br />
include_once&#8221;config.php&#8221;;<br />
if(!isset($_SESSION['username']) || !isset($_SESSION['password'])){<br />
header(&#8220;Location: login.php&#8221;);<br />
}else{<br />
$fetch_users_data = mysql_fetch_object(mysql_query(&#8220;SELECT * FROM `members` WHERE username=&#8217;&#8221;.$_SESSION['username'].&#8221;&#8216;&#8221;));<br />
}<br />
?&gt;<br />
&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&gt;<br />
&lt;html xmlns=&#8221;http://www.w3.org/1999/xhtml&#8221;&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=iso-8859-1&#8243; /&gt;<br />
&lt;title&gt;Funky Vision Membership Script&lt;/title&gt;<br />
&lt;/head&gt;</p>
<p>&lt;body&gt;<br />
Welcome to the Funky Vision membership script &lt;? echo &#8220;&#8221;.$fetch_users_data-&gt;username.&#8221;";?&gt;, if you login out you will be redirected to the login page.&lt;br /&gt;<br />
&lt;br /&gt;<br />
&lt;a href=&#8221;logout.php&#8221;&gt;Logout&lt;/a&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>Register.php</p>
<p>&lt;?<br />
// This simple PHP / Mysql membership script was created by www.funkyvision.co.uk<br />
// You are free to use this script at your own risk<br />
// Please visit our website for more updates..<br />
include_once&#8221;config.php&#8221;;<br />
if(isset($_POST['register'])){<br />
$username = $_POST['username'];<br />
$password = $_POST['password'];<br />
$email = $_POST['email'];<br />
$memip = $_SERVER['REMOTE_ADDR'];<br />
$date = date(&#8220;d-m-Y&#8221;);<br />
if($username == NULL OR $password == NULL OR $email == NULL){<br />
$final_report.= &#8220;Please complete the form below..&#8221;;<br />
}else{<br />
if(strlen($username) &lt;= 3 || strlen($username) &gt;= 30){<br />
$final_report.=&#8221;Your username must be between 3 and 30 characters..&#8221;;<br />
}else{<br />
$check_members = mysql_query(&#8220;SELECT * FROM `members` WHERE `username` = &#8216;$username&#8217;&#8221;);<br />
if(mysql_num_rows($check_members) != 0){<br />
$final_report.=&#8221;The username is already in use!&#8221;;<br />
}else{<br />
if(strlen($password) &lt;= 6 || strlen($password) &gt;= 12){<br />
$final_report.=&#8221;Your password must be between 6 and 12 digits and characters..&#8221;;<br />
}else{<br />
if(!eregi(&#8220;^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$&#8221;, $email)){<br />
$final_report.=&#8221;Your email address was not valid..&#8221;;<br />
}else{<br />
$create_member = mysql_query(&#8220;INSERT INTO `members` (`id`,`username`, `password`, `email`, `ip`, `date`)<br />
VALUES(&#8221;,&#8217;$username&#8217;,'$password&#8217;,'$email&#8217;,'$memip&#8217;,'$date&#8217;)&#8221;);<br />
$final_report.=&#8221;Thank you for registering, you may login.&#8221;;<br />
}}}}}}<br />
?&gt;</p>
<p>&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&gt;<br />
&lt;html xmlns=&#8221;http://www.w3.org/1999/xhtml&#8221;&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=iso-8859-1&#8243; /&gt;<br />
&lt;title&gt;Funky Vision Membership Script&lt;/title&gt;<br />
&lt;/head&gt;</p>
<p>&lt;body&gt;&lt;form method=&#8221;post&#8221;&gt;<br />
&lt;table width=&#8221;384&#8243; border=&#8221;1&#8243; align=&#8221;center&#8221;&gt;<br />
&lt;? echo &#8216;&lt;tr&gt;&lt;td colspan=&#8221;2&#8243;&gt;&#8217;.$final_report.&#8217;&lt;/td&gt;&lt;/tr&gt;&#8217;;?&gt;<br />
&lt;tr&gt;<br />
&lt;td width=&#8221;50%&#8221;&gt;Username:&lt;/td&gt;<br />
&lt;td width=&#8221;50%&#8221;&gt;&lt;label&gt;<br />
&lt;input name=&#8221;username&#8221; type=&#8221;text&#8221; id=&#8221;username&#8221; size=&#8221;30&#8243; /&gt;<br />
&lt;/label&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;Password:&lt;/td&gt;<br />
&lt;td&gt;&lt;input name=&#8221;password&#8221; type=&#8221;password&#8221; id=&#8221;password&#8221; value=&#8221;" size=&#8221;30&#8243; /&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;Email:&lt;/td&gt;<br />
&lt;td&gt;&lt;input name=&#8221;email&#8221; type=&#8221;text&#8221; id=&#8221;email&#8221; size=&#8221;30&#8243; /&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;&amp;nbsp;&lt;/td&gt;<br />
&lt;td&gt;&lt;label&gt;<br />
&lt;input name=&#8221;register&#8221; type=&#8221;submit&#8221; id=&#8221;register&#8221; value=&#8221;Register&#8221; /&gt;<br />
&lt;/label&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;<br />
&lt;/form&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<div id="attachment_19" class="wp-caption alignleft" style="width: 310px"><a href="http://www.phper.net/wp-content/uploads/2011/07/php_member.jpg"><img class="size-medium wp-image-19" title="php_member" src="http://www.phper.net/wp-content/uploads/2011/07/php_member-300x131.jpg" alt="php_member" width="300" height="131" /></a><p class="wp-caption-text">php_member</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.phper.net/18/php-member-script/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free PHP Unzip Script</title>
		<link>http://www.phper.net/7/free-php-unzip-script</link>
		<comments>http://www.phper.net/7/free-php-unzip-script#comments</comments>
		<pubDate>Thu, 14 Jul 2011 10:54:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts & Programs]]></category>
		<category><![CDATA[Free PHP Unzip Script]]></category>
		<category><![CDATA[online php unzip file]]></category>
		<category><![CDATA[php script unzip files]]></category>
		<category><![CDATA[php unzip]]></category>
		<category><![CDATA[php unzip class]]></category>
		<category><![CDATA[php unzip code]]></category>
		<category><![CDATA[php unzip directory]]></category>
		<category><![CDATA[php unzip file]]></category>
		<category><![CDATA[php unzip files script]]></category>
		<category><![CDATA[php unzip function]]></category>
		<category><![CDATA[php unzip gz]]></category>
		<category><![CDATA[php unzip on linux webserver]]></category>
		<category><![CDATA[php unzip script]]></category>
		<category><![CDATA[php unzip upload]]></category>
		<category><![CDATA[php unzip upload script]]></category>
		<category><![CDATA[php unzip zip]]></category>
		<category><![CDATA[php unzip zip file]]></category>
		<category><![CDATA[unzip on webserver php snip]]></category>
		<category><![CDATA[unzip php password]]></category>
		<category><![CDATA[unzip php server]]></category>
		<category><![CDATA[unzip script in php]]></category>
		<category><![CDATA[unzip using php]]></category>
		<category><![CDATA[unzip via php]]></category>
		<category><![CDATA[unzip with php]]></category>

		<guid isPermaLink="false">http://www.phper.net/?p=7</guid>
		<description><![CDATA[phper.net_unzip &#8211; online unzip php program. Power by PHP User Social Network(http://www.phper.net) . How to use it?upload your zip file and this file(phper_net_unzip.php) via FTP,and then,vist this file via your...]]></description>
			<content:encoded><![CDATA[<p>phper.net_unzip &#8211; online unzip php program.</p>
<p>Power by PHP User Social Network(http://www.phper.net) .</p>
<p>How to use it?upload your zip file and this file(phper_net_unzip.php) via FTP,and then,vist this file via your browser,like http://www.phper.net/phper_net_unzip.php<code></code></p>
<p>PHP User Social Network &#8211; www.phper.net</p>
<div id="attachment_8" class="wp-caption alignleft" style="width: 310px"><a href="http://www.phper.net/wp-content/uploads/2011/07/php_unzip.jpg"><img class="size-medium wp-image-8" title="php_unzip" src="http://www.phper.net/wp-content/uploads/2011/07/php_unzip-300x102.jpg" alt="php unzip script" width="300" height="102" /></a><p class="wp-caption-text">php unzip script</p></div>
<p>&lt;?php<br />
//password<br />
$password = &#8220;123456&#8243;;<br />
?&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=utf-8&#8243;&gt;<br />
&lt;title&gt;PHP User Social Network &#8211; www.phper.net&lt;/title&gt;<br />
&lt;style type=&#8221;text/css&#8221;&gt;<br />
&lt;!&#8211;<br />
body,td{<br />
font-size: 14px;<br />
color: #000000;<br />
}<br />
a {<br />
color: #000066;<br />
text-decoration: none;<br />
}<br />
a:hover {<br />
color: #FF6600;<br />
text-decoration: underline;<br />
}<br />
&#8211;&gt;<br />
&lt;/style&gt;<br />
&lt;/head&gt;</p>
<p>&lt;body&gt;<br />
&lt;form name=&#8221;myform&#8221; method=&#8221;post&#8221; action=&#8221;&lt;?=$_SERVER[PHP_SELF];?&gt;&#8221; enctype=&#8221;multipart/form-data&#8221; onSubmit=&#8221;return check_uploadObject(this);&#8221;&gt;<br />
&lt;?<br />
if(!$_REQUEST["myaction"]):<br />
?&gt;</p>
<p>&lt;script language=&#8221;javascript&#8221;&gt;<br />
function check_uploadObject(form){<br />
if(form.password.value==&#8221;){<br />
alert(&#8216;Please input password.&#8217;);<br />
return false;<br />
}<br />
return true;<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;table width=&#8221;100%&#8221; border=&#8221;0&#8243; cellspacing=&#8221;0&#8243; cellpadding=&#8221;4&#8243;&gt;<br />
&lt;tr&gt;<br />
&lt;td height=&#8221;40&#8243; colspan=&#8221;2&#8243; style=&#8221;color:#FF9900&#8243;&gt;&lt;p&gt;&lt;font color=&#8221;#FF0000&#8243;&gt;phper.net_unzip &#8211; online unzip php program.&lt;/font&gt;&lt;/p&gt;<br />
&lt;p&gt;Power by &lt;a href=&#8221;http://www.phper.net/&#8221; target=&#8221;_blank&#8221;&gt;PHP User Social Network&lt;/a&gt;(&lt;a href=&#8221;http://www.phper.net/&#8221; target=&#8221;_blank&#8221;&gt;http://www.phper.net&lt;/a&gt;) .&lt;/p&gt;<br />
&lt;p&gt;How to use it?upload your zip file and this file(phper_net_unzip.php) via FTP,and then,vist this file via your browser,like http://www.phper.net/phper_net_unzip.php&lt;/p&gt;<br />
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td width=&#8221;11%&#8221;&gt;Choose your zip file: &lt;/td&gt;<br />
&lt;td width=&#8221;89%&#8221;&gt;&lt;select name=&#8221;zipfile&#8221;&gt;<br />
&lt;option value=&#8221;" selected&gt;- Please choose -&lt;/option&gt;<br />
&lt;?<br />
$fdir = opendir(&#8216;./&#8217;);<br />
while($file=readdir($fdir)){<br />
if(!is_file($file)) continue;<br />
if(preg_match(&#8216;/\.zip$/mis&#8217;,$file)){<br />
echo &#8220;&lt;option value=&#8217;$file&#8217;&gt;$file&lt;/option&gt;\r\n&#8221;;<br />
}<br />
}<br />
?&gt;<br />
&lt;/select&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td width=&#8221;11%&#8221; nowrap&gt;or upload one&lt;/td&gt;<br />
&lt;td width=&#8221;89%&#8221;&gt;&lt;input name=&#8221;upfile&#8221; type=&#8221;file&#8221; id=&#8221;upfile&#8221; size=&#8221;20&#8243;&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;unzip to: &lt;/td&gt;<br />
&lt;td&gt;&lt;input name=&#8221;todir&#8221; type=&#8221;text&#8221; id=&#8221;todir&#8221; value=&#8221;__unzipfiles__&#8221; size=&#8221;15&#8243;&gt;<br />
(leave blank if unzip to current directory,Must have write permission)&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;Verify Password: &lt;/td&gt;<br />
&lt;td&gt;&lt;input name=&#8221;password&#8221; type=&#8221;password&#8221; id=&#8221;password&#8221; size=&#8221;15&#8243;&gt;<br />
(Password set in the source file)&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;&lt;input name=&#8221;myaction&#8221; type=&#8221;hidden&#8221; id=&#8221;myaction&#8221; value=&#8221;dounzip&#8221;&gt;&lt;/td&gt;<br />
&lt;td&gt;&lt;input type=&#8221;submit&#8221; name=&#8221;Submit&#8221; value=&#8221;Unzip&#8221;&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;</p>
<p>&lt;?</p>
<p>elseif($_REQUEST["myaction"]==&#8221;dounzip&#8221;):</p>
<p>class zip<br />
{</p>
<p>var $total_files = 0;<br />
var $total_folders = 0;</p>
<p>function Extract ( $zn, $to, $index = Array(-1) )<br />
{<br />
$ok = 0; $zip = @fopen($zn,&#8217;rb&#8217;);<br />
if(!$zip) return(-1);<br />
$cdir = $this-&gt;ReadCentralDir($zip,$zn);<br />
$pos_entry = $cdir['offset'];</p>
<p>if(!is_array($index)){ $index = array($index);  }<br />
for($i=0; $index[$i];$i++){<br />
if(intval($index[$i])!=$index[$i]||$index[$i]&gt;$cdir['entries'])<br />
return(-1);<br />
}<br />
for ($i=0; $i&lt;$cdir['entries']; $i++)<br />
{<br />
@fseek($zip, $pos_entry);<br />
$header = $this-&gt;ReadCentralFileHeaders($zip);<br />
$header['index'] = $i; $pos_entry = ftell($zip);<br />
@rewind($zip); fseek($zip, $header['offset']);<br />
if(in_array(&#8220;-1&#8243;,$index)||in_array($i,$index))<br />
$stat[$header['filename']]=$this-&gt;ExtractFile($header, $to, $zip);<br />
}<br />
fclose($zip);<br />
return $stat;<br />
}</p>
<p>function ReadFileHeader($zip)<br />
{<br />
$binary_data = fread($zip, 30);<br />
$data = unpack(&#8216;vchk/vid/vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len&#8217;, $binary_data);</p>
<p>$header['filename'] = fread($zip, $data['filename_len']);<br />
if ($data['extra_len'] != 0) {<br />
$header['extra'] = fread($zip, $data['extra_len']);<br />
} else { $header['extra'] = &#8221;; }</p>
<p>$header['compression'] = $data['compression'];$header['size'] = $data['size'];<br />
$header['compressed_size'] = $data['compressed_size'];<br />
$header['crc'] = $data['crc']; $header['flag'] = $data['flag'];<br />
$header['mdate'] = $data['mdate'];$header['mtime'] = $data['mtime'];</p>
<p>if ($header['mdate'] &amp;&amp; $header['mtime']){<br />
$hour=($header['mtime']&amp;0xF800)&gt;&gt;11;$minute=($header['mtime']&amp;0x07E0)&gt;&gt;5;<br />
$seconde=($header['mtime']&amp;0x001F)*2;$year=(($header['mdate']&amp;0xFE00)&gt;&gt;9)+1980;<br />
$month=($header['mdate']&amp;0x01E0)&gt;&gt;5;$day=$header['mdate']&amp;0x001F;<br />
$header['mtime'] = mktime($hour, $minute, $seconde, $month, $day, $year);<br />
}else{$header['mtime'] = time();}</p>
<p>$header['stored_filename'] = $header['filename'];<br />
$header['status'] = &#8220;ok&#8221;;<br />
return $header;<br />
}</p>
<p>function ReadCentralFileHeaders($zip){<br />
$binary_data = fread($zip, 46);<br />
$header = unpack(&#8216;vchkid/vid/vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset&#8217;, $binary_data);</p>
<p>if ($header['filename_len'] != 0)<br />
$header['filename'] = fread($zip,$header['filename_len']);<br />
else $header['filename'] = &#8221;;</p>
<p>if ($header['extra_len'] != 0)<br />
$header['extra'] = fread($zip, $header['extra_len']);<br />
else $header['extra'] = &#8221;;</p>
<p>if ($header['comment_len'] != 0)<br />
$header['comment'] = fread($zip, $header['comment_len']);<br />
else $header['comment'] = &#8221;;</p>
<p>if ($header['mdate'] &amp;&amp; $header['mtime'])<br />
{<br />
$hour = ($header['mtime'] &amp; 0xF800) &gt;&gt; 11;<br />
$minute = ($header['mtime'] &amp; 0x07E0) &gt;&gt; 5;<br />
$seconde = ($header['mtime'] &amp; 0x001F)*2;<br />
$year = (($header['mdate'] &amp; 0xFE00) &gt;&gt; 9) + 1980;<br />
$month = ($header['mdate'] &amp; 0x01E0) &gt;&gt; 5;<br />
$day = $header['mdate'] &amp; 0x001F;<br />
$header['mtime'] = mktime($hour, $minute, $seconde, $month, $day, $year);<br />
} else {<br />
$header['mtime'] = time();<br />
}<br />
$header['stored_filename'] = $header['filename'];<br />
$header['status'] = &#8216;ok&#8217;;<br />
if (substr($header['filename'], -1) == &#8216;/&#8217;)<br />
$header['external'] = 0x41FF0010;<br />
return $header;<br />
}</p>
<p>function ReadCentralDir($zip,$zip_name){<br />
$size = filesize($zip_name);</p>
<p>if ($size &lt; 277) $maximum_size = $size;<br />
else $maximum_size=277;</p>
<p>@fseek($zip, $size-$maximum_size);<br />
$pos = ftell($zip); $bytes = 0&#215;00000000;</p>
<p>while ($pos &lt; $size){<br />
$byte = @fread($zip, 1); $bytes=($bytes &lt;&lt; <img src='http://www.phper.net/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> | ord($byte);<br />
if ($bytes == 0x504b0506 or $bytes == 0x2e706870504b0506){ $pos++;break;} $pos++;<br />
}</p>
<p>$fdata=fread($zip,18);</p>
<p>$data=@unpack(&#8216;vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size&#8217;,$fdata);</p>
<p>if ($data['comment_size'] != 0) $centd['comment'] = fread($zip, $data['comment_size']);<br />
else $centd['comment'] = &#8221;; $centd['entries'] = $data['entries'];<br />
$centd['disk_entries'] = $data['disk_entries'];<br />
$centd['offset'] = $data['offset'];$centd['disk_start'] = $data['disk_start'];<br />
$centd['size'] = $data['size'];  $centd['disk'] = $data['disk'];<br />
return $centd;<br />
}</p>
<p>function ExtractFile($header,$to,$zip){<br />
$header = $this-&gt;readfileheader($zip);</p>
<p>if(substr($to,-1)!=&#8221;/&#8221;) $to.=&#8221;/&#8221;;<br />
if($to==&#8217;./&#8217;) $to = &#8221;;<br />
$pth = explode(&#8220;/&#8221;,$to.$header['filename']);<br />
$mydir = &#8221;;<br />
for($i=0;$i&lt;count($pth)-1;$i++){<br />
if(!$pth[$i]) continue;<br />
$mydir .= $pth[$i].&#8221;/&#8221;;<br />
if((!is_dir($mydir) &amp;&amp; @mkdir($mydir,0777)) || (($mydir==$to.$header['filename'] || ($mydir==$to &amp;&amp; $this-&gt;total_folders==0)) &amp;&amp; is_dir($mydir)) ){<br />
@chmod($mydir,0777);<br />
$this-&gt;total_folders ++;<br />
echo &#8220;&lt;input name=&#8217;dfile[]&#8216; type=&#8217;checkbox&#8217; value=&#8217;$mydir&#8217; checked&gt; &lt;a href=&#8217;$mydir&#8217; target=&#8217;_blank&#8217;&gt;Directory: $mydir&lt;/a&gt;&lt;br&gt;&#8221;;<br />
}<br />
}</p>
<p>if(strrchr($header['filename'],&#8217;/')==&#8217;/') return;</p>
<p>if (!($header['external']==0x41FF0010)&amp;&amp;!($header['external']==16)){<br />
if ($header['compression']==0){<br />
$fp = @fopen($to.$header['filename'], &#8216;wb&#8217;);<br />
if(!$fp) return(-1);<br />
$size = $header['compressed_size'];</p>
<p>while ($size != 0){<br />
$read_size = ($size &lt; 2048 ? $size : 2048);<br />
$buffer = fread($zip, $read_size);<br />
$binary_data = pack(&#8216;a&#8217;.$read_size, $buffer);<br />
@fwrite($fp, $binary_data, $read_size);<br />
$size -= $read_size;<br />
}<br />
fclose($fp);<br />
touch($to.$header['filename'], $header['mtime']);<br />
}else{<br />
$fp = @fopen($to.$header['filename'].&#8217;.gz&#8217;,'wb&#8217;);<br />
if(!$fp) return(-1);<br />
$binary_data = pack(&#8216;va1a1Va1a1&#8242;, 0x8b1f, Chr($header['compression']),<br />
Chr(0&#215;00), time(), Chr(0&#215;00), Chr(3));</p>
<p>fwrite($fp, $binary_data, 10);<br />
$size = $header['compressed_size'];</p>
<p>while ($size != 0){<br />
$read_size = ($size &lt; 1024 ? $size : 1024);<br />
$buffer = fread($zip, $read_size);<br />
$binary_data = pack(&#8216;a&#8217;.$read_size, $buffer);<br />
@fwrite($fp, $binary_data, $read_size);<br />
$size -= $read_size;<br />
}</p>
<p>$binary_data = pack(&#8216;VV&#8217;, $header['crc'], $header['size']);<br />
fwrite($fp, $binary_data,8); fclose($fp);</p>
<p>$gzp = @gzopen($to.$header['filename'].&#8217;.gz&#8217;,'rb&#8217;) or die(&#8220;Failed to create directory&#8221;);<br />
if(!$gzp) return(-2);<br />
$fp = @fopen($to.$header['filename'],&#8217;wb&#8217;);<br />
if(!$fp) return(-1);<br />
$size = $header['size'];</p>
<p>while ($size != 0){<br />
$read_size = ($size &lt; 2048 ? $size : 2048);<br />
$buffer = gzread($gzp, $read_size);<br />
$binary_data = pack(&#8216;a&#8217;.$read_size, $buffer);<br />
@fwrite($fp, $binary_data, $read_size);<br />
$size -= $read_size;<br />
}<br />
fclose($fp); gzclose($gzp);</p>
<p>touch($to.$header['filename'], $header['mtime']);<br />
@unlink($to.$header['filename'].&#8217;.gz&#8217;);</p>
<p>}<br />
}</p>
<p>$this-&gt;total_files ++;<br />
echo &#8220;&lt;input name=&#8217;dfile[]&#8216; type=&#8217;checkbox&#8217; value=&#8217;$to$header[filename]&#8216; checked&gt; &lt;a href=&#8217;$to$header[filename]&#8216; target=&#8217;_blank&#8217;&gt;Files: $to$header[filename]&lt;/a&gt;&lt;br&gt;&#8221;;</p>
<p>return true;<br />
}</p>
<p>// end class<br />
}</p>
<p>set_time_limit(0);</p>
<p>if ($_POST['password'] != $password) die(&#8220;The password is incorrect, please re-enter&#8221;);<br />
if(!$_POST["todir"]) $_POST["todir"] = &#8220;.&#8221;;<br />
$z = new Zip;<br />
$have_zip_file = 0;<br />
function start_unzip($tmp_name,$new_name,$checked){<br />
global $_POST,$z,$have_zip_file;<br />
$upfile = array(&#8220;tmp_name&#8221;=&gt;$tmp_name,&#8221;name&#8221;=&gt;$new_name);<br />
if(is_file($upfile[tmp_name])){<br />
$have_zip_file = 1;<br />
echo &#8220;&lt;br&gt;In Process: &lt;input name=&#8217;dfile[]&#8216; type=&#8217;checkbox&#8217; value=&#8217;$upfile[name]&#8216; &#8220;.($checked?&#8221;checked&#8221;:&#8221;").&#8221;&gt; $upfile[name]&lt;br&gt;&lt;br&gt;&#8221;;<br />
if(preg_match(&#8216;/\.zip$/mis&#8217;,$upfile[name])){<br />
$result=$z-&gt;Extract($upfile[tmp_name],$_POST["todir"]);<br />
if($result==-1){<br />
echo &#8220;&lt;br&gt;File $upfile[name] error.&lt;br&gt;&#8221;;<br />
}<br />
echo &#8220;&lt;br&gt;Done,Create $z-&gt;total_folders directory(s),$z-&gt;total_files file(s).&lt;br&gt;&lt;br&gt;&lt;br&gt;&#8221;;<br />
}else{<br />
echo &#8220;&lt;br&gt;$upfile[name] is not a zip file.&lt;br&gt;&lt;br&gt;&#8221;;<br />
}<br />
if(realpath($upfile[name])!=realpath($upfile[tmp_name])){<br />
@unlink($upfile[name]);<br />
rename($upfile[tmp_name],$upfile[name]);<br />
}<br />
}<br />
}<br />
clearstatcache();</p>
<p>start_unzip($_POST["zipfile"],$_POST["zipfile"],0);<br />
start_unzip($_FILES["upfile"][tmp_name],$_FILES["upfile"][name],1);</p>
<p>if(!$have_zip_file){<br />
echo &#8220;&lt;br&gt;Please select or upload files.&lt;br&gt;&#8221;;<br />
}<br />
?&gt;<br />
&lt;input name=&#8221;password&#8221; type=&#8221;hidden&#8221; id=&#8221;password&#8221; value=&#8221;&lt;?=$_POST['password'];?&gt;&#8221;&gt;<br />
&lt;input name=&#8221;myaction&#8221; type=&#8221;hidden&#8221; id=&#8221;myaction&#8221; value=&#8221;dodelete&#8221;&gt;<br />
&lt;input name=&#8221;button&#8221; type=&#8221;button&#8221; value=&#8221;go back&#8221; onclick=&#8221;window.location=&#8217;&lt;?=$_SERVER[PHP_SELF];?&gt;&#8217;;&#8221;&gt;</p>
<p>&lt;input type=&#8217;button&#8217; value=&#8217;Inverse&#8217; onclick=&#8217;selrev();&#8217;&gt; &lt;input type=&#8217;submit&#8217; onclick=&#8217;return confirm(&#8220;Delete the selected file?&#8221;);&#8217; value=&#8217;Delete the selected file&#8217;&gt;</p>
<p>&lt;script language=&#8217;javascript&#8217;&gt;<br />
function selrev() {<br />
with(document.myform) {<br />
for(i=0;i&lt;elements.length;i++) {<br />
thiselm = elements[i];<br />
if(thiselm.name.match(/dfile\[]/))    thiselm.checked = !thiselm.checked;<br />
}<br />
}<br />
}<br />
alert(&#8216;Completed.&#8217;);<br />
&lt;/script&gt;<br />
&lt;?</p>
<p>elseif($_REQUEST["myaction"]==&#8221;dodelete&#8221;):<br />
set_time_limit(0);<br />
if ($_POST['password'] != $password) die(&#8220;The password is incorrect, please re-try.&#8221;);</p>
<p>$dfile = $_POST["dfile"];<br />
echo &#8220;Deleting files&#8230;&lt;br&gt;&lt;br&gt;&#8221;;<br />
if(is_array($dfile)){<br />
for($i=count($dfile)-1;$i&gt;=0;$i&#8211;){<br />
if(is_file($dfile[$i])){<br />
if(@unlink($dfile[$i])){<br />
echo &#8220;Deleted files: $dfile[$i]&lt;br&gt;&#8221;;<br />
}else{<br />
echo &#8220;Delete file failed: $dfile[$i]&lt;br&gt;&#8221;;<br />
}<br />
}else{<br />
if(@rmdir($dfile[$i])){<br />
echo &#8220;Deleted directory: $dfile[$i]&lt;br&gt;&#8221;;<br />
}else{<br />
echo &#8220;Failed to delete directory: $dfile[$i]&lt;br&gt;&#8221;;<br />
}<br />
}</p>
<p>}<br />
}<br />
echo &#8220;&lt;br&gt;Completed.&lt;br&gt;&lt;br&gt;&lt;input type=&#8217;button&#8217; value=&#8217;go back&#8217; onclick=\&#8221;window.location=&#8217;$_SERVER[PHP_SELF]&#8216;;\&#8221;&gt;&lt;br&gt;&lt;br&gt;<br />
&lt;script language=&#8217;javascript&#8217;&gt;(&#8216;Completed.&#8217;);&lt;/script&gt;&#8221;;</p>
<p>endif;</p>
<p>?&gt;<br />
&lt;/form&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<blockquote><p>Download Link:<a href="http://www.phper.net/wp-content/uploads/2011/07/phper_net_unzip_php.zip" title="php unzip script" target="_blank">PHP unzip script</a></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.phper.net/7/free-php-unzip-script/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why PHP Was a Ghetto</title>
		<link>http://www.phper.net/1/why-php-was-a-ghetto</link>
		<comments>http://www.phper.net/1/why-php-was-a-ghetto#comments</comments>
		<pubDate>Tue, 12 Jul 2011 09:14:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[ghetto]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.phper.net/?p=1</guid>
		<description><![CDATA[I was talking with the Co-founder of a pretty cool start-up in DUMBO the other day about why the non-PHP development world generally has such disdain for PHP and the...]]></description>
			<content:encoded><![CDATA[<p>I was talking with the Co-founder of a <a href="http://www.saaspire.com/">pretty cool start-up</a> in <a href="http://dumbonyc.com/">DUMBO</a> the other day about why the non-PHP development world generally has such disdain for PHP and the community surrounding it. He brought up an interesting point that stuck with me, largely because I hadn’t heard it before.</p>
<p>If you’re unaware of the usual beef most developers have with PHP, it tends to revolve around:</p>
<ol>
<li>Ugly syntax</li>
<li>Lack of some necessary features that other languages have (prior to 5.3, namespacing, closures)</li>
<li>Inconsistent function naming, usage, and other quirks</li>
<li>Mix of procedural and OO-ness</li>
<li>The fact that 80-90% of PHP projects are probably gigantic piles of shit</li>
</ol>
<p>But his problem with PHP was a little different. He didn’t say the actual language was poor — he said it was the general culture surrounding the language, which is usually iconified by a language’s founder, that seems to encourage bad practices. That is, PHP code bases tend to be hacky and unmaintainable.</p>
<p>The concept that the community surrounding a language or framework embodies an author’s philosophy seems to be true. He brought up Ruby and <a href="http://en.wikipedia.org/wiki/Yukihiro_Matsumoto">Matz</a>. Matz wanted a language that was easy to read and write, and enhanced programmer productivity. Don’t Ruby developers seem to harp on rapid application development and the elegance of their language?</p>
<p>Then <a href="http://en.wikipedia.org/wiki/David_Heinemeier_Hansson">DHH</a> and the Rails came up. Then <a href="http://www.python.org/%7Eguido/">Guido</a> and Python. So I thought: What about <a href="http://en.wikipedia.org/wiki/Rasmus_Lerdorf">Rasmus</a>?</p>
<p>Rasmus Lerdorf is an interesting figure. He created the original version of PHP, continues to contribute, is widely considered a demigod in the community and the authority on almost anything PHP. He <a href="http://www.urbandictionary.com/define.php?term=rasmussed">steals masses of attendees at conferences</a>, <a href="http://yahoo.com/">gets hired by big internet places</a>, and garners the respect of everyone despite one glaring property: Rasmus represents what most non-PHP developers hate about PHP.</p>
<p>Rasmus generally promotes abstention from using frameworks, and the use of PHP as more of a templating language. To him, this translates to raw speed and scalability (load-wise). To everyone else, this translates to piles of procedural spaghetti code, and unmaintainable projects. For roughly 10 years following the birth of PHP in 1995, this was how PHP projects were written.</p>
<p>But another issue cropped up:  In it’s pizza-faced adolescent years (pre-5.0), PHP gained a serious following among novices. The language has a fantastically low barrier to entry, so anyone could get started in 2 minutes by downloading some self-extracting *AMP stack for Windows. Additionally, the acceptance of the MVC paradigm hadn’t really occurred yet in web development. What do you get when you mix n00bs and a lack of best practices? Unmaintainable garbage. And that’s what proliferated.</p>
<p>Don’t get me wrong — there were some great PHP developers around, even back then. But like I said, unrefined n00b-sauce was all around. When cowboy PHP developers with no standards got together to build a project, it came out looking like PHPbb, PHPNuke, or some other gnarled mash of .php3 files. But can you singularly blame PHP developers? No! The other web language giants, ASP and Perl, were also gross as hell and promoting the same spaghetti-code practices.</p>
<p>So why does PHP get a bad rap? Because of its legacy. And most old-time PHP devs who have fled to Python, Ruby, and Java haven’t really looked back to see what kind of development has happened in the language since the introduction of MVC on the web. Additionally, there were super-outspoken critics like “Ruby guy” Zed Shaw complaining of developers with “PHP-Infected Brains”, and the distribution of <a href="http://www.rubyinside.com/holiday-fun-how-programming-language-fanboys-see-each-others-languages-2911.html">stuff like this on RubyInside</a>.</p>
<p><em>PHP was a ghetto.</em></p>
<p>But the development of frameworks like Zend and CodeIgniter have greatly pushed the language development into the right direction. In fact, it’s been pushed in the <em>opposite </em>direction of where Rasmus would probably like to see it. Check out the Zend or CodeIgniter frameworks and tell me it’s not some of the best documented, most well-written code you’ve seen.</p>
<p>When most developers learned Ruby, they were learning Rails and MVC  at the same time. PHP was in use for a full 10 years before that. So there really wasn’t a period of time when heinous Ruby was being written by novices. There was an established standard in place for Rails, and the barrier to entry was a much higher, typically keeping less experienced developers out.</p>
<p>The fact is, a PHP applications can be as well-written as an application in any other language, and probably have the additional advantage of speed. The widespread use of MVC-style development in the PHP world is a relatively recent phenomena though, and admittedly, we can probably thank Rails for it.</p>
<p>So what does PHP have going for it now?</p>
<ol>
<li>Standards (not universal, but generally a flavor of MVC for most projects, and little procedural crap)</li>
<li>A very low barrier to entry</li>
<li>Speed &amp; Scalability (maybe the best among script-based languages)</li>
<li>A great unit testing framework</li>
<li>Arguably the best documentation for any language</li>
</ol>
<p>Additionally, it’s behind some of the internet’s most influential websites and tools, like Facebook, Digg, Wikipedia, WordPress, Drupal, etc. I’d bet that having a solid understanding of it opens more doors for a developer than any other.</p>
<p>If you don’t agree with the above, comment on this post, or email me — I’d like to hear why you don’t think so.</p>
<p>I’m no PHP fanboy — in fact, I’m very language-agnostic. I write PHP more often because, you guessed it, people pay me to. So it all comes down to this:</p>
<p><em>If you are capable of making wise software design decisions, PHP is a great choice to build your web application with.<br />
</em></p>
<p>By the way, if I just convinced you to build your next webapp in PHP, check out CodeIgniter. <a title="Top 10 php frameworks" href="http://www.phpframeworks.com/top-10-php-frameworks/" target="_blank">It’s the lightweight, no magic, ultra fast framework for PHP</a>. When it comes to CodeIgniter, I am a fanboy.</p>
<p><strong>4/4 Edit</strong>: I’ll be presenting a tool I wrote in Perl called ‘<a href="https://github.com/katzgrau/chip">divvy</a>‘ tonight at <a href="http://www.meetup.com/hack-and-tell/">Hack and Tell</a> in NYC. Here’s a<a href="http://blip.tv/file/4739441"> video of a previous event</a> (about 10 minutes in) where a developer plugs in his laptop to reveal Windows XP on his desktop (strike 1.5) and then admits to being a “PHP Coder” (strike 4). Is it me, or can you feel the judgment in the air? Maybe it’s me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phper.net/1/why-php-was-a-ghetto/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

