<?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>Jetlogs.org &#187; PHP</title>
	<atom:link href="http://jetlogs.org/category/web-development/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://jetlogs.org</link>
	<description>Web development, tutorials, video games, papercraft, and technology</description>
	<lastBuildDate>Thu, 10 Jun 2010 05:57:34 +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>PHP: Problems with Long Integers &amp; Scientific Notation</title>
		<link>http://jetlogs.org/2008/02/05/php-problems-with-big-integers-and-scientific-notation/</link>
		<comments>http://jetlogs.org/2008/02/05/php-problems-with-big-integers-and-scientific-notation/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 03:44:09 +0000</pubDate>
		<dc:creator>Jetlogs</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[float]]></category>
		<category><![CDATA[integer]]></category>

		<guid isPermaLink="false">http://jetlogs.org/2008/02/05/php-problems-with-big-integers-and-scientific-notation/</guid>
		<description><![CDATA[For those of you working on PHP scripts using very large integers, a heed of warning. It seems that the current version of PHP (5.2.5) apparently has problems working with outputting very large integers and floats that have a lot of lagging 0&#8242;s For example, here is the bug that I have encountered in a [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you working on PHP scripts using very large integers, a heed of warning. It seems that the current version of PHP (5.2.5) apparently has problems working with outputting very large integers and floats that have a lot of lagging 0&#8242;s</p>
<p>For example, here is the bug that I have encountered in a server using CentOS:</p>
<pre><code class="php">$big_integer = 1202400000;
echo $big_integer; //outputs 1.2024E+09

$sample_float = (float)100000; //float
echo $sample_float; //outputs 1E+05</code></pre>
<p>As you can see, PHP will automatically convert these types of integers into scientific notation. At first, I though it was simply a case of integer overflow with 32 bit systems, or a misconfiguration in float precision. However, I&#8217;ve noticed that this bug will only apply to large integers or floats with a lot of zeros at the end. Apparently, when PHP encounters a number that exceeds the upper limit of 2,147,483,647 for an integer, it automatically converts the number&#8217;s type from integer into a double.</p>
<p>Through searching PHP&#8217;s bug archives, its seems that <a href="http://bugs.php.net/bug.php?id=43053" target="_blank" rel="nofollow">I am not alone</a>. Apparently this bug has been documented in the recent versions and is most notable with systems running under CentOS.</p>
<p>So how do we fix this error? Fortunately, we can format these numbers in scientific notation back to their standard integer form using the <a href="http://au2.php.net/manual/en/function.number-format.php" target="_blank">number_format()</a> function. Here is how to do it:</p>
<pre><code class="php">$big_integer = 1202400000;
$formatted_int = number_format($big_integer, 0, '.', '');
echo $formatted_int; //outputs 1202400000 as expected

$sample_float = (float)100000 //float;
$formatted_float = number_format($sample_float, 2, '.', '');
echo $formatted_float; //outputs 100000.00 as expected</code></pre>
<p>Hope this helps anybody who is experiencing the same problems.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://jetlogs.org/2008/02/05/php-problems-with-big-integers-and-scientific-notation/&amp;title=PHP%3A+Problems+with+Long+Integers+%26amp%3B+Scientific+Notation" title="Del.icio.us"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Del.icio.us" alt="Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://jetlogs.org/2008/02/05/php-problems-with-big-integers-and-scientific-notation/&amp;title=PHP%3A+Problems+with+Long+Integers+%26amp%3B+Scientific+Notation" title="digg"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/digg.png" title="digg" alt="digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://jetlogs.org/2008/02/05/php-problems-with-big-integers-and-scientific-notation/" title="Facebook"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Facebook" alt="Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://jetlogs.org/2008/02/05/php-problems-with-big-integers-and-scientific-notation/&amp;title=PHP%3A+Problems+with+Long+Integers+%26amp%3B+Scientific+Notation" title="Google Bookmarks"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/google.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://jetlogs.org/2008/02/05/php-problems-with-big-integers-and-scientific-notation/&amp;title=PHP%3A+Problems+with+Long+Integers+%26amp%3B+Scientific+Notation" title="reddit"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/reddit.png" title="reddit" alt="reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://jetlogs.org/2008/02/05/php-problems-with-big-integers-and-scientific-notation/&amp;title=PHP%3A+Problems+with+Long+Integers+%26amp%3B+Scientific+Notation" title="Stumble Upon"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Stumble Upon" alt="Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://jetlogs.org/2008/02/05/php-problems-with-big-integers-and-scientific-notation/" title="Technorati"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Technorati" alt="Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://jetlogs.org/2008/02/05/php-problems-with-big-integers-and-scientific-notation/&amp;t=PHP%3A+Problems+with+Long+Integers+%26amp%3B+Scientific+Notation" title="Yahoo My Web"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Yahoo My Web" alt="Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://jetlogs.org/2008/02/05/php-problems-with-big-integers-and-scientific-notation/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Auto-saving with jQuery</title>
		<link>http://jetlogs.org/2007/11/11/auto-saving-with-jquery/</link>
		<comments>http://jetlogs.org/2007/11/11/auto-saving-with-jquery/#comments</comments>
		<pubDate>Sat, 10 Nov 2007 18:22:28 +0000</pubDate>
		<dc:creator>Jetlogs</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://jetlogs.org/2007/11/11/auto-saving-with-jquery/</guid>
		<description><![CDATA[Auto-saving has been one of the great features that AJAX has given to us. Ever had a time when you were writing a very long article and suddenly, your browser crashes. Thanks to applications that implement auto-saving, data is less prone from lost due to these cases. Ever wondered how auto-saving is done? Basically, it [...]]]></description>
			<content:encoded><![CDATA[<p>Auto-saving has been one of the great features that AJAX has given to us. Ever had a time when you were writing a very long article and suddenly, your browser crashes. Thanks to applications that implement auto-saving, data is less prone from lost due to these cases. </p>
<p>Ever wondered how auto-saving is done? Basically, it is just a simple AJAX script running in the background at set intervals to save the data you are currently working on. Here is a simple tutorial on how to implement auto-saving using jQuery<span id="more-299"></span></p>
<p>Before we start, the article assumed the following:</p>
<ul>
<li>Basic knowledge of jQuery</li>
<li>Basic knowledge of PHP</li>
</ul>
<p>For the articles database, we will only use 4 rows for our table named <span class='code'>articles</span>:</p>
<ul>
<li><b>id</b> &#8211; this will serve as the primary index for the table; auto-increment</li>
<li><b>title</b> &#8211; this will contain the title of the article</li>
<li><b>content</b> &#8211; this will contain the body of the article itself</li>
<li><b>timestamp</b> &#8211; this will contain the timestamp when the row was last inserted or updated</li>
</ul>
<p>Let us first start with the form and call it <span class='code'>add_article.php</span> for this tutorial. Before we render our form, we must first create a blank instance of a row. The purpose of this is two-fold. One, so that we can generate an article id, and secondly that we cannot really update a non-existent row. There is a more efficient way of implementing this logic without generating a blank row every time, however, for the sake of simplicity and explaining the point of concept for this tutorial, we will skip this part.</p>
<p><b>add_article.php</b>
<pre><code class='php'>//create new article on database
mysql_query("INSERT INTO `articles`(title, content) VALUES('', '')");
$article_id = mysql_insert_id();</code></pre>
<p>The next step is making the form. First, we would create a form element that would to save the article to a standard save page. Lets call it <span class='code'>save.php</span>.</p>
<p>Remember the <span class='code'>article_id</span> generated in making the blank row? Now we must output it as a hidden input for the <span class='code'>article_id</span> associated with the article. We would also need an input text field for the <span class='code'>title</span> and a text area for the <span class='code'>content</span>. Finally we would need a submit button, and a placeholder container for the &#8220;Last saved&#8221; timestamp.</p>
<p><b>add_article.php</b>
<pre><code class='html'>&lt;form id="article_form" method="post" action="save.php"&gt;

Title:&lt;br /&gt;
&lt;input type="text" name="title" id="txt_title" /&gt;&lt;br /&gt;
Content:&lt;br /&gt;
&lt;textarea name="content" id="txt_content" &gt;&lt;/textarea&gt;&lt;br /&gt;
&lt;input type="hidden" name="article_id"
value="&lt;?php echo $article_id ?&gt;" /&gt;

&lt;input type="submit" value="Save"/&gt;&lt;br /&gt;

&lt;/form&gt;
&lt;div id="timestamp"&gt;&lt;/div&gt;
</code></pre>
<p>Now for our AJAX back end, we must create a script that will perform the update from the AJAX request that came from <span class='code'>add_article.php</span>. Let us call this script <span class='code'>autosave.php</span>. In return, the script must output the timestamp when the article was last updated</p>
<p><b>autosave.php</b>
<pre><code class='php'>$title = mysql_real_escape_string($_POST['title']);
$content = mysql_real_escape_string($_POST['content']);
$id = (int)$_POST['article_id'];

//save contents to database
mysql_query("UPDATE `articles`
    SET title = '$title', content = '$content' WHERE id = '$id'");

//get timestamp
$result = mysql_query("SELECT timestamp FROM `articles`
    WHERE id = $id");
$timestamp = mysql_result($result, 0);

//output timestamp
echo 'Last Saved: ', $timestamp;</code></pre>
<p>And finally to tie it all up, we must now create the autosave script in jQuery on <span class='code'>add_article.php</span>. First of all, in creating our <span class='code'>autosave()</span> function, we will need to create a setTimeout loop that will call itself recursively. For this tutorial, the interval between auto-saving is 20 seconds</p>
<p><b>add_article.php</b>
<pre><code class='javascript'>function autosave()
{
	var t = setTimeout("autosave()", 20000);
}</code></pre>
<p>And finally, to finish it all up, we must send an AJAX request to our back end <span class='code'>autosave.php</span>. Of course, we mustn&#8217;t forget to pass the <span class='code'>$article_id</span> we generated earlier. Also, auto-saving must only proceed when both title and contents are not empty.</p>
<p>And lastly, when the AJAX request has been successfully processed, we will pass its value to our timestamp container.</p>
<p><b>add_article.php</b>
<pre><code class='javascript'>function autosave()
{
	var t = setTimeout("autosave()", 20000);

	var title = $("#txt_title").val();
	var content = $("#txt_content").val();

	if (title.length > 0 || content.length > 0)
	{
		$.ajax(
		{
			type: "POST",
			url: "autosave.php",
			data: "article_id=" + &lt;?php echo $article_id ?&gt;
+ "&#038;title=" + title + "&#038;content=" + content,
			cache: false,
			success: function(message)
			{
				$("#timestamp").empty().append(message);
			}
		});
	}
}</code></pre>
<p>Finally, it is just a matter of starting the auto-saving feature when the DOM is ready:</p>
<p><b>add_article.php</b>
<pre><code class='javascript'>$(document).ready(function(){
	autosave();
});
</code></pre>
<p>Working demo of the tutorial and the download links can be found below:</p>
<p><a href="http://jetlogs.org/jquery/jquery_autosave.php">View jQuery Auto-save Demo</a><br />
<a href="http://jetlogs.org/jquery/jquery_autosave.zip">Download Source Codes</a></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://jetlogs.org/2007/11/11/auto-saving-with-jquery/&amp;title=Auto-saving+with+jQuery" title="Del.icio.us"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Del.icio.us" alt="Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://jetlogs.org/2007/11/11/auto-saving-with-jquery/&amp;title=Auto-saving+with+jQuery" title="digg"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/digg.png" title="digg" alt="digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://jetlogs.org/2007/11/11/auto-saving-with-jquery/" title="Facebook"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Facebook" alt="Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://jetlogs.org/2007/11/11/auto-saving-with-jquery/&amp;title=Auto-saving+with+jQuery" title="Google Bookmarks"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/google.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://jetlogs.org/2007/11/11/auto-saving-with-jquery/&amp;title=Auto-saving+with+jQuery" title="reddit"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/reddit.png" title="reddit" alt="reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://jetlogs.org/2007/11/11/auto-saving-with-jquery/&amp;title=Auto-saving+with+jQuery" title="Stumble Upon"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Stumble Upon" alt="Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://jetlogs.org/2007/11/11/auto-saving-with-jquery/" title="Technorati"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Technorati" alt="Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://jetlogs.org/2007/11/11/auto-saving-with-jquery/&amp;t=Auto-saving+with+jQuery" title="Yahoo My Web"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Yahoo My Web" alt="Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://jetlogs.org/2007/11/11/auto-saving-with-jquery/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>PHP: Humor and SQL Injections</title>
		<link>http://jetlogs.org/2007/10/15/php-humor-and-sql-injections/</link>
		<comments>http://jetlogs.org/2007/10/15/php-humor-and-sql-injections/#comments</comments>
		<pubDate>Mon, 15 Oct 2007 15:46:11 +0000</pubDate>
		<dc:creator>Jetlogs</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://jetlogs.org/2007/10/15/php-humor-and-sql-injections/</guid>
		<description><![CDATA[xkcd really got to me with this comic. It shows why you should always filter your inputs, especially when you&#8217;re going to use them in an SQL query.]]></description>
			<content:encoded><![CDATA[<p><a href='http://xkcd.com'>xkcd</a> really got to me with this comic. It shows why you should always <a href='http://jetlogs.org/2007/09/15/php-how-to-make-life-easier-with-references/'>filter your inputs</a>, especially when you&#8217;re going to use them in an SQL query.</p>
<p><a href='http://xkcd.com/327/'><img src='http://jetlogs.org/wp-content/uploads/2007/10/sql_injection.png' alt='click to view full comic at xkcd' class='center'/></a></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://jetlogs.org/2007/10/15/php-humor-and-sql-injections/&amp;title=PHP%3A+Humor+and+SQL+Injections" title="Del.icio.us"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Del.icio.us" alt="Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://jetlogs.org/2007/10/15/php-humor-and-sql-injections/&amp;title=PHP%3A+Humor+and+SQL+Injections" title="digg"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/digg.png" title="digg" alt="digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://jetlogs.org/2007/10/15/php-humor-and-sql-injections/" title="Facebook"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Facebook" alt="Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://jetlogs.org/2007/10/15/php-humor-and-sql-injections/&amp;title=PHP%3A+Humor+and+SQL+Injections" title="Google Bookmarks"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/google.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://jetlogs.org/2007/10/15/php-humor-and-sql-injections/&amp;title=PHP%3A+Humor+and+SQL+Injections" title="reddit"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/reddit.png" title="reddit" alt="reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://jetlogs.org/2007/10/15/php-humor-and-sql-injections/&amp;title=PHP%3A+Humor+and+SQL+Injections" title="Stumble Upon"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Stumble Upon" alt="Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://jetlogs.org/2007/10/15/php-humor-and-sql-injections/" title="Technorati"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Technorati" alt="Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://jetlogs.org/2007/10/15/php-humor-and-sql-injections/&amp;t=PHP%3A+Humor+and+SQL+Injections" title="Yahoo My Web"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Yahoo My Web" alt="Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://jetlogs.org/2007/10/15/php-humor-and-sql-injections/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP: SimpleXML XPaths and Namespaces</title>
		<link>http://jetlogs.org/2007/10/03/php-simplexml-xpaths-and-namespaces/</link>
		<comments>http://jetlogs.org/2007/10/03/php-simplexml-xpaths-and-namespaces/#comments</comments>
		<pubDate>Wed, 03 Oct 2007 11:36:12 +0000</pubDate>
		<dc:creator>Jetlogs</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://jetlogs.org/2007/10/03/php-simplexml-xpaths-and-namespaces/</guid>
		<description><![CDATA[Ever since PHP version 5.2.0, XML parsing has been made so much easier with the new SimpleXMLElement->xpath() function. No longer do we have to parse an XML document by working our way through all the child node, we just have to know the XML element&#8217;s name Assuming we have an XML string assigned to $xml_string [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since PHP version 5.2.0, XML parsing has been made so much easier with the new <a href="http://www.php.net/manual/en/function.simplexml-element-xpath.php">SimpleXMLElement->xpath()</a> function. No longer do we have to parse an XML document by working our way through all the child node, we just have to know the XML element&#8217;s name</p>
<p>Assuming we have an XML string assigned to <span class="code">$xml_string</span></p>
<pre><code class="php">$xml_string='&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;a&gt;
	&lt;b&gt;
		&lt;c&gt;
			&lt;d&gt;
				&lt;e&gt;Hello World&lt;/e&gt;
			&lt;/d&gt;
		&lt;/c&gt;
	&lt;/b&gt;
&lt;/a&gt;';

$xml = new SimpleXMLElement($xml_string);
</code></pre>
<p>Here is how it was done before 5.2.0 to access the <span class="code">&lt;e&gt;</span> element</p>
<pre><code class="php">echo $xml->b->c->d->e[0]; //prints Hello World</code></pre>
<p>Now with the new <b>SimpleXMLElement->xpath()</b> function, here is how it is done:</p>
<pre><code class="php">$result = $xml->xpath('//e');
echo $result[0]; //prints Hello World</code></pre>
<p><span id="more-237"></span></p>
<p>However, being a new function, it comes with its own bugs and quirks. As for the timebeing, SimpleXMLElement->xpath() function doesn&#8217;t support default namespaces and will not be able to perform an XPath search on those types of documents.</p>
<p>The only thing that can be done right now is a simple workaround by removing the namespace attribute, or changing the namespace tag to preserve the namespace. Here is how it is done:</p>
<pre><code class="php">$xml_string='&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;a xmlns="http://www.opentravel.org/OTA/2003/05"&gt;
	&lt;b&gt;
		&lt;c&gt;
			&lt;d&gt;
				&lt;e&gt;Hello World&lt;/e&gt;
			&lt;/d&gt;
		&lt;/c&gt;
	&lt;/b&gt;
&lt;/a&gt;';

$processed_string = str_replace("xmlns=", "ns=", $xml_string);
$xml = new SimpleXMLElement($processed_string);
$result = $xml->xpath('//e');
echo $result[0]; //prints Hello World as expected
</code></pre>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://jetlogs.org/2007/10/03/php-simplexml-xpaths-and-namespaces/&amp;title=PHP%3A+SimpleXML+XPaths+and+Namespaces" title="Del.icio.us"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Del.icio.us" alt="Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://jetlogs.org/2007/10/03/php-simplexml-xpaths-and-namespaces/&amp;title=PHP%3A+SimpleXML+XPaths+and+Namespaces" title="digg"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/digg.png" title="digg" alt="digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://jetlogs.org/2007/10/03/php-simplexml-xpaths-and-namespaces/" title="Facebook"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Facebook" alt="Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://jetlogs.org/2007/10/03/php-simplexml-xpaths-and-namespaces/&amp;title=PHP%3A+SimpleXML+XPaths+and+Namespaces" title="Google Bookmarks"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/google.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://jetlogs.org/2007/10/03/php-simplexml-xpaths-and-namespaces/&amp;title=PHP%3A+SimpleXML+XPaths+and+Namespaces" title="reddit"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/reddit.png" title="reddit" alt="reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://jetlogs.org/2007/10/03/php-simplexml-xpaths-and-namespaces/&amp;title=PHP%3A+SimpleXML+XPaths+and+Namespaces" title="Stumble Upon"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Stumble Upon" alt="Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://jetlogs.org/2007/10/03/php-simplexml-xpaths-and-namespaces/" title="Technorati"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Technorati" alt="Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://jetlogs.org/2007/10/03/php-simplexml-xpaths-and-namespaces/&amp;t=PHP%3A+SimpleXML+XPaths+and+Namespaces" title="Yahoo My Web"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Yahoo My Web" alt="Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://jetlogs.org/2007/10/03/php-simplexml-xpaths-and-namespaces/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHP: How to Make Life Easier with References</title>
		<link>http://jetlogs.org/2007/09/15/php-how-to-make-life-easier-with-references/</link>
		<comments>http://jetlogs.org/2007/09/15/php-how-to-make-life-easier-with-references/#comments</comments>
		<pubDate>Sat, 15 Sep 2007 00:30:02 +0000</pubDate>
		<dc:creator>Jetlogs</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://jetlogs.org/2007/09/15/php-how-to-make-life-easier-with-references/</guid>
		<description><![CDATA[Don&#8217;t you just hate it when you have to write very long codes such as below? $name = mysql_real_escape_string(strip_tags($name)); $email = mysql_real_escape_string(strip_tags($email)); $address = mysql_real_escape_string(strip_tags($address)); Even if you created a function to make coding easier, it can still be a little bit tedious: function escape_mysql($string) { return mysql_real_escape_string(strip_tags($string)); } $name = escape_mysql($name); $email = escape_mysql($email); [...]]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t you just hate it when you have to write very long codes such as below?</p>
<pre><code class='php'>$name = mysql_real_escape_string(strip_tags($name));
$email = mysql_real_escape_string(strip_tags($email));
$address = mysql_real_escape_string(strip_tags($address));</code></pre>
<pre><code class='php'></code></pre>
<p>Even if you created a function to make coding easier, it can still be a little bit tedious:</p>
<pre><code class='php'>function escape_mysql($string)
{
	return mysql_real_escape_string(strip_tags($string));
}

$name = escape_mysql($name);
$email = escape_mysql($email);
$address = escape_mysql($address);</code></pre>
<pre><code class='php'></code></pre>
<p>I&#8217;ll demonstrate a simple technique to make your life easier by using PHP&#8217;s references. By passing variables by reference, we can get rid of the variable assignment on the function&#8217;s return value. Here is how if should look like in the end:</p>
<pre><code class='php'>function escape_mysql(&#038;$string)
{
	$string = mysql_real_escape_string(strip_tags($string));
}

escape_mysql($name);
escape_mysql($email);
escape_mysql($address);</code></pre>
<p>By passing variables by reference in our <span class='code'>escape_mysql()</span> function, the variable assignment no longer becomes necessary since the function will do it instead. Now that is a lot more easier to code and understand isn&#8217;t it?</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://jetlogs.org/2007/09/15/php-how-to-make-life-easier-with-references/&amp;title=PHP%3A+How+to+Make+Life+Easier+with+References" title="Del.icio.us"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Del.icio.us" alt="Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://jetlogs.org/2007/09/15/php-how-to-make-life-easier-with-references/&amp;title=PHP%3A+How+to+Make+Life+Easier+with+References" title="digg"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/digg.png" title="digg" alt="digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://jetlogs.org/2007/09/15/php-how-to-make-life-easier-with-references/" title="Facebook"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Facebook" alt="Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://jetlogs.org/2007/09/15/php-how-to-make-life-easier-with-references/&amp;title=PHP%3A+How+to+Make+Life+Easier+with+References" title="Google Bookmarks"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/google.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://jetlogs.org/2007/09/15/php-how-to-make-life-easier-with-references/&amp;title=PHP%3A+How+to+Make+Life+Easier+with+References" title="reddit"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/reddit.png" title="reddit" alt="reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://jetlogs.org/2007/09/15/php-how-to-make-life-easier-with-references/&amp;title=PHP%3A+How+to+Make+Life+Easier+with+References" title="Stumble Upon"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Stumble Upon" alt="Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://jetlogs.org/2007/09/15/php-how-to-make-life-easier-with-references/" title="Technorati"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Technorati" alt="Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://jetlogs.org/2007/09/15/php-how-to-make-life-easier-with-references/&amp;t=PHP%3A+How+to+Make+Life+Easier+with+References" title="Yahoo My Web"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Yahoo My Web" alt="Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://jetlogs.org/2007/09/15/php-how-to-make-life-easier-with-references/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Apache vs. Lighttpd on PHP</title>
		<link>http://jetlogs.org/2007/08/23/apache-vs-lighttpd-on-php/</link>
		<comments>http://jetlogs.org/2007/08/23/apache-vs-lighttpd-on-php/#comments</comments>
		<pubDate>Thu, 23 Aug 2007 14:30:01 +0000</pubDate>
		<dc:creator>Jetlogs</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[lighttpd]]></category>

		<guid isPermaLink="false">http://jetlogs.org/2007/08/23/apache-vs-lighttpd-on-php/</guid>
		<description><![CDATA[Let me share with you my research on the web about the advantages and disadvantages of Lighttpd vs. Apache, and how it might possible affect your applications ins PHP. The following article is a compilation of what I have found on different sites on the net. Lighttpd or &#8220;Lighty&#8221; is a lightweight webserver made with [...]]]></description>
			<content:encoded><![CDATA[<p>Let me share with you my research on the web about the advantages and disadvantages of Lighttpd vs. Apache, and how it might possible affect your applications ins PHP. The following article is a compilation of what I have found on different sites on the net.</p>
<p>Lighttpd or &#8220;Lighty&#8221; is a lightweight webserver made with speed and load balancing in mind, Unlike Apache which comes with a lot of modules that consumes a lot of server resources. One of the features of Lighttpd is that it is an event-driven web server. It uses select/poll/epoll/kqueue from a single process/thread.</p>
<p>Now for the Pros and Cons:<span id="more-196"></span></p>
<p><b>Pros:</b></p>
<li>Compared to Apache, it has a smaller CPU and memory usage. Since Lighttpd uses fewer resources per request than Apache alone, it can generally serve most static content faster than Apache.</li>
<li>Lighttpd has a better load-balancing than Apache</li>
<li>Lighttpd has easier configuration options compared to Apache</li>
<li>Lighttpd is recommended for static content, or dynamic content that is cached as a static page.</li>
<li>PHP has a better performance under Lighty due to its FastCGI module (which has its own disadvantage. see below)</li>
<li>Because of its FastCGI module, the server and application processes can be restarted independently which is important for busy websites</li>
<li>Also because of the FastCGI module, per-application security policies can be implemented</li>
<p><b>Cons:</b></p>
<li>Lighttpd doesn&#8217;t have support for .htaccess files which might break current security / functionality implementations for some of your applications (i.e. HTTP authentication)</li>
<li>Using Lighttpd will only support PHP running under FastCGI as opposed to running it as a module (mod_php) which might have additional implications for the application and server (PEAR modules won&#8217;t work under FastCGI)</li>
<li>Lighttpd has some problems processing request headers (specifically CR anf LF) from browsers like Opera. For example, Opera under SSL will hang under Lighttpd.</li>
<li>Lighttpd is incompatible with Apache modules (i.e. mod_security), and has its own module repository. Lighttpd has a smaller module repository compared to apache, and has a limited community which might become a problem when needing support.</li>
<li>Lighttpd doesn&#8217;t support some control panel applications like cPanel or Plesk and will require special configurations to run them</li>
<p>Given these Pros and Cons, its really hard to decide when to  do a switch to Lighty. But as a basic rule, for server only serving mostly static content, Lighty is the better choice since it lesser overhead than Apache. Youtube&#8217;s video servers which serves static content runs on Lighty. </p>
<p>However, if you are on the fringe case wherein you need Apache&#8217;s functionality, but lacking on server resources, and an upgrade is not a viable option, there is some good news for you. Lighttpd can be run behind Apache via Apache&#8217;s proxy module. Instructions on doing this can be found on this article: </p>
<p><a href="http://www.linux.com/articles/51673">Running Lighttpd through Apache&#8217;s proxy module</a></p>
<p>So what does this basically mean? In short, we can let Apache handle the dynamic content, while we let Lighty handle the static content from a server.</p>
<p>Related links:</p>
<li><a href="http://lighttpd.net/">Official Lighttpd Website</a></li>
<li><a href="http://apache.org/">Official Apache Website</a></li>
<li><a href="http://www.fastcgi.com/">Official FastCGI Website</a></li>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://jetlogs.org/2007/08/23/apache-vs-lighttpd-on-php/&amp;title=Apache+vs.+Lighttpd+on+PHP" title="Del.icio.us"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Del.icio.us" alt="Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://jetlogs.org/2007/08/23/apache-vs-lighttpd-on-php/&amp;title=Apache+vs.+Lighttpd+on+PHP" title="digg"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/digg.png" title="digg" alt="digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://jetlogs.org/2007/08/23/apache-vs-lighttpd-on-php/" title="Facebook"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Facebook" alt="Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://jetlogs.org/2007/08/23/apache-vs-lighttpd-on-php/&amp;title=Apache+vs.+Lighttpd+on+PHP" title="Google Bookmarks"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/google.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://jetlogs.org/2007/08/23/apache-vs-lighttpd-on-php/&amp;title=Apache+vs.+Lighttpd+on+PHP" title="reddit"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/reddit.png" title="reddit" alt="reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://jetlogs.org/2007/08/23/apache-vs-lighttpd-on-php/&amp;title=Apache+vs.+Lighttpd+on+PHP" title="Stumble Upon"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Stumble Upon" alt="Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://jetlogs.org/2007/08/23/apache-vs-lighttpd-on-php/" title="Technorati"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Technorati" alt="Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://jetlogs.org/2007/08/23/apache-vs-lighttpd-on-php/&amp;t=Apache+vs.+Lighttpd+on+PHP" title="Yahoo My Web"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Yahoo My Web" alt="Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://jetlogs.org/2007/08/23/apache-vs-lighttpd-on-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP: Server Variable &#8216;PHP_SELF&#8217; is Unsafe</title>
		<link>http://jetlogs.org/2007/08/06/php-_serverphp_self-is-unsafe/</link>
		<comments>http://jetlogs.org/2007/08/06/php-_serverphp_self-is-unsafe/#comments</comments>
		<pubDate>Mon, 06 Aug 2007 01:32:52 +0000</pubDate>
		<dc:creator>Jetlogs</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://jetlogs.org/2007/08/06/php-_serverphp_self-is-unsafe/</guid>
		<description><![CDATA[How many times have you encountered PHP tutorials where it had used the predefined variable $_SERVER['PHP_SELF'] to send the form action to itself? A simple search from google returns about 33,500 results. It turns out that using $_SERVER['PHP_SELF'] is quite unsafe due to an XSS exploit. What the PHP_SELF variable does is basically return the [...]]]></description>
			<content:encoded><![CDATA[<p>How many times have you encountered PHP tutorials where it had used the <a href='http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server'>predefined variable</a> $_SERVER['PHP_SELF'] to send the form action to itself? A simple <a href='http://www.google.com/search?hl=en&#038;q=action%3D%22%24_SERVER%5B%27PHP_SELF%5D%22&#038;btnG=Search'>search from google</a> returns about 33,500 results.<span id="more-187"></span></p>
<p>It turns out that using $_SERVER['PHP_SELF'] is quite unsafe due to an XSS exploit. What the PHP_SELF variable does is basically return the filename of the executing script. Consider this simple form:  </p>
<p><b>http://test.com/form.php</b>
<pre><code class='html'>
&lt;form method="POST" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;"&gt;
   &lt;input type="text" name="username" /&gt;
   &lt;input type="submit" value="Submit" /&gt;
&lt;/form&gt;
</code></pre>
<p>If you think that this form is safe, you are mistaken. If someone inputs this URL:<br />
<span class='code'>http://test.com/form.php&#8221;&gt;&lt;script&gt;alert(&#8216;XSS&#8217;)&lt;/script&gt;&lt;&#8221;</span></p>
<p>The form&#8217;s output will now look like this:</p>
<pre><code class='html'>
&lt;form method="POST" action="form.php"&gt;
&lt;script&gt;alert('XSS')&lt;/script&gt;&lt;""&gt;
   &lt;input type="text" name="username" /&gt;
   &lt;input type="submit" value="Submit" /&gt;
&lt;/form&gt;
</code></pre>
<p>To prevent this type of attack here are some things you can do:</p>
<p><b>1. minimize the use of $_SERVER['PHP_SELF']</b><br />
If you know the target of the form action beforehand, don&#8217;t be lazy to rely on PHP_SELF.</p>
<p><b>2. use an HTML filter</b><br />
If using PHP_SELF is unavoidable, the next thing you can do is use an entity filter. You can use either PHP&#8217;s <b>htmlentities()</b> or <b>htmlspecialchars()</b>. Or even better, you can even try to do <b>strip_tags()</b> beforehand:</p>
<pre><code class='html'>
&lt;form method="POST" action="&lt;?php
echo htmlspecialchars(strip_tags($_SERVER['PHP_SELF']), ENT_QUOTES);
?&gt;"&gt;
   &lt;input type="text" name="username" /&gt;
   &lt;input type="submit" value="Submit" /&gt;
&lt;/form&gt;
</code></pre>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://jetlogs.org/2007/08/06/php-_serverphp_self-is-unsafe/&amp;title=PHP%3A+Server+Variable+%26%238216%3BPHP_SELF%26%238217%3B+is+Unsafe" title="Del.icio.us"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Del.icio.us" alt="Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://jetlogs.org/2007/08/06/php-_serverphp_self-is-unsafe/&amp;title=PHP%3A+Server+Variable+%26%238216%3BPHP_SELF%26%238217%3B+is+Unsafe" title="digg"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/digg.png" title="digg" alt="digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://jetlogs.org/2007/08/06/php-_serverphp_self-is-unsafe/" title="Facebook"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Facebook" alt="Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://jetlogs.org/2007/08/06/php-_serverphp_self-is-unsafe/&amp;title=PHP%3A+Server+Variable+%26%238216%3BPHP_SELF%26%238217%3B+is+Unsafe" title="Google Bookmarks"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/google.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://jetlogs.org/2007/08/06/php-_serverphp_self-is-unsafe/&amp;title=PHP%3A+Server+Variable+%26%238216%3BPHP_SELF%26%238217%3B+is+Unsafe" title="reddit"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/reddit.png" title="reddit" alt="reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://jetlogs.org/2007/08/06/php-_serverphp_self-is-unsafe/&amp;title=PHP%3A+Server+Variable+%26%238216%3BPHP_SELF%26%238217%3B+is+Unsafe" title="Stumble Upon"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Stumble Upon" alt="Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://jetlogs.org/2007/08/06/php-_serverphp_self-is-unsafe/" title="Technorati"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Technorati" alt="Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://jetlogs.org/2007/08/06/php-_serverphp_self-is-unsafe/&amp;t=PHP%3A+Server+Variable+%26%238216%3BPHP_SELF%26%238217%3B+is+Unsafe" title="Yahoo My Web"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Yahoo My Web" alt="Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://jetlogs.org/2007/08/06/php-_serverphp_self-is-unsafe/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Passing Input Arrays in PHP</title>
		<link>http://jetlogs.org/2007/07/19/passing-input-arrays-in-php/</link>
		<comments>http://jetlogs.org/2007/07/19/passing-input-arrays-in-php/#comments</comments>
		<pubDate>Wed, 18 Jul 2007 16:50:27 +0000</pubDate>
		<dc:creator>Jetlogs</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://jetlogs.org/2007/07/19/passing-input-arrays-in-php/</guid>
		<description><![CDATA[It seems that many people have been stumbling on my website also trying to find out how to pass input arrays in just plain PHP. For this tutorial, all you need to have is the basic knowledge of using PHP. I won&#8217;t deal with form / input validations too much, but here is how to [...]]]></description>
			<content:encoded><![CDATA[<p>It seems that many people have been stumbling on my website also trying to find out how to pass input arrays in just plain PHP. For this tutorial, all you need to have is the basic knowledge of using PHP. I won&#8217;t deal with form / input validations too much, but here is how to do it in short and simple steps:</p>
<p>The first step we need to do is create our form which will pass a multi-valued parameter. For example, a checkbox list or a multiple-select list. For our example, we shall use a checkbox list. Here is what it would look like:<span id="more-173"></span></p>
<pre><code class="html">Which text editor do you use?&lt;br /&gt;
	&lt;form method="post" action="process_input.php"&gt;
	  &lt;input type="checkbox" name="editor[]" value="Notepad" /&gt;
	  Notepad&lt;br /&gt;
	  &lt;input type="checkbox" name="editor[]" value="Scite" /&gt;
	  Scite&lt;br /&gt;
	  &lt;input type="checkbox" name="editor[]" value="Crimson Editor" /&gt;
	  Crimson Editor&lt;br /&gt;
	  &lt;input type="checkbox" name="editor[]" value="Dreamweaver" /&gt;
	  Dreamweaver&lt;br /&gt;
	  &lt;input type="checkbox" name="editor[]" value="vim" /&gt;
	  vim&lt;br /&gt;
	  &lt;input type="submit" value="submit" /&gt;
	&lt;/form&gt;</code></pre>
<p>There are basically 3 simple rules in passing input arrays from forms:<br />
1. All inputs should be inside a valid &lt;form&gt; element<br />
2. All members of the same input array should have the same input name.<br />
3. The input names should have an opening and closing bracket([]) to denote that the input being passed is an array</p>
<p>Now that we have passed the form as an input array, how do we process it in PHP? Depending on the method used on the form (POST or GET), we can use one of three predefined variables to extract the value of these inputs. And they are:</p>
<p>1. <span class="code">$_POST</span> &#8211; variable used to extract the values of inputs passed through the POST method<br />
2. <span class="code">$_GET</span> &#8211; variable used to extract the values of inputs passed through the GET method<br />
3. <span class="code">$_REQUEST</span> &#8211; variable used to extract the values of inputs passed either through the POST, GET, or cookies. This is not recommended for serious use due to security implications</p>
<p>In our case, since we have used the POST method, we need to access the <span class="code">$_POST</span> variable to retrieve the data we sent from the form. In our example, <span class="code">$_POST["editor"]</span> will contain the array of values that have been selected from the form. We could then simply use a <span class="code">foreach</span> statement to find all the values that were selected. Here is how the code will look like without any form validation being done:</p>
<pre><code class="php">foreach($_POST["editor"] as $editor)
	{
		echo $editor . "";
	}
</code></pre>
<p>However, with a few validations for checking NULL values, here is what the code would end up like:</p>
<pre><code class="php">if (isset($_POST["editor"]) &#038;&#038; is_array($_POST["editor"])
&#038;&#038; count($_POST["editor"]) > 0)
{
	foreach ($_POST["editor"] as $editor)
		{
			echo htmlspecialchars($editor, ENT_QUOTES);
			echo '&lt;br /&gt;';
		}
}</code></pre>
<p>Special thanks to Tim for the suggestion.</p>
<p><a href="http://jetlogs.org/php/php_input_arrays.php">PHP Input Arrays Demo</a><br />
<a href="http://jetlogs.org/php/php_input_arrays.zip">Download Demo Source Code</a></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://jetlogs.org/2007/07/19/passing-input-arrays-in-php/&amp;title=Passing+Input+Arrays+in+PHP" title="Del.icio.us"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Del.icio.us" alt="Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://jetlogs.org/2007/07/19/passing-input-arrays-in-php/&amp;title=Passing+Input+Arrays+in+PHP" title="digg"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/digg.png" title="digg" alt="digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://jetlogs.org/2007/07/19/passing-input-arrays-in-php/" title="Facebook"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Facebook" alt="Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://jetlogs.org/2007/07/19/passing-input-arrays-in-php/&amp;title=Passing+Input+Arrays+in+PHP" title="Google Bookmarks"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/google.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://jetlogs.org/2007/07/19/passing-input-arrays-in-php/&amp;title=Passing+Input+Arrays+in+PHP" title="reddit"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/reddit.png" title="reddit" alt="reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://jetlogs.org/2007/07/19/passing-input-arrays-in-php/&amp;title=Passing+Input+Arrays+in+PHP" title="Stumble Upon"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Stumble Upon" alt="Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://jetlogs.org/2007/07/19/passing-input-arrays-in-php/" title="Technorati"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Technorati" alt="Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://jetlogs.org/2007/07/19/passing-input-arrays-in-php/&amp;t=Passing+Input+Arrays+in+PHP" title="Yahoo My Web"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Yahoo My Web" alt="Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://jetlogs.org/2007/07/19/passing-input-arrays-in-php/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>RIP PHP4: &#8220;End of Life&#8221; announcement</title>
		<link>http://jetlogs.org/2007/07/13/rip-php4-end-of-life-announcement-for-php4/</link>
		<comments>http://jetlogs.org/2007/07/13/rip-php4-end-of-life-announcement-for-php4/#comments</comments>
		<pubDate>Fri, 13 Jul 2007 09:37:09 +0000</pubDate>
		<dc:creator>Jetlogs</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://jetlogs.org/2007/07/13/rip-php4-end-of-life-announcement-for-php4/</guid>
		<description><![CDATA[The PHP official website has just announced an &#8220;end of life&#8221; statement for PHP 4. What the statement basically says is that development for PHP 4 will only be continued until the end of this year. Support for PHP 4 will basically end this year on December 31, 2007. However, security fixes will still be [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href='http://php.net'>PHP official website</a> has just announced an &#8220;end of life&#8221; statement for PHP 4. What the statement basically says is that development for PHP 4 will only be continued until the end of this year. Support for PHP 4 will basically end this year on December 31, 2007. However, security fixes will still be released for PHP 4 until August 8, 2008.</p>
<p>This will cause a major impact in the current server set-up being used today. Currently, a majority of hosting companies and servers still uses PHP 4 installed by default. Will this cause a shift in the hosting companies to migrate to PHP 5? This year is going to be a turning point for web scripting languages. This will be the perfect opportunity for other scripting languages such as Python and Ruby to finally catch up. Will the balance of power finally shift? Only time will tell</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://jetlogs.org/2007/07/13/rip-php4-end-of-life-announcement-for-php4/&amp;title=RIP+PHP4%3A+%26%238220%3BEnd+of+Life%26%238221%3B+announcement" title="Del.icio.us"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Del.icio.us" alt="Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://jetlogs.org/2007/07/13/rip-php4-end-of-life-announcement-for-php4/&amp;title=RIP+PHP4%3A+%26%238220%3BEnd+of+Life%26%238221%3B+announcement" title="digg"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/digg.png" title="digg" alt="digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://jetlogs.org/2007/07/13/rip-php4-end-of-life-announcement-for-php4/" title="Facebook"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Facebook" alt="Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://jetlogs.org/2007/07/13/rip-php4-end-of-life-announcement-for-php4/&amp;title=RIP+PHP4%3A+%26%238220%3BEnd+of+Life%26%238221%3B+announcement" title="Google Bookmarks"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/google.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://jetlogs.org/2007/07/13/rip-php4-end-of-life-announcement-for-php4/&amp;title=RIP+PHP4%3A+%26%238220%3BEnd+of+Life%26%238221%3B+announcement" title="reddit"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/reddit.png" title="reddit" alt="reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://jetlogs.org/2007/07/13/rip-php4-end-of-life-announcement-for-php4/&amp;title=RIP+PHP4%3A+%26%238220%3BEnd+of+Life%26%238221%3B+announcement" title="Stumble Upon"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Stumble Upon" alt="Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://jetlogs.org/2007/07/13/rip-php4-end-of-life-announcement-for-php4/" title="Technorati"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Technorati" alt="Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://jetlogs.org/2007/07/13/rip-php4-end-of-life-announcement-for-php4/&amp;t=RIP+PHP4%3A+%26%238220%3BEnd+of+Life%26%238221%3B+announcement" title="Yahoo My Web"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Yahoo My Web" alt="Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://jetlogs.org/2007/07/13/rip-php4-end-of-life-announcement-for-php4/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>jQuery: Preloaders Using the Form Plug-in</title>
		<link>http://jetlogs.org/2007/07/08/jquery-preloaders-using-the-form-plug-in/</link>
		<comments>http://jetlogs.org/2007/07/08/jquery-preloaders-using-the-form-plug-in/#comments</comments>
		<pubDate>Sun, 08 Jul 2007 04:05:14 +0000</pubDate>
		<dc:creator>Jetlogs</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://jetlogs.org/2007/07/08/jquery-preloaders-using-the-form-plug-in/</guid>
		<description><![CDATA[For today&#8217;s article, I&#8217;m going to show you one of the many ways of implementing preloaders using jQuery. If you&#8217;re not familiar with preloaders, they are basically the loading text or image that appears while content is still under the processing state. An example of this would be the red Loading&#8230; on Gmail. For this [...]]]></description>
			<content:encoded><![CDATA[<p>For today&#8217;s article, I&#8217;m going to show you one of the many ways of implementing preloaders using jQuery. If you&#8217;re not familiar with preloaders, they are basically the loading text or image that appears while content is still under the processing state. An example of this would be the red <span style='background-color:#ff9999'><b>Loading&#8230;</b></span> on <a href='http://mail.google.com'>Gmail</a>. For this tutorial, I&#8217;m going to use a simple makeshift preloader that was done under 5 minutes:<br />
<img src='/jquery/preloader.gif' class='center'/></p>
<p>For this article, you need at least basic knowledge of <a href='http://jquery.com'>jQuery</a> and the use of the <a href='http://www.malsup.com/jquery/form/'>jQuery Form plug-in.</a><span id="more-164"></span></p>
<p>We will no longer be tackling the basics of using the form plug-in, but you can review it <a href="http://jetlogs.org/2007/06/26/jquery-form-plug-in-input-arrays-made-easier/">here</a></p>
<p>To implement a preloader image using the form plug-in, we must first define our preloader image, and give it a corresponding #id so we can refer to our preloader image later on:</p>
<pre><code class='html'>&lt;img src="preloader.gif" id="preloader" /&gt;</code></pre>
<p>take note that in our tutorial, we are merely using an image. You can also substitute the image with a <span class='code'>&lt;div&gt;</span>.</p>
<p>When our form page loads, we must hide the preloader image.:</p>
<pre><code class='javascript'>		$(document).ready(function()
		{
			$("#preloader").hide();
		});</code></pre>
<p>Now here is where the magic happens. The <span class='code'>ajaxForm</span> options contains a <span class='code'>beforeSubmit</span> and <span class='code'>success</span> parameter.</p>
<p><span class='code'>beforeSubmit</span> &#8211; defines the pre-submit callback function. In short, it defines what function will be called before the form is submitted<br />
<span class='code'>success</span> &#8211; defines the post-submit callback function. In short, it defines what function will be called after the form has been successfully processed</p>
<p>What we basically want to do now, is to show the preloader image when the form is still being processed, but hide it once our form has been successfully processed. Here is how to do it:</p>
<pre><code class='javascript'>		$(document).ready(function()
		{
			$('#prog_form').ajaxForm({
					target: 		'#content',
					beforeSubmit: 	showPreloader,
					success: 		hidePreloader
			});	

			$("#preloader").hide();
		});

		function showPreloader()
		{
			$("#preloader").show();
		}

		function hidePreloader()
		{
			$("#preloader").hide();
		}</code></pre>
<p>What happens here is that our pre-submit callback <span class='code'>showPreloader</span> makes the preloader image visible, while our post-submit callback <span class='code'>hidePreloader</span> exactly does the opposite.</p>
<p><a href='/jquery/jquery_preloader_using_form.php'>Demo of this tutorial</a><br />
<a href='/jquery/jquery_preloader_using_form.zip'>Download source code</a></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://jetlogs.org/2007/07/08/jquery-preloaders-using-the-form-plug-in/&amp;title=jQuery%3A+Preloaders+Using+the+Form+Plug-in" title="Del.icio.us"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Del.icio.us" alt="Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://jetlogs.org/2007/07/08/jquery-preloaders-using-the-form-plug-in/&amp;title=jQuery%3A+Preloaders+Using+the+Form+Plug-in" title="digg"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/digg.png" title="digg" alt="digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://jetlogs.org/2007/07/08/jquery-preloaders-using-the-form-plug-in/" title="Facebook"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Facebook" alt="Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://jetlogs.org/2007/07/08/jquery-preloaders-using-the-form-plug-in/&amp;title=jQuery%3A+Preloaders+Using+the+Form+Plug-in" title="Google Bookmarks"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/google.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://jetlogs.org/2007/07/08/jquery-preloaders-using-the-form-plug-in/&amp;title=jQuery%3A+Preloaders+Using+the+Form+Plug-in" title="reddit"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/reddit.png" title="reddit" alt="reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://jetlogs.org/2007/07/08/jquery-preloaders-using-the-form-plug-in/&amp;title=jQuery%3A+Preloaders+Using+the+Form+Plug-in" title="Stumble Upon"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Stumble Upon" alt="Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://jetlogs.org/2007/07/08/jquery-preloaders-using-the-form-plug-in/" title="Technorati"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Technorati" alt="Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://jetlogs.org/2007/07/08/jquery-preloaders-using-the-form-plug-in/&amp;t=jQuery%3A+Preloaders+Using+the+Form+Plug-in" title="Yahoo My Web"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Yahoo My Web" alt="Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://jetlogs.org/2007/07/08/jquery-preloaders-using-the-form-plug-in/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>jQuery: Floating Dialog Windows</title>
		<link>http://jetlogs.org/2007/07/01/jquery-floating-dialog-windows/</link>
		<comments>http://jetlogs.org/2007/07/01/jquery-floating-dialog-windows/#comments</comments>
		<pubDate>Sun, 01 Jul 2007 09:15:28 +0000</pubDate>
		<dc:creator>Jetlogs</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://jetlogs.org/2007/07/01/jquery-floating-dialog-windows/</guid>
		<description><![CDATA[The tutorial for today will be on making floating dialog windows using the jQuery library. Before jQuery, doing a simple floating dialog window would have taken an enormous amount of code, and also an enormous amount of effort to work. With the advent of jQuery, this task has been made much easier. This tutorial will [...]]]></description>
			<content:encoded><![CDATA[<p>The tutorial for today will be on making floating dialog windows using the jQuery library. Before jQuery, doing a simple floating dialog window would have taken an enormous amount of code, and also an enormous amount of effort to work. With the advent of jQuery, this task has been made much easier. This tutorial will assume that you have at least basic knowledge of using Javascript and jQuery. Before everything else, we will need the following libraries for our tutorial:</p>
<ul>
<li><a href="http://jquery.com">jQuery</a></li>
<li><a href="http://jquery.com/plugins/project/form">Form Plugin</a></li>
<li><a href="http://interface.eyecon.ro/">Interface Plugin</a></li>
</ul>
<p>In this tutorial, I&#8217;ll be making a save preferences form as an example<span id="more-156"></span></p>
<p>First of all, we need to have our save settings form. Lets label it as #layer1_form (id = &#8220;layer1_form&#8221;) :</p>
<pre><code class="html">
&lt;form id="layer1_form" method="post" action="save_settings.php"&gt;
	Display Settings&lt;br /&gt;
	&lt;input type="radio" name="display" checked="checked"
value="Default" /&gt;
	Default&lt;br /&gt;
	&lt;input type="radio" name="display" value="Option A" /&gt;
	Option A&lt;br /&gt;
	&lt;input type="radio" name="display" value="Option B" /&gt;
	Option B&lt;br /&gt;&lt;br /&gt;
	Autosave settings&lt;br /&gt;
	&lt;input type="radio" name="autosave" checked="checked"
value="Enabled" /&gt;
	Enabled&lt;br /&gt;
	&lt;input type="radio" name="autosave" value="Disabled" /&gt;
	Disabled&lt;br /&gt;&lt;br /&gt;

	&lt;input type="submit" name="submit" value="Save" /&gt;
&lt;/form&gt;
</code></pre>
<p>basically in our sample, we have 2 settings for the display and auto-save settings. However, since we need show this form in a floating dialog, we must wrap this form on a floating layer. Let&#8217;s call this floating layer #layer1 (id = &#8220;layer1&#8243;).</p>
<p>We also need to define a handle where our window can be clicked to be dragged for our interface plugin. We&#8217;ll call our handle #layer1_handle (id = &#8220;layer1_handle&#8221;). </p>
<p>As with any floating dialogs, we also need a close button. For simplicity, I&#8217;ll just use a link named #close (id = &#8220;close&#8221;). You can also use buttons or images if you want.</p>
<p>Here is what our form would look like:</p>
<pre><code class="html">
&lt;div id="layer1"&gt;
	&lt;div id="layer1_handle"&gt;
			&lt;a href="#" id="close"&gt;[ x ]&lt;/a&gt;
			Preferences
	&lt;/div&gt;
	&lt;div id="layer1_content"&gt;
		&lt;form id="layer1_form" method="post" action="save_settings.php"&gt;
			Display Settings&lt;br /&gt;
			&lt;input type="radio" name="display" checked="checked"
value="Default" /&gt;
			Default&lt;br /&gt;
			&lt;input type="radio" name="display" value="Option A" /&gt;
			Option A&lt;br /&gt;
			&lt;input type="radio" name="display" value="Option B" /&gt;
			Option B&lt;br /&gt;&lt;br /&gt;
			Autosave settings&lt;br /&gt;
			&lt;input type="radio" name="autosave" checked="checked"
value="Enabled" /&gt;
			Enabled&lt;br /&gt;
			&lt;input type="radio" name="autosave" value="Disabled" /&gt;
			Disabled&lt;br /&gt;&lt;br /&gt;

			&lt;input type="submit" name="submit" value="Save" /&gt;
		&lt;/form&gt;
	&lt;/div&gt;
&lt;/div&gt;
</code></pre>
<p>For our backend, we&#8217;ll simply print out the options that were selected on the form for simplicity. We&#8217;ll call our backend save_settings.php</p>
<p><b>save_settings.php</b></p>
<pre><code class="php">
&lt;b&gt;Preferences:&lt;/b&gt;&lt;br /&gt;
Display Setting:
&lt;?php echo htmlspecialchars($_POST['display'], ENT_QUOTES); ?&gt;&lt;br /&gt;
Autosave Setting:
&lt;?php echo htmlspecialchars($_POST['autosave'], ENT_QUOTES); ?&gt;&lt;br /&gt;
</code></pre>
<p>Now that we have defined our form and our backend, the next step will me indicating where we would output the AJAX response. Let&#8217;s create a new container called #content. It will contain the button for setting the preferences and will be replaced by the AJAX response when the form action is successful:</p>
<pre><code class="html">
&lt;div id="content"&gt;&lt;input type="button" id="preferences"
value="Edit Preferences" /&gt;&lt;/div&gt;
</code></pre>
<p>Now that we have defined our form, its time to implement the jQuery functions. First of all, we need to import the libraries by defining the javascript libraries within the <span class="code">&lt;head&gt;</span> of our document:</p>
<pre><code class="html">
&lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="interface.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="jquery.form.js"&gt;&lt;/script&gt;
</code></pre>
<p>To load our functions after the DOM has rendered, we must declare the jQuery functions under  <span class="code">$(document).ready</span> function of our script inside the <span class="code">&lt;body&gt;</span> of our document:</p>
<pre><code class="html">
&lt;script type="text/javascript"&gt;
	$(document).ready(function()
	{
		//jQuery events go here
	}
&lt;script&gt;
</code></pre>
<p>Now lets define the #layer1 wrapper of our form as a draggable window with a z-index of 20, and an opacity of 0.7 when being dragged:</p>
<pre><code class="javascript">
$('#layer1').Draggable(
		{
			zIndex:	20,
			ghosting:false,
			opacity: 0.7,
			handle:	'#layer1_handle'
		}
	);
</code></pre>
<p>and to hide the floating window, we just hide the wrapper, in our case, we need to hide #layer1:</p>
<pre><code class="javascript">
$("#layer1").hide();
</code></pre>
<p>and to display our floating dialog when the edit preferences button is clicked:</p>
<pre><code class="javascript">
$('#preferences').click(function()
{
	$("#layer1").show();
});
</code></pre>
<p>and to hide the form once again when #close is clicked</p>
<pre><code class="javascript">
$('#close').click(function()
{
	$("#layer1").hide();
});
</code></pre>
<p>And finally to define our form as an AJAX form, we need to define #content as the target container where the AJAX response will show. We also need to automatically close the floating dialog window on success:</p>
<pre><code class="javascript">
$('#layer1_form').ajaxForm({
	target: '#content',
	success: function()
	{
		$("#layer1").hide();
	}
});
</code></pre>
<p>To view the working demo of this tutorial, just click on the links below</p>
<ul>
<li><a href="http://jetlogs.org/jquery/floating_dialog.php">Full Demo of this tutorial</a></li>
<li><a href="http://jetlogs.org/jquery/jquery_floating_dialog.zip">Download Source Code</a></li>
<li><a href="http://jetlogs.org/2008/06/04/jqmodal-draggable-floating-dialog/">Alternate tutorial using jqModal</a></li>
</ul>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://jetlogs.org/2007/07/01/jquery-floating-dialog-windows/&amp;title=jQuery%3A+Floating+Dialog+Windows" title="Del.icio.us"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Del.icio.us" alt="Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://jetlogs.org/2007/07/01/jquery-floating-dialog-windows/&amp;title=jQuery%3A+Floating+Dialog+Windows" title="digg"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/digg.png" title="digg" alt="digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://jetlogs.org/2007/07/01/jquery-floating-dialog-windows/" title="Facebook"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Facebook" alt="Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://jetlogs.org/2007/07/01/jquery-floating-dialog-windows/&amp;title=jQuery%3A+Floating+Dialog+Windows" title="Google Bookmarks"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/google.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://jetlogs.org/2007/07/01/jquery-floating-dialog-windows/&amp;title=jQuery%3A+Floating+Dialog+Windows" title="reddit"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/reddit.png" title="reddit" alt="reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://jetlogs.org/2007/07/01/jquery-floating-dialog-windows/&amp;title=jQuery%3A+Floating+Dialog+Windows" title="Stumble Upon"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Stumble Upon" alt="Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://jetlogs.org/2007/07/01/jquery-floating-dialog-windows/" title="Technorati"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Technorati" alt="Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://jetlogs.org/2007/07/01/jquery-floating-dialog-windows/&amp;t=jQuery%3A+Floating+Dialog+Windows" title="Yahoo My Web"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Yahoo My Web" alt="Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://jetlogs.org/2007/07/01/jquery-floating-dialog-windows/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Proper Use of References in PHP</title>
		<link>http://jetlogs.org/2007/06/09/proper-use-of-references-in-php/</link>
		<comments>http://jetlogs.org/2007/06/09/proper-use-of-references-in-php/#comments</comments>
		<pubDate>Sat, 09 Jun 2007 10:40:36 +0000</pubDate>
		<dc:creator>Jetlogs</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://jetlogs.org/2007/06/09/proper-use-of-references-in-php/</guid>
		<description><![CDATA[It has been a long time since I&#8217;ve made an article about programming, so its finally time I stop slacking and write an article. For today&#8217;s article, I&#8217;m going to talk about the proper use of references in PHP. It has been hard-wired to almost every PHP programmer, that when passing arrays or objects to [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a long time since I&#8217;ve made an article about programming, so its finally time I stop slacking and write an article. For today&#8217;s article, I&#8217;m going to talk about the proper use of references in PHP.</p>
<p>It has been hard-wired to almost every PHP programmer, that when passing arrays or objects to functions, they must be passed by reference, not by value so that the function will not work on the copy, hence improving performance.</p>
<p>Here is the sample code in PHP 4 that most programmers have been taught with regards to references</p>
<pre><code class="php">
function foo(&#038;$variable_array)
{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;shuffle($variable_array);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $variable_array;
}</span>
<span class="code">
$bar = array(1, 2, 3, 4, 5);
foo($bar); //returns a shuffled array
</code></pre>
<p><span id="more-131"></span></p>
<p>It sounds logical to always use references when passing large and complex variables such as arrays and objects. In this sample code, if we were to pass the array by value, PHP will automatically create a copy of the variable since we modified its contents. However this isn&#8217;t usually the case. Take a look at this scenario:</p>
<pre><code class="php">
function foo(&#038;$variable_array)
{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo $variable_array[0];
}</span>

<span class="code">$bar = array(1, 2, 3, 4, 5);
foo($bar); //prints 1
</code></pre>
<p>In this code, we didn&#8217;t modify the array&#8217;s value at all. If we were to just pass the array by value, PHP will not make a copy of the array since we didn&#8217;t have any changes to the variable itself. So instead of speeding up performance, we added an unnecessary step of adding a reference to a variable.</p>
<p>To put is shortly, references should only be used when the variables passed are complex like arrays, objects, and resources and only if the variable is going to me modified inside the function. Otherwise, just use the regular pass by value method.</p>
<p>It is a good thing that thinking about when to use references was significantly made easier in PHP 5, where everything is passed by reference by default. </p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://jetlogs.org/2007/06/09/proper-use-of-references-in-php/&amp;title=Proper+Use+of+References+in+PHP" title="Del.icio.us"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Del.icio.us" alt="Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://jetlogs.org/2007/06/09/proper-use-of-references-in-php/&amp;title=Proper+Use+of+References+in+PHP" title="digg"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/digg.png" title="digg" alt="digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://jetlogs.org/2007/06/09/proper-use-of-references-in-php/" title="Facebook"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Facebook" alt="Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://jetlogs.org/2007/06/09/proper-use-of-references-in-php/&amp;title=Proper+Use+of+References+in+PHP" title="Google Bookmarks"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/google.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://jetlogs.org/2007/06/09/proper-use-of-references-in-php/&amp;title=Proper+Use+of+References+in+PHP" title="reddit"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/reddit.png" title="reddit" alt="reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://jetlogs.org/2007/06/09/proper-use-of-references-in-php/&amp;title=Proper+Use+of+References+in+PHP" title="Stumble Upon"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Stumble Upon" alt="Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://jetlogs.org/2007/06/09/proper-use-of-references-in-php/" title="Technorati"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Technorati" alt="Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://jetlogs.org/2007/06/09/proper-use-of-references-in-php/&amp;t=Proper+Use+of+References+in+PHP" title="Yahoo My Web"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Yahoo My Web" alt="Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://jetlogs.org/2007/06/09/proper-use-of-references-in-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Grand Cross Calculator: Pre-final Version</title>
		<link>http://jetlogs.org/2007/06/05/grand-cross-calculator-pre-final-version/</link>
		<comments>http://jetlogs.org/2007/06/05/grand-cross-calculator-pre-final-version/#comments</comments>
		<pubDate>Tue, 05 Jun 2007 11:54:49 +0000</pubDate>
		<dc:creator>Jetlogs</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Video Games]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[grand cross]]></category>
		<category><![CDATA[ragnarok online]]></category>

		<guid isPermaLink="false">http://jetlogs.org/2007/06/05/grand-cross-calculator-pre-final-version/</guid>
		<description><![CDATA[With great improvements in both performance and presentation, the pre-final GC calc has been released. Most of the codes were rewritten to include the additional options. The calc now supports additional options namely: Enemy Element Weapon Size Penalties The only thing missing for the calc are the additional options for buffs like Blessing, and Impositio [...]]]></description>
			<content:encoded><![CDATA[<p>With great improvements in both performance and presentation, the <a href="http://jetlogs.org/sandbox/gc.php">pre-final GC calc</a> has been released. Most of the codes were rewritten to include the additional options.</p>
<p>The calc now supports additional options namely:</p>
<li>Enemy Element</li>
<li>Weapon Size Penalties</li>
<p>The only thing missing for the calc are the additional options for buffs like Blessing, and Impositio Manus. And also the final addition will be the monster data, which I will do once I have some extra slacking time</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://jetlogs.org/2007/06/05/grand-cross-calculator-pre-final-version/&amp;title=Grand+Cross+Calculator%3A+Pre-final+Version" title="Del.icio.us"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Del.icio.us" alt="Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://jetlogs.org/2007/06/05/grand-cross-calculator-pre-final-version/&amp;title=Grand+Cross+Calculator%3A+Pre-final+Version" title="digg"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/digg.png" title="digg" alt="digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://jetlogs.org/2007/06/05/grand-cross-calculator-pre-final-version/" title="Facebook"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Facebook" alt="Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://jetlogs.org/2007/06/05/grand-cross-calculator-pre-final-version/&amp;title=Grand+Cross+Calculator%3A+Pre-final+Version" title="Google Bookmarks"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/google.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://jetlogs.org/2007/06/05/grand-cross-calculator-pre-final-version/&amp;title=Grand+Cross+Calculator%3A+Pre-final+Version" title="reddit"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/reddit.png" title="reddit" alt="reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://jetlogs.org/2007/06/05/grand-cross-calculator-pre-final-version/&amp;title=Grand+Cross+Calculator%3A+Pre-final+Version" title="Stumble Upon"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Stumble Upon" alt="Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://jetlogs.org/2007/06/05/grand-cross-calculator-pre-final-version/" title="Technorati"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Technorati" alt="Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://jetlogs.org/2007/06/05/grand-cross-calculator-pre-final-version/&amp;t=Grand+Cross+Calculator%3A+Pre-final+Version" title="Yahoo My Web"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Yahoo My Web" alt="Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://jetlogs.org/2007/06/05/grand-cross-calculator-pre-final-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Minor Updates: GC Calc</title>
		<link>http://jetlogs.org/2007/05/23/minor-updates-gc-calc/</link>
		<comments>http://jetlogs.org/2007/05/23/minor-updates-gc-calc/#comments</comments>
		<pubDate>Tue, 22 May 2007 17:39:21 +0000</pubDate>
		<dc:creator>Jetlogs</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Video Games]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[grand cross]]></category>
		<category><![CDATA[ragnarok online]]></category>

		<guid isPermaLink="false">http://jetlogs.org/2007/05/23/minor-updates-gc-calc/</guid>
		<description><![CDATA[Its a very busy week so I&#8217;ll just post what has changed on the Grand Cross Damage Calculator for Ragnarok Online since the last update: 05/12/2007 &#8211; Added effect of DEX to min / max ATK values 05/12/2007 &#8211; Added GC damage computation for Bow type weapons 05/16/2007 &#8211; Added the effects of Picky Card [...]]]></description>
			<content:encoded><![CDATA[<p>Its a very busy week so I&#8217;ll just post what has changed on the <a href="http://jetlogs.org/sandbox/gc.php" target="_blank">Grand Cross Damage Calculator</a> for Ragnarok Online since the last update:</p>
<p>05/12/2007 &#8211; Added effect of DEX to min / max ATK values<br />
05/12/2007 &#8211; Added GC damage computation for Bow type weapons<br />
05/16/2007 &#8211; Added the effects of Picky Card and &#8220;The Sign&#8221; accessory as options<br />
05/22/2007 &#8211; Added DEF / MDEF reductions to equation</p>
<p>As an added bonus, here are some words on wisdom in family planning:</p>
<p><img src='http://jetlogs.org/wp-content/uploads/2007/05/rear_entrance.jpg' alt='Rear Entrance'  class='center' /></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://jetlogs.org/2007/05/23/minor-updates-gc-calc/&amp;title=Minor+Updates%3A+GC+Calc" title="Del.icio.us"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Del.icio.us" alt="Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://jetlogs.org/2007/05/23/minor-updates-gc-calc/&amp;title=Minor+Updates%3A+GC+Calc" title="digg"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/digg.png" title="digg" alt="digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://jetlogs.org/2007/05/23/minor-updates-gc-calc/" title="Facebook"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Facebook" alt="Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://jetlogs.org/2007/05/23/minor-updates-gc-calc/&amp;title=Minor+Updates%3A+GC+Calc" title="Google Bookmarks"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/google.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://jetlogs.org/2007/05/23/minor-updates-gc-calc/&amp;title=Minor+Updates%3A+GC+Calc" title="reddit"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/reddit.png" title="reddit" alt="reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://jetlogs.org/2007/05/23/minor-updates-gc-calc/&amp;title=Minor+Updates%3A+GC+Calc" title="Stumble Upon"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Stumble Upon" alt="Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://jetlogs.org/2007/05/23/minor-updates-gc-calc/" title="Technorati"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Technorati" alt="Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://jetlogs.org/2007/05/23/minor-updates-gc-calc/&amp;t=Minor+Updates%3A+GC+Calc" title="Yahoo My Web"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Yahoo My Web" alt="Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://jetlogs.org/2007/05/23/minor-updates-gc-calc/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Avoiding Google Hell in WordPress</title>
		<link>http://jetlogs.org/2007/05/13/avoiding-google-hell-in-wordpress/</link>
		<comments>http://jetlogs.org/2007/05/13/avoiding-google-hell-in-wordpress/#comments</comments>
		<pubDate>Sun, 13 May 2007 04:27:27 +0000</pubDate>
		<dc:creator>Jetlogs</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://jetlogs.org/2007/05/13/avoiding-google-hell-in-wordpress/</guid>
		<description><![CDATA[Ever had a blog in WordPress? And did you ever wonder why your page results on Google will sometimes suddenly dissappear from the main results into the supplemental results? Here are some tips to de-mystify what contributes to this effect, and how to avoid it from happening in WordPress. In light of the recent changes [...]]]></description>
			<content:encoded><![CDATA[<p>Ever had a blog in <a href="http://wordpress.org" target="_blank">WordPress</a>? And did you ever wonder why your page results on Google will sometimes suddenly dissappear from the main results into the supplemental results? Here are some tips to de-mystify what contributes to this effect, and how to avoid it from happening in WordPress.</p>
<p>In light of the recent changes in Google&#8217;s SERP algorithm, it seems that a lot of sites have been pushed from the main index into the so called <a href="http://www.mattcutts.com/blog/google-hell/" target="_blank">Google Hell</a>. Unless you have garnered enough credibility through high quality backlinks/inbound links, more often than not, your page would be pushed there.<span id="more-79"></span></p>
<p>So why is this happening? It seems that features on WordPress that improve usability for users are seen by the googlebots as SPAM. The main culprit? The duplication of content. So how do we solve this? We leave the usability features for the users, but deny access to them from the googlebot. Here are some tips on how to do that:</p>
<p><strong>1. Never put a post in more than one category</strong></p>
<p>This is the simplest way to avoid the googlebot from seeing duplicate content whenever they crawl your category pages. However, this method greatly diminishes the usability of your blog. Which then brings us to our second tip:</p>
<p><strong>2. Block googlebot from your category pages</strong></p>
<p>If duplication of content is unavoidable due to your category pages, then the next step would be making your category pages available for your users, but not for the googlebot. This can be done by editing your <span class='code'>robots.txt</span> in the root of your webserver. Below is a sample <span class='code'>robots.txt</span> file to exclude the googlebot from tour category pages:</p>
<p><span class='code'>User-agent: *<br />
Allow:</span></p>
<p><span class='code'>User-agent: *<br />
Disallow: /category/</span></p>
<p>However, this method will highly depend on how your permalink structure is optimized in wordpress.</p>
<p><strong>3. Block googlebot from your archive pages</strong></p>
<p>Another major culprit on being indexed to the supplemental results is none other than your monthly archives. Just like the case with your categories, more often than not, the content of your front page will be almost exactly the same as the archives for the current month! A major penalty for google. If your archives and category settings cannot be blocked sufficiently by using <span class='code'>robots.txt</span>. There is another method, editing the wordpress codes themselves. </p>
<p>Make the links to your archive links have the <span class='code'>rel=&#8221;nofollow&#8221;</span> attribute to prevent it from being crawled. This can be done my modifying the <span class='code'>/wp-includes/general-template.php</span> file. Here is how to do it:</p>
<p>Find this code (line 298 in v2.1.3):</p>
<pre><code class='php'>elseif ('html' == $format)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return "\t&lt;li&gt;$before&lt;a href='$url'
title='$title_text'&gt;$text&lt;/a&gt;$after&lt;/li&gt;\n";
else // custom
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return "\t$before&lt;a href='$url'
title='$title_text'&gt;$text&lt;/a&gt;$after\n";</code></pre>
<p>replace with:</p>
<pre><code class='php'>elseif ('html' == $format)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return "\t&lt;li&gt;$before&lt;a href='$url'
title='$title_text rel='nofollow'&gt;$text&lt;/a&gt;$after&lt;/li&gt;\n";
else // custom
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return "\t$before&lt;a href='$url'
title='$title_text' rel='nofollow'&gt;$text&lt;/a&gt;$after\n";</code></pre>
<p><strong>4. Assign a unique meta description for each post</strong></p>
<p>Using the <a href="http://wp.uberdose.com/2006/11/04/another-wordpress-meta-plugin/" target="_blank">Another WordPress Meta Plugin</a>, you can assign unique meta description for each of your pages. This will help differentiate the articles from your wordpress index page, from the individual posts page themselves.</p>
<p><strong>5. UPDATE: There is already a WordPress Plugin available</strong></p>
<p>It seems that someone else has already figured out this problem before I did and even made a wordpress plugin for it. It works by making the headers of your category and archives files have the <span class="code">noindex</span> attribute. You can download the plugin <a href="http://www.seologs.com/wordpress-duplicate-content-cure/" target="_blank">here</a> [seologs.com]</p>
<p>I hope that these tips have helped you in avoiding the depths of Google hell.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://jetlogs.org/2007/05/13/avoiding-google-hell-in-wordpress/&amp;title=Avoiding+Google+Hell+in+WordPress" title="Del.icio.us"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Del.icio.us" alt="Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://jetlogs.org/2007/05/13/avoiding-google-hell-in-wordpress/&amp;title=Avoiding+Google+Hell+in+WordPress" title="digg"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/digg.png" title="digg" alt="digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://jetlogs.org/2007/05/13/avoiding-google-hell-in-wordpress/" title="Facebook"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Facebook" alt="Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://jetlogs.org/2007/05/13/avoiding-google-hell-in-wordpress/&amp;title=Avoiding+Google+Hell+in+WordPress" title="Google Bookmarks"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/google.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://jetlogs.org/2007/05/13/avoiding-google-hell-in-wordpress/&amp;title=Avoiding+Google+Hell+in+WordPress" title="reddit"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/reddit.png" title="reddit" alt="reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://jetlogs.org/2007/05/13/avoiding-google-hell-in-wordpress/&amp;title=Avoiding+Google+Hell+in+WordPress" title="Stumble Upon"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Stumble Upon" alt="Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://jetlogs.org/2007/05/13/avoiding-google-hell-in-wordpress/" title="Technorati"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Technorati" alt="Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://jetlogs.org/2007/05/13/avoiding-google-hell-in-wordpress/&amp;t=Avoiding+Google+Hell+in+WordPress" title="Yahoo My Web"><img class="social_img" src="http://jetlogs.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Yahoo My Web" alt="Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://jetlogs.org/2007/05/13/avoiding-google-hell-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

