<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Cohesive Web</title>
	
	<link>http://blog.webconsultingengineering.com</link>
	<description>In search of reasons for web addiction</description>
	<lastBuildDate>Fri, 20 Aug 2010 14:17:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/CohesiveWeb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="cohesiveweb" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>SEO Correction in PEAR::Pager</title>
		<link>http://blog.webconsultingengineering.com/phptalk/seo-correction-pager.html</link>
		<comments>http://blog.webconsultingengineering.com/phptalk/seo-correction-pager.html#comments</comments>
		<pubDate>Fri, 20 Aug 2010 14:17:04 +0000</pubDate>
		<dc:creator>Susenjit</dc:creator>
				<category><![CDATA[Php Talk]]></category>
		<category><![CDATA[pager]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[url correction]]></category>
		<category><![CDATA[usefull tips]]></category>

		<guid isPermaLink="false">http://blog.webconsultingengineering.com/?p=100</guid>
		<description><![CDATA[Pagination is a common practice to show big volume of data. It is quite important if you are showing dynamically populated data. For myself I mostly use PEAR::Pager to display paginated data. If you are familiar with this package then you know that you can use 2 types of pagination display, as &#8211; sliding and [...]]]></description>
			<content:encoded><![CDATA[<p>Pagination is a common practice to show big volume of data. It is quite important if you are showing dynamically populated data.</p>
<p>For myself I mostly use <a href="http://pear.php.net/package/Pager" target="_blank">PEAR::Pager</a> to display paginated data. If you are familiar with this package then you know that you can use 2 types of pagination display, as &#8211; sliding and jumping. In case of sliding display with a common practice is to use it with constructor option append:true and urlVar:<em>&lt;variablename&gt;</em>.</p>
<p>Let me show an example of this kind of usage -</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">$Params</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;itemData&#8217;</span> <span class="sy0">=&gt;</span> <span class="re0">$dataDetails</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;perPage&#8217;</span> <span class="sy0">=&gt;</span> <span class="re0">$ViewPerPage</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;append&#8217;</span> <span class="sy0">=&gt;</span> <span class="kw4">true</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;separator&#8217;</span> <span class="sy0">=&gt;</span> <span class="st_h">&#8216;|&#8217;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;spacesBeforeSeparator&#8217;</span> <span class="sy0">=&gt;</span> <span class="nu0">1</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;spacesAfterSeparator&#8217;</span> <span class="sy0">=&gt;</span> <span class="nu0">1</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;clearIfVoid&#8217;</span> <span class="sy0">=&gt;</span> <span class="kw4">false</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;urlVar&#8217;</span> <span class="sy0">=&gt;</span> <span class="st_h">&#8216;page&#8217;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;useSessions&#8217;</span> <span class="sy0">=&gt;</span> <span class="kw4">true</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;closeSession&#8217;</span> <span class="sy0">=&gt;</span> <span class="kw4">true</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;mode&#8217;</span> &nbsp;<span class="sy0">=&gt;</span> <span class="st_h">&#8216;Sliding&#8217;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;importQuery&#8217;</span> <span class="sy0">=&gt;</span> <span class="kw4">true</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;linkClass&#8217;</span> <span class="sy0">=&gt;</span> <span class="st_h">&#8216;LinkStyle&#8217;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$Pager</span> <span class="sy0">=</span> Pager<span class="sy0">::</span><span class="me2">factory</span><span class="br0">&#40;</span><span class="re0">$Params</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$DataDetailsInArray</span> <span class="sy0">=</span> <span class="re0">$Pager</span><span class="sy0">-&gt;</span><span class="me1">getPageData</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$PaginationLinks</span> <span class="sy0">=</span> <span class="re0">$Pager</span><span class="sy0">-&gt;</span><span class="me1">getLinks</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
</ol>
</div>
</div>
<p>Now if you print/echo the $PaginationLinks, then you will get pagination like 1 2 3 4 etc. </p>
<p>Now let me describe you the problem:<br />
Say your page url is mydata.php. So mydata.php page will show the first page of paginated data. while using the pagination links you will get a page with url mydata.php?page=1. This page shows the first page of paginated data. Now you are having a page with 2 different url like <em>mydata.php</em> and <em>mydata.php?page=1</em>. In SEO this is known as duplicate content. This is not good if you are seriously deal with SEO.</p>
<p>Here is the correction for this. This is simple but effective.</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_GET</span><span class="br0">&#91;</span><span class="st_h">&#8216;page&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="sy0">&amp;&amp;</span> <span class="re0">$_GET</span><span class="br0">&#91;</span><span class="st_h">&#8216;page&#8217;</span><span class="br0">&#93;</span> <span class="sy0">&gt;</span> 1<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="re0">$PaginationLinks</span><span class="br0">&#91;</span><span class="st_h">&#8216;all&#8217;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <a href="http://www.php.net/str_replace"><span class="kw3">str_replace</span></a><span class="br0">&#40;</span><a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st_h">&#8216;?page=1&quot;&#8217;</span><span class="sy0">,</span> <span class="st_h">&#8216;&amp;amp;page=1&quot;&#8217;</span><span class="br0">&#41;</span><span class="sy0">,</span> <span class="st_h">&#8216;&quot;&#8217;</span><span class="sy0">,</span> <span class="re0">$PaginationLinks</span><span class="br0">&#91;</span><span class="st_h">&#8216;all&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
</div>
<p>Use this code section just after generating $PaginationLinks. Hope this will help you. As always comments/suggestions are welcome. But spammers please don&#8217;t waste your time. <img src='http://blog.webconsultingengineering.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.webconsultingengineering.com/phptalk/seo-correction-pager.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PaginationSlider – a jQuery plugin</title>
		<link>http://blog.webconsultingengineering.com/development/paginationslider-jquery-plugin.html</link>
		<comments>http://blog.webconsultingengineering.com/development/paginationslider-jquery-plugin.html#comments</comments>
		<pubDate>Wed, 11 Aug 2010 09:50:32 +0000</pubDate>
		<dc:creator>Susenjit</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery plugin]]></category>
		<category><![CDATA[web client side script]]></category>

		<guid isPermaLink="false">http://blog.webconsultingengineering.com/?p=95</guid>
		<description><![CDATA[I have started using jQuery &#8211; JavaScript framework almost end of the last year. I have also used it for my last couple of projects. I find it very useful to design/develop complex type of functionality in the client-end. One of the interesting feature of jQuery is that it provides a large number of plugins [...]]]></description>
			<content:encoded><![CDATA[<p>I have started using <a href="http://jquery.com/" target="_blank">jQuery</a> &#8211; JavaScript framework almost end of the last year. I have also used it for my last couple of projects. I find it very useful to design/develop complex type of functionality in the client-end. One of the interesting feature of jQuery is that it provides a large number of plugins designed by different developers. They are very useful too.</p>
<p>In my current project I need to display multiple content pages within a web page. I require to slide the page numbers so that user can view the number of pages by sliding/scrolling.  I was looking for some good plugin which could satisfy my need. I have tested some of them but couldn&#8217;t find out the ideal one. So wrote the basic code for the functionality and the effect. However I wasn&#8217;t satisfied with my work as I was looking for some plugin for it.  I thought it is the best time to try authoring plugin in jQuery.</p>
<p>It took almost 9 days to convert the code into a plugin. I gave the plugin namespace as <strong>paginationslider</strong>.</p>
<p><strong>Code example:</strong><br />
Script section -</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1">&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;&gt;&lt;/script&gt;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.paginationslider.js&quot;&gt;&lt;/script&gt;</div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span>script type<span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span><span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1">$<span class="br0">&#40;</span>document<span class="br0">&#41;</span>.<span class="me1">ready</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;$<span class="br0">&#40;</span><span class="st0">&#8216;#sliderMain&#8217;</span><span class="br0">&#41;</span>.<span class="me1">paginationslider</span><span class="br0">&#40;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SliderLeft<span class="sy0">:</span><span class="st0">&#8216;LeftSlide&#8217;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SliderRight<span class="sy0">:</span><span class="st0">&#8216;RightSlide&#8217;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;/</span>script<span class="sy0">&gt;</span></div>
</li>
</ol>
</div>
</div>
<p>Style section &#8211; </p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="re1">.pgSlider</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">width</span><span class="sy0">:</span> <span class="re3">80px</span><span class="sy0">;</span> <span class="kw1">overflow</span><span class="sy0">:</span> <span class="kw2">auto</span><span class="sy0">;</span> <span class="kw1">background</span><span class="sy0">:</span><span class="re0">#fff</span><span class="sy0">;</span> <span class="kw1">margin</span><span class="sy0">:</span>0 <span class="kw2">auto</span><span class="sy0">;</span> <span class="kw1">position</span><span class="sy0">:</span><span class="kw2">relative</span><span class="sy0">;</span> <span class="kw1">border</span><span class="sy0">:</span><span class="re3">1px</span> <span class="kw2">solid</span> orange<span class="sy0">;</span> <span class="kw1">float</span><span class="sy0">:</span><span class="kw1">left</span><span class="sy0">;</span> <span class="kw1">display</span><span class="sy0">:</span><span class="kw2">inline</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">.pgSlider</span> ul <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">block</span><span class="sy0">;</span> <span class="kw1">padding</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span> <span class="kw1">margin</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span> <span class="kw1">list-style</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span> <span class="kw1">position</span><span class="sy0">:</span><span class="kw2">relative</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">.pgSlider</span> ul li <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">block</span><span class="sy0">;</span> <span class="kw1">float</span><span class="sy0">:</span> <span class="kw1">left</span><span class="sy0">;</span> <span class="kw1">background</span><span class="sy0">:</span><span class="re0">#E3ECF4</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">.pgSlider</span> a <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">block</span><span class="sy0">;</span> <span class="kw1">text-decoration</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span> <span class="kw1">text-align</span><span class="sy0">:</span><span class="kw2">center</span><span class="sy0">;</span> <span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">5px</span> <span class="re3">8px</span><span class="sy0">;</span> <span class="kw1">color</span><span class="sy0">:</span><span class="re0">#1079B1</span><span class="sy0">;</span> <span class="kw1">font-weight</span><span class="sy0">:</span><span class="kw2">bold</span><span class="sy0">;</span> <span class="kw1">border-right</span><span class="sy0">:</span><span class="re3">1px</span> <span class="kw2">solid</span> <span class="re0">#fff</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
</div>
<p>HTML Section &#8211; </p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="sc2">&lt;<a href="http://december.com/html/4/element/pre.html"><span class="kw2">pre</span></a> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;html&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;code&quot;</span>&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;paginationContainer&quot;</span>&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;LeftSlide&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;sliderArrow&quot;</span>&gt;</span><span class="sc1">&amp;lt;&amp;lt;</span><span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;sliderMain&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;pgSlider&quot;</span>&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/ul.html"><span class="kw2">ul</span></a>&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#1&quot;</span>&gt;</span>1<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#2&quot;</span>&gt;</span>2<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#3&quot;</span>&gt;</span>3<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#4&quot;</span>&gt;</span>4<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#5&quot;</span>&gt;</span>5<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#6&quot;</span>&gt;</span>6<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#7&quot;</span>&gt;</span>7<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#8&quot;</span>&gt;</span>8<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#9&quot;</span>&gt;</span>9<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/ul.html"><span class="kw2">ul</span></a>&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;RightSlide&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;sliderArrow&quot;</span>&gt;</span><span class="sc1">&amp;gt;&amp;gt;</span><span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/pre.html"><span class="kw2">pre</span></a>&gt;</span></div>
</li>
</ol>
</div>
</div>
<p>I will eagerly wait for your reviews on this plugin. Here you can view the <a title="PaginationSlider" href="http://www.webconsultingengineering.com/paginationslider/" target="_blank">demo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.webconsultingengineering.com/development/paginationslider-jquery-plugin.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Freetag PEAR DB Version</title>
		<link>http://blog.webconsultingengineering.com/phptalk/freetag-peardb.html</link>
		<comments>http://blog.webconsultingengineering.com/phptalk/freetag-peardb.html#comments</comments>
		<pubDate>Wed, 16 Jun 2010 13:29:38 +0000</pubDate>
		<dc:creator>Susenjit</dc:creator>
				<category><![CDATA[Php Talk]]></category>
		<category><![CDATA[Folksonomy]]></category>
		<category><![CDATA[Freetag]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php class]]></category>
		<category><![CDATA[Tagging]]></category>

		<guid isPermaLink="false">http://blog.webconsultingengineering.com/?p=84</guid>
		<description><![CDATA[While working with tagging application my favourite is freetag by Gordon Luk. It is a comprehensive open source tagging and folksonomy code in php. The source code is also hosted in Google Code. The best feature of it is you can use this code with little modification to fit your requirement. First time I used [...]]]></description>
			<content:encoded><![CDATA[<p>While working with tagging application my favourite is <a title="Freetag" href="http://getluky.net/freetag/" target="_blank">freetag</a> by Gordon Luk. It is a comprehensive open source tagging and folksonomy code in php. The <a href="http://code.google.com/p/freetag/" target="_blank">source code</a> is also hosted in Google Code. The best feature of it is you can use this code with little modification to fit your requirement. First time I used it in <a href="http://advaitaashrama.org/" target="_blank">advaitaashrama.org</a> for their book store application. Currently I am using it in another website which is under development.</p>
<p>I am having an issue of compatibility with this code and I am writting this post for it. If you look at the code you will find that it uses the <a href="http://phplens.com/adodb/" target="_blank">ADODB Library</a> for database operations. In my case I am happy with <a href="http://pear.php.net/package/DB/" target="_blank">PEAR::DB</a>. Now for me to use this code I need to use 2 different database component as PEAR::DB and ADODB Library. It seems useless to me. So I decided to make the code compatiable with PEAR::DB. While working upon the compatibility modification I also made 3 changes as</p>
<ol>
<li>I have written a function as  show_debug_text() which is a replacement of debug_text().</li>
<li>I have removed the silly_list() function from my code as it was declared as deprecated.</li>
<li>I have renamed the main class file from freetag.class.php to freetag.db.class.php</li>
</ol>
<p>Here is the sample code for use this</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span>php?</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">require_once</span><span class="br0">&#40;</span><span class="st0">&quot;/path-to/freetag.db.class.php&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$DbObj</span> <span class="sy0">=</span> DB<span class="sy0">::</span><span class="me2">connect</span><span class="br0">&#40;</span><span class="re0">$dsn</span><span class="sy0">,</span> <span class="re0">$options</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">//this is the database connection object using PEAR::DB</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$OptionArray</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st_h">&#8216;table_prefix&#8217;</span> <span class="sy0">=&gt;</span> <span class="st_h">&#8216;mytags&#8217;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$TagObj</span> <span class="sy0">=</span> <span class="kw2">new</span> freetag<span class="br0">&#40;</span><span class="re0">$DbObj</span><span class="sy0">,</span> <span class="re0">$OptionArray</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Use this object to call tag related functions .</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy1">?&gt;</span></div>
</li>
</ol>
</div>
</div>
<p>Here is the <a title="freetag.db.class.php" href="http://blog.webconsultingengineering.com/wp-content/uploads/freetag.db_.class.php_.txt" target="_blank"><strong>code</strong></a> modified by me.<br />
If you use this code please let me know if you have any problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.webconsultingengineering.com/phptalk/freetag-peardb.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP serialization or Json</title>
		<link>http://blog.webconsultingengineering.com/phptalk/phpserialize-or-json.html</link>
		<comments>http://blog.webconsultingengineering.com/phptalk/phpserialize-or-json.html#comments</comments>
		<pubDate>Tue, 11 May 2010 11:19:50 +0000</pubDate>
		<dc:creator>Susenjit</dc:creator>
				<category><![CDATA[Php Talk]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[serialization]]></category>

		<guid isPermaLink="false">http://blog.webconsultingengineering.com/?p=80</guid>
		<description><![CDATA[Information storage and retrieval is an important job while designing or developing an application. We all know how to store data with normal data types in database or file systems. Here I am going to discuss about storage and retrieval of data having complex type. Complex type means they are not like normal string or [...]]]></description>
			<content:encoded><![CDATA[<p>Information storage and retrieval is an important job while designing or developing an application. We all know how to store data with normal data types in database or file systems. Here I am going to discuss about storage and retrieval of data having complex type. Complex type means they are not like normal string or number or boolean values. Complex type means data structure or objects.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-2303357471658970";
/* 468x60-cohesiveweb-textad-general */
google_ad_slot = "0998564731";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p>Think of a situation where you are working with some array. Now there may be some situations where you need to store the array and retrieve it back. If you are familiar with OOPS concept then objects are another type which you may need to store and retrieve.</p>
<p>Serialization is the process by which you can convert an object or data structure into a sequence of bits which can stored and retrieve back. Serialization is also known as deflating or marshalling. The opposite process (converting the serialized sequence of bits to object or data structure) is known as Deserialization or inflating or unmarshalling. Most of the important languages have their own implementation of these processes. In Java provides automatic serialization by implementing the <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html">java.io.Serializable</a> interface. In perl there are modules like <a href="http://perldoc.perl.org/Storable.html">Storable</a> or <a href="http://search.cpan.org/dist/FreezeThaw/">FreezeThaw</a>. Python implements serialization through the standard library module <a title="Python pickle" href="http://docs.python.org/library/pickle.html">pickle</a>. In PHP there are two built-in functions as <a title="php serialization function" href="http://php.net/manual/en/function.serialize.php">serialize()</a> and <a title="PHP unserailze function" href="http://www.php.net/manual/en/function.unserialize.php">unserialize()</a> for this purpose. However as I will continue the discussion with PHP then you should be aware of the fact that &#8211; there is a difference in the implementation of serialization in PHP 4.x and PHP 5.x.</p>
<p>In last couple of months I need to work with <a title="JSON" href="http://www.json.org/">JSON</a> (JavaScript Object Notation). JSON is an ideal data interchange format which is language independent. I had used the JSON to design some Ajax driven functionality in one of my projects. Over there I had encoded into JSON some normal and associative PHP array and passed them to access by JavaScript.</p>
<p>After successful completion of the project I started working upon the possibilities of storing data structure or object in PHP using JSON. IN case of PHP there are two function as json_encode() and json_decode(). Interesting thing with json_decode() is that it takes a boolean argument as second parameter[$assoc] which is by default false. But when TRUE json_decode() returns objects converted in associative array. After doing a lot R&amp;D I find out certain facts which favors JSON rather than using serialize() /unserialize(). In general if you consider the size of the stream produced by serialize() with json_encode(), later produces small sized stream. While working with data structure like arrays JSON produces the same structure after encode and decode. So in my opinion usage of JSON is better than PHP serialize()/unserialize().</p>
<p>Now while working with objects, JSON produces the same result as PHP serialization functions. However if the object is complex or if you like to take the benefit of <a href="http://www.php.net/manual/en/language.oop5.magic.php">magic methods</a> object oriented PHP5 then its better to use serialize()/unserialize(). As serialize() will attempt to call _sleep() [if exists] which can be used to do some last minute clean up of the object prior to serialization. Same way unserialize() will call _wakeup()[if exists] which can be used to do some reconstruction in the object just after unserialization. So if your objects are simple then use JSON otherwise go for serialize()/unserialize().</p>
<p>In the conclusion I will prefer to use JSON rather than PHP serialization methods. I won’t be surprised if I get good nos of comments for/against my preference.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.webconsultingengineering.com/phptalk/phpserialize-or-json.html/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>QuickForm and AutoSuggest</title>
		<link>http://blog.webconsultingengineering.com/phptalk/quickform-autosuggest.html</link>
		<comments>http://blog.webconsultingengineering.com/phptalk/quickform-autosuggest.html#comments</comments>
		<pubDate>Tue, 12 Jan 2010 11:23:10 +0000</pubDate>
		<dc:creator>Susenjit</dc:creator>
				<category><![CDATA[Php Talk]]></category>
		<category><![CDATA[autosuggest]]></category>
		<category><![CDATA[dbtable]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[quickform]]></category>

		<guid isPermaLink="false">http://blog.webconsultingengineering.com/?p=70</guid>
		<description><![CDATA[The best example of auttosuggest filed I can instantly think of is Google. While designing dynamic forms I felt the requirement of such field. As I mostly use PEAR class and HTML Quickform to design dynamic forms in php. However in HTML Quickform there is autocomplete type but still there is no support for autosuggest. [...]]]></description>
			<content:encoded><![CDATA[<p>The best example of auttosuggest filed I can instantly think of is <a href="http://google.com" target="_blank">Google</a>. While designing dynamic forms I felt the requirement of such field. As I mostly use <a href="http://pear.php.net/" target="_blank">PEAR</a> class and <a href="http://pear.php.net/package/HTML_QuickForm" target="_blank">HTML Quickform</a> to design dynamic forms in php. However in HTML Quickform there is autocomplete type but still there is no support for autosuggest. I googled a lot to get such support, but found it out in RFC of HTML Quickform. So I started working upon it. My first job was to found out a autosuggest Javascript code suitable for integration. I searched out an autocomplete javascript code by <a href="http://www.beauscott.com" target="_blank">Beau D. Scott</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-2303357471658970";
/* 468x60-cohesiveweb-textad-general */
google_ad_slot = "0998564731";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p>The reasons why I selected Beau’s code is :<br />
The code is simple to use but robust and has good documentation.<br />
It uses standard JS library like prototype and scriptaculous.</p>
<p>Now having previous knowledge of integration of <a title="QuickForm and Jscalender" href="http://blog.webconsultingengineering.com/phptalk/quickform-jscalendar.html">QuickForm and Jscalender</a> I created the code for autosuggest class. This autosuggest class file contains constructor function, toHtml function which generates the HTML code for the field, getFrozenHtml function to return the autosuggest content in HTML and finally the registering process of the autosuggest type with HTML QuickForm. I put this autosuggest class name as autosuggestwce. View this <a title="File - wceautosuggest.php" href="http://blog.webconsultingengineering.com/wp-content/uploads/wceautosuggest.php.txt">wceautosuggest.php</a> file.</p>
<p>To use this autosuggest field in HTML Quickform you need to have 3 javascript files as prototype.js, scriptaculous.js and autocomplete.js. Prototype Javascript is used for javascript framework, Scriptaculous for show and hide effect and AutoComplete is the main javascript functionality file. Among them scriptaculous.js can be removed if you don’t like to show effects, but you need to modify certain section in the wceautosuggest.php file. You also need to declare <strong>$GLOBALS['_HTML_QUICKFORM_AUTOSUGGEST_BASEPATH']</strong> the global path defining variable for the javascript files path in the page where you will generate the form.</p>
<p>This autosuggest uses php script to populate values. The name of the php script has to be mentioned in the $attribute array for the key ‘fileref’.</p>
<p>If you are using DB_Table here is snippet of code</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="st_h">&#8216;user_name&#8217;</span> <span class="sy0">=&gt;</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st_h">&#8216;type&#8217;</span> <span class="sy0">=&gt;</span> <span class="st_h">&#8216;varchar&#8217;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st_h">&#8216;size&#8217;</span> <span class="sy0">=&gt;</span> <span class="nu0">255</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st_h">&#8216;qf_type&#8217;</span> <span class="sy0">=&gt;</span> <span class="st_h">&#8216;autosuggestwce&#8217;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st_h">&#8216;qf_label&#8217;</span><span class="sy0">=&gt;</span> <span class="st_h">&#8216;UserName:&#8217;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st_h">&#8216;require&#8217;</span> <span class="sy0">=&gt;</span> <span class="kw4">false</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st_h">&#8216;qf_attrs&#8217;</span> <span class="sy0">=&gt;</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st_h">&#8216;id&#8217;</span> <span class="sy0">=&gt;</span> <span class="st_h">&#8216;user_name_autosuggest&#8217;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st_h">&#8216;autocomplete&#8217;</span> <span class="sy0">=&gt;</span> <span class="st_h">&#8216;off&#8217;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st_h">&#8216;fileref&#8217;</span> <span class="sy0">=&gt;</span> <span class="st_h">&#8216;getusersname.php&#8217;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#41;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#41;</span><span class="sy0">,</span></div>
</li>
</ol>
</div>
</div>
<p>If you are using QuickForm directly then here is the code snippet</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">$form</span> <span class="sy0">=</span> <span class="kw2">new</span> HTML_QuickForm<span class="br0">&#40;</span><span class="st_h">&#8216;someTest&#8217;</span><span class="sy0">,</span> <span class="st_h">&#8216;get&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$form</span><span class="sy0">-&gt;</span><span class="me1">addElement</span><span class="br0">&#40;</span><span class="st_h">&#8216;autosuggestwce&#8217;</span><span class="sy0">,</span> <span class="st_h">&#8216;username&#8217;</span><span class="sy0">,</span> <span class="st_h">&#8216;UserName:&#8217;</span><span class="sy0">,</span> <span class="st0">&quot;array(&#8216;id&#8217; =&gt; &#8216;user_name_autosuggest&#8217;, &#8216;autocomplete&#8217; =&gt; &#8216;off&#8217;, &#8216;fileref&#8217; =&gt; &#8216;getusersname.php&#8217;)&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$form</span><span class="sy0">-&gt;</span><span class="me1">display</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
</ol>
</div>
</div>
<p>Here is the code segment of php script</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?php</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$UsrObj</span> <span class="sy0">=</span> <span class="kw2">new</span> CLUsrChk<span class="br0">&#40;</span><span class="re0">$DBObj</span><span class="sy0">,</span> <span class="st_h">&#8216;hllqz_tblusers&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$SqlStatement</span> <span class="sy0">=</span> <span class="st0">&quot;SLECT user_name FROM &quot;</span><span class="sy0">.</span><span class="re0">$UsrObj</span><span class="sy0">-&gt;</span><span class="me1">table</span><span class="sy0">.</span><span class="st0">&quot; WHERE user_name LIKE (&#8216;&quot;</span><span class="sy0">.</span><span class="re0">$_GET</span><span class="br0">&#91;</span><span class="st_h">&#8216;s&#8217;</span><span class="br0">&#93;</span><span class="sy0">.</span><span class="st0">&quot;%&#8217;)&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$UsrNameArray</span> <span class="sy0">=</span> <span class="re0">$UsrObj</span><span class="sy0">-&gt;</span><span class="me1">bd</span><span class="sy0">-&gt;</span><span class="me1">query</span><span class="br0">&#40;</span><span class="re0">$SqlStatement</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">echo</span> <a href="http://www.php.net/json_encode"><span class="kw3">json_encode</span></a><span class="br0">&#40;</span><span class="re0">$UsrNameArray</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy1">?&gt;</span></div>
</li>
</ol>
</div>
</div>
<p>Here is the screenshot</p>
<p style="text-align: center;"><img style="border: black 1px solid;" title="autosuggest_field" src="http://blog.webconsultingengineering.com/wp-content/uploads/autosuggest_field.gif" alt="autosuggest_field" width="307" height="104" /><br />
<img class="aligncenter size-full wp-image-73" style="border: black 1px solid;" title="autosuggest_filed_populated" src="http://blog.webconsultingengineering.com/wp-content/uploads/autosuggest_filed_populated.gif" alt="autosuggest_filed_populated" width="304" height="207" />
</p>
<p>However if you require the files for your reference please let me about that.</p>
<p>I was planning to do this post almost a month ago but I was busy with learning another Javascript framework <a title="jQuery" href="http://jquery.com" target="_blank">jQuery</a>. I am started loving it. Hope I will be able to post something about jQuery in near future.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.webconsultingengineering.com/phptalk/quickform-autosuggest.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web site hacked via HTACCESS</title>
		<link>http://blog.webconsultingengineering.com/phptalk/website-hacked.html</link>
		<comments>http://blog.webconsultingengineering.com/phptalk/website-hacked.html#comments</comments>
		<pubDate>Mon, 09 Nov 2009 13:17:01 +0000</pubDate>
		<dc:creator>Susenjit</dc:creator>
				<category><![CDATA[Php Talk]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[site hacked]]></category>
		<category><![CDATA[URL rewriting]]></category>

		<guid isPermaLink="false">http://blog.webconsultingengineering.com/?p=62</guid>
		<description><![CDATA[Here is another example how your site got hacked. I found this instance very recently in Godaddy server. This type of site hacking is not very common. You may not be able to detect any specific web page infected if you search your site using Google Diagonestic tool for safe browsing mentioned in my earlier [...]]]></description>
			<content:encoded><![CDATA[<p>Here is another example how your site got hacked. I found this instance very recently in Godaddy server. This type of site hacking is not very common. You may not be able to detect any specific web page infected if you search your site using Google Diagonestic tool for safe browsing mentioned in my earlier post &#8211; <a title="Iframe code injection" href="http://blog.webconsultingengineering.com/phptalk/iframe-code-injection.html">Iframe code injection</a>. In this kind of attack none of your web pages get infected but your .htaccess file gets modified and becomes the main source of redirection to malware containing site. Let me show you an infected .htaccess file for example. </p>
<div id="attachment_63" class="wp-caption aligncenter" style="width: 514px"><img class="size-full wp-image-63" title="hacked_htaccess" src="http://blog.webconsultingengineering.com/wp-content/uploads/hacked_htaccess.gif" alt="hacked_htaccess" width="504" height="178" /><p class="wp-caption-text">Modified HTACCESS file used for hacking</p></div>
<p>Experienced developer can understand why this is so dangerous. Let me explain a little for the newbies. In case of apache web server configuration directives are described in httpd.conf file. Many cases this file can&#8217;t be accessed or modified due to security reasons. So to change some configuration directives for a specific website or its sub directory best solution is to use .htaccess file. To know further about .htaccess file and its functionality you can read <a title=".HTACCESS file" href="http://httpd.apache.org/docs/1.3/howto/htaccess.html">.htaccess files</a>. However URL rewriting, URL redirection, authentication are the important functionality .htaccess file are used for.</p>
<p><!--adsense--></p>
<p>In the example htaccess file there are 3 sections. First line is for instructing the apache web server to put the rewrite engine on. This is first section. Second section goes from line no. 2 to line no. 8. This section is basically for condition checking on URL. Its checking if the visitors are coming from a website or page with URL containing the following words like google, aol, msn, yahoo, yandex, rambler or ya. <strong>NC</strong> means pattern checking will be case insensitive. <strong>OR</strong> means combines with other rule. Third section is in line no. 9. It says if any of the above pattern checking become true then it will redirect to the specified URL. Here <strong>R</strong> means redirection. Normally this generates HTTP response code 302 means moved temporarily. <strong>L</strong> means this is the last rule.</p>
<p>So the result is that if some visitor coming to the site from above specified search engine, they will be simply redirected to the malware site without understanding whats happening. So be careful if you come to know your site gotta hacked and youre unable to find out why then take a look at your .htaccess file.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.webconsultingengineering.com/phptalk/website-hacked.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The KBM-09</title>
		<link>http://blog.webconsultingengineering.com/off-beat/kbm09.html</link>
		<comments>http://blog.webconsultingengineering.com/off-beat/kbm09.html#comments</comments>
		<pubDate>Mon, 10 Aug 2009 13:39:05 +0000</pubDate>
		<dc:creator>Susenjit</dc:creator>
				<category><![CDATA[Off Beat]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[bloggers meet]]></category>

		<guid isPermaLink="false">http://blog.webconsultingengineering.com/?p=57</guid>
		<description><![CDATA[Hey, if you are thinking that I am going to talk about a application or software, then stop thinking. Its not a sofware/code/appliaction or somthing like that. Its all about a successful event happened last Saturday on 8th August 2009. Its Kolkata Bloggers Meet 2009 organised by Webreps in Cafe Coffee Day, RDB Adlabs Sector [...]]]></description>
			<content:encoded><![CDATA[<p>Hey, if you are thinking that I am going to talk about a application or software, then stop thinking. Its not a sofware/code/appliaction or somthing like that. Its all about a successful event happened last Saturday on 8th August 2009. Its Kolkata Bloggers Meet 2009 organised by <a href="http://www.webreps.in/">Webreps</a> in Cafe Coffee Day, RDB Adlabs Sector V, Saltlake City.<br />
<div id="attachment_58" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.webconsultingengineering.com/wp-content/uploads/kbm1-01.jpg"><img src="http://blog.webconsultingengineering.com/wp-content/uploads/kbm1-01-300x224.jpg" alt="A cozy moment" title="KBM09" width="300" height="224" class="size-full wp-image-58" /></a><p class="wp-caption-text">A cozy moment</p></div></p>
<p>It was a wonderful evening with great atmosphere, good mass of perticipents, also good food and drink. I really enjoyed the evening and actually learnt a lot about blogging. Speeches from <a href="http://www.seoforclients.com/blog/">Aji Issac Mathew</a>, <a href="http://www.rentablogger.com/">Arun Agarwal</a>, Vikas Kedia, <a href="http://www.abhishekrungta.com/">Abhishek Rungta</a> and <a href="http://seo-kolkata.blogspot.com/">Saptarshi Roy Chaudhury</a> were really valuable inputs. Most interesting part was the interaction between bloggers. So many people exchanging ideas, thoughts upon such a topic called blogging. It is really unbelievable. I am damm sure that who ever wasn&#8217;t present over there missed a lot. More over I got chances to meet my old friends and colleagues specially <a href="http://www.iamanand.com/blog/">Anand</a> and Debasish. One thing I must say, I was almost spellbound when I saw <a href="http://pikachuz.net/">Soham&#8217;s</a> presentation.<br />
<div id="attachment_59" class="wp-caption aligncenter" style="width: 386px"><a href="http://blog.webconsultingengineering.com/wp-content/uploads/kbm1-02.jpg"><img src="http://blog.webconsultingengineering.com/wp-content/uploads/kbm1-02.jpg" alt="Our anchor" title="kbm1-02" width="376" height="282" class="size-full wp-image-59" /></a><p class="wp-caption-text">Our anchor</p></div><br />
<div id="attachment_60" class="wp-caption aligncenter" style="width: 377px"><a href="http://blog.webconsultingengineering.com/wp-content/uploads/kbm1-03.jpg"><img src="http://blog.webconsultingengineering.com/wp-content/uploads/kbm1-03.jpg" alt="Friends from Webreps" title="kbm1-03" width="367" height="242" class="size-full wp-image-60" /></a><p class="wp-caption-text">Friends from Webreps</p></div></p>
<p>I don&#8217;t have any dought upon the anchoring capabilities of <a href="http://www.oddseo.com/">Kamanashish</a> aka Mr. Doubt. Also I am very much sure that <a href="http://www.anirudhlohia.com/blog/">Anirudh</a>, <a href="http://webwings.blogspot.com/">Saikat</a>, <a href="http://www.smarthelpinghands.com/blog/">Simul</a> will be able to take the next meet in more bigger level. You guyes simply rocked. I like to thanks all the guyes and gals who were there and made the event successfull. Also thanks to <a href="http://www.cafecoffeeday.com/">Cafe Coffee Day</a> for creating such a cozy atmosphere.</p>
<p>The pictures taken by my <a href="http://www.nokia.co.in/find-products/products/nokia-e51">Nokia E51</a> are not so good, you should visit <a href="http://www.ygoel.com/2009/08/kolkata-bloggers-meet-2009-my-2nd.html">Yogesh&#8217;s post</a> for wonderfull pictures of Kolkata Bloggers Meet.</p>
<p>The meet gave a tremendous effect on me as a blogger (back banchers is approtiate for me). Surprisingly I am able to make this within few hours <img src='http://blog.webconsultingengineering.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' />  . I will surely going to spend more time for my blog and &#8230; wait and watch.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.webconsultingengineering.com/off-beat/kbm09.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Iframe code injection</title>
		<link>http://blog.webconsultingengineering.com/phptalk/iframe-code-injection.html</link>
		<comments>http://blog.webconsultingengineering.com/phptalk/iframe-code-injection.html#comments</comments>
		<pubDate>Thu, 30 Jul 2009 11:33:53 +0000</pubDate>
		<dc:creator>Susenjit</dc:creator>
				<category><![CDATA[Php Talk]]></category>
		<category><![CDATA[antivirus]]></category>
		<category><![CDATA[badware]]></category>
		<category><![CDATA[code injection]]></category>
		<category><![CDATA[Google warning]]></category>
		<category><![CDATA[hidden iframe]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Iframe]]></category>

		<guid isPermaLink="false">http://blog.webconsultingengineering.com/?p=50</guid>
		<description><![CDATA[After a long days I am back for blog post. Last one month I was very much irritated with the problem occurred in some of my client website. In a Sunday morning while I was sleeping one of my client ranged me and asked me to check her website as she got a mail from [...]]]></description>
			<content:encoded><![CDATA[<p>After a long days I am back for blog post. Last one month I was very much irritated with the problem occurred in some of my client website. In a Sunday morning while I was sleeping one of my client ranged me and asked me to check her website as she got a mail from google that her website is spreading malware. I got confused as I had never faced this kind of problem. I started checking the website. But the antivirus in my Laptop didn&#8217;t allowed me to open the site at all. Then I decided to go to my office to check the situation.<br />
<!--adsense--><br />
In my office I checked the site thoroughly(OMG, I was able to open the site in my office). I found iframe code with hidden visibility was inserted in some pages. To be more specific index pages. I checked all the index pages in office PC, deleted the infected pages in the server and uploaded the pages from PC. Checked, cleaned all the html, php, temporary files. Almost near about afternoon I was back to my home while thinking how this happened.<br />
<div id="attachment_53" class="wp-caption aligncenter" style="width: 360px"><a href="http://blog.webconsultingengineering.com/wp-content/uploads/iframe_injected.gif"><img src="http://blog.webconsultingengineering.com/wp-content/uploads/iframe_injected.gif" alt="Iframe Injected" title="iframe_injected" width="350" height="256" class="size-full wp-image-53" /></a><p class="wp-caption-text">Iframe Injected</p></div></p>
<p>Next Morning after arriving in the office I started checking the website and I found it was again infected by the hidden iframe. Site url was different as earler it was .cn and next day it was .ru I was upset about how to fix the things. Believe me or not in the last one month this site got infected 27 times. Our team had experienced the same attack for 5 more site. It was a horrible experience for us. </p>
<p>We had done lot of googleing to find out the preventive measurement. We found out lots of information regarding this. Some of them are good and some of them are misleading too. So here I like to point out some effective ones only.</p>
<ol>
<li>You should have good antivirus installed in your system from where you access web. I am using <a href="http://www.avast.com">avast</a> free edition and it works fine for me.</li>
<li>Please check your websites on a regular basis. If you see if any web page with a blank section in the top them be almost sure that it is infected. Your antivirus should give you warning.</li>
<li>If you find any of your website get infected then start following the next steps.</li>
<li>First of all scan your machine with the antivirus. A boot time scan is more preferable.</li>
<li>Replace all the pages in the website using a local copy from your system. If the web site is too big to repalce then try to repalce all the pages with name index. Then check the site again.</li>
<li>Once the site is cleaned change the ftp details for the site and if possible do the same for the other sites whose details are kept in your ftp application.</li>
<li>Keep checking the site in a short span of interval.</li>
</ol>
<p>You should also check your site in google too. If google find out some problem with your site they may have shown a warning message like &#8220;This site may harm your computer&#8221;. Another way to check your site is </p>
<p>http://www.google.com/safebrowsing/diagnostic?site=http://www.yourdomain.tld</p>
<p>If you find that google is showing the warning message for your site you can request Google for a recheck via <a href="https://www.google.com/webmasters/tools/">Google Webmaster Tool</a>. But you should check the site twice after cleaning and then request for review.</p>
<p>However I have designed a code in php for checking mainly the index pages in the website. Here is the code.</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?php</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// page-checker.php</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$path</span> <span class="sy0">=</span> <span class="st0">&quot;.&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$baseDir</span> <span class="sy0">=</span> <a href="http://www.php.net/basename"><span class="kw3">basename</span></a><span class="br0">&#40;</span><a href="http://www.php.net/dirname"><span class="kw3">dirname</span></a><span class="br0">&#40;</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st_h">&#8216;PHP_SELF&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$WebPath</span> <span class="sy0">=</span> <span class="st_h">&#8216;http://&#8217;</span><span class="sy0">.</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st_h">&#8216;HTTP_HOST&#8217;</span><span class="br0">&#93;</span><span class="sy0">.</span><span class="st_h">&#8216;/&#8217;</span><span class="sy0">.</span><span class="re0">$baseDir</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$content_pattern</span> <span class="sy0">=</span> <span class="st0">&quot;iframe&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">echo</span> <span class="st0">&quot;Checking files for IFRAME Infection&lt;br/&gt;&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$dir_handle</span> <span class="sy0">=</span> <span class="sy0">@</span><a href="http://www.php.net/opendir"><span class="kw3">opendir</span></a><span class="br0">&#40;</span><span class="re0">$path</span><span class="br0">&#41;</span> or <a href="http://www.php.net/die"><span class="kw3">die</span></a><span class="br0">&#40;</span><span class="st0">&quot;Unable to open <span class="es4">$path</span>&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">echo</span> <span class="st0">&quot;Directory Structure of <span class="es4">$WebPath</span>&lt;br/&gt;&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">navigate<span class="br0">&#40;</span><span class="re0">$dir_handle</span><span class="sy0">,</span> <span class="re0">$path</span><span class="sy0">,</span> <span class="st_h">&#8221;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">function</span> navigate<span class="br0">&#40;</span><span class="re0">$dir_handle</span><span class="sy0">,</span><span class="re0">$path</span><span class="sy0">,</span> <span class="re0">$WebPth</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">global</span> <span class="re0">$WebPath</span><span class="sy0">,</span> <span class="re0">$content_pattern</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">echo</span> <span class="st0">&quot;&lt;ul&gt;&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">while</span> <span class="br0">&#40;</span><span class="kw4">false</span> <span class="sy0">!==</span> <span class="br0">&#40;</span><span class="re0">$file</span> <span class="sy0">=</span> <a href="http://www.php.net/readdir"><span class="kw3">readdir</span></a><span class="br0">&#40;</span><span class="re0">$dir_handle</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="re0">$dir</span> <span class="sy0">=</span> <span class="re0">$path</span><span class="sy0">.</span><span class="st_h">&#8216;/&#8217;</span><span class="sy0">.</span><span class="re0">$file</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/is_dir"><span class="kw3">is_dir</span></a><span class="br0">&#40;</span><span class="re0">$dir</span><span class="br0">&#41;</span> <span class="sy0">&amp;</span>amp<span class="sy0">;&amp;</span>amp<span class="sy0">;</span> <span class="re0">$file</span> <span class="sy0">!=</span> <span class="st_h">&#8216;.&#8217;</span> <span class="sy0">&amp;&amp;</span> <span class="re0">$file</span> <span class="sy0">!=</span><span class="st_h">&#8216;..&#8217;</span> <span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">$handle</span> <span class="sy0">=</span> <span class="sy0">@</span><a href="http://www.php.net/opendir"><span class="kw3">opendir</span></a><span class="br0">&#40;</span><span class="re0">$dir</span><span class="br0">&#41;</span> or <a href="http://www.php.net/die"><span class="kw3">die</span></a><span class="br0">&#40;</span><span class="st0">&quot;undable to open file <span class="es4">$file</span>&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">$WebRef</span> <span class="sy0">=</span> <span class="re0">$file</span><span class="sy0">.</span><span class="st_h">&#8216;/&#8217;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;navigate<span class="br0">&#40;</span><span class="re0">$handle</span><span class="sy0">,</span> <span class="re0">$dir</span><span class="sy0">,</span> <span class="re0">$WebRef</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">elseif</span><span class="br0">&#40;</span><span class="re0">$file</span> <span class="sy0">!=</span> <span class="st_h">&#8216;.&#8217;</span> <span class="sy0">&amp;</span>amp<span class="sy0">;&amp;</span>amp<span class="sy0">;</span> <span class="re0">$file</span> <span class="sy0">!=</span><span class="st_h">&#8216;..&#8217;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/preg_match"><span class="kw3">preg_match</span></a><span class="br0">&#40;</span><span class="st_h">&#8216;/^index+/&#8217;</span><span class="sy0">,</span><span class="re0">$file</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$ChcekFlag</span> <span class="sy0">=</span> <span class="kw4">FALSE</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">echo</span> <span class="st0">&quot;&lt;li&gt;&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">echo</span> <span class="st0">&quot;&lt;a href=&#8217;&quot;</span><span class="sy0">.</span><span class="re0">$WebPath</span><span class="sy0">.</span><span class="re0">$WebPth</span><span class="sy0">.</span><span class="re0">$file</span><span class="sy0">.</span><span class="st0">&quot;&#8217;&gt;&quot;</span><span class="sy0">.</span><span class="re0">$WebPth</span><span class="sy0">.</span><span class="re0">$file</span><span class="sy0">.</span><span class="st0">&quot;&lt;/a&gt;&lt;br /&gt;&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$handle</span> <span class="sy0">=</span> <span class="sy0">@</span><a href="http://www.php.net/fopen"><span class="kw3">fopen</span></a><span class="br0">&#40;</span><span class="re0">$dir</span><span class="sy0">,</span> <span class="st0">&quot;r&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$handle</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">while</span> <span class="br0">&#40;</span><span class="sy0">!</span><a href="http://www.php.net/feof"><span class="kw3">feof</span></a><span class="br0">&#40;</span><span class="re0">$handle</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$content</span> <span class="sy0">=</span> <a href="http://www.php.net/fgets"><span class="kw3">fgets</span></a><span class="br0">&#40;</span><span class="re0">$handle</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/stristr"><span class="kw3">stristr</span></a><span class="br0">&#40;</span><span class="re0">$content</span><span class="sy0">,</span> <span class="re0">$content_pattern</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">$test</span> <span class="sy0">=</span> <a href="http://www.php.net/stristr"><span class="kw3">stristr</span></a><span class="br0">&#40;</span><span class="re0">$content</span><span class="sy0">,</span> <span class="re0">$content_pattern</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">echo</span> <span class="re0">$test</span><span class="sy0">.</span><span class="st0">&quot;&lt;br /&gt;&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">$ChcekFlag</span> <span class="sy0">=</span> <span class="kw4">TRUE</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/fclose"><span class="kw3">fclose</span></a><span class="br0">&#40;</span><span class="re0">$handle</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$ChcekFlag</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">echo</span> <span class="st0">&quot;&lt;font color=&#8217;red&#8217;&gt;Infected&lt;/font&gt;&lt;br /&gt;&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">echo</span> <span class="st0">&quot;&lt;font color=&#8217;green&#8217;&gt;Clean&lt;/font&gt;&lt;br /&gt;&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">echo</span> <span class="st0">&quot;&lt;/li&gt;&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">echo</span> <span class="st0">&quot;&lt;/ul&gt;&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy1">?&gt;</span></div>
</li>
</ol>
</div>
</div>
<p>you can put this code in the root level of your website (in www or public_html or httpdocs). Browsing this page will show all the index pages with status of it. </p>
<p>Current I am working upon extending the code so that it can clean the infected pages automatically. Hopefully I will post it within few days.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.webconsultingengineering.com/phptalk/iframe-code-injection.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Tricky Sql Statements</title>
		<link>http://blog.webconsultingengineering.com/development/tricky-sql-statements.html</link>
		<comments>http://blog.webconsultingengineering.com/development/tricky-sql-statements.html#comments</comments>
		<pubDate>Thu, 30 Apr 2009 13:21:27 +0000</pubDate>
		<dc:creator>Susenjit</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[group by clause]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[select distinct]]></category>
		<category><![CDATA[sql replace function]]></category>
		<category><![CDATA[sql statement]]></category>
		<category><![CDATA[update statement]]></category>

		<guid isPermaLink="false">http://blog.webconsultingengineering.com/?p=48</guid>
		<description><![CDATA[Here are some tricky Sql statements that can be used in some specific cases. I figured them out in certain cases where I needed to do data manipulation directly on the database instead of writing script to accomplish them. I will describe them in case study style. Case 1: In one of my project there [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some tricky Sql statements that can be used in some specific cases. I figured them out in certain cases where I needed to do data manipulation directly on the database instead of writing script to accomplish them. I will describe them in case study style.</p>
<p><strong>Case 1:</strong></p>
<p>In one of my project there is a user table containing fields like userId, UserName, UserLoginID, Password etc. The UserLoginID field is basically the email address. Almost 95% of the email addresses belongs to a specific domain that is the domain of the project. Let&#8217;s say testproject.com.  The table contains approx 12,000 records. In that project client decided to shift their main tld from .com to .org like testproject.com to testproject.org. Now they asked me to change the all the users&#8217; email from .com to .org. That means user1@testproject.com to user1@testproject.org I needed to do this job within a shortest span of time. So I decided to run a sql command directly in the database to do the modification. A simple UPDATE sql won&#8217;t work in that situation as I needed to change some part of a field and also update statement shouldn’t affect those rows which do not contain testproject.com. So I tried with different types of update sql to do the job but finally derived the following one :-</p>
<div class="codesnip-container" >
<div class="sql codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">UPDATE</span> tblUser <span class="kw1">SET</span> UserLoginID <span class="sy0">=</span> <span class="kw1">REPLACE</span><span class="br0">&#40;</span>UserLoginID<span class="sy0">,</span> <span class="st0">&#8216; testproject.org&#8217;</span><span class="sy0">,</span> <span class="st0">&#8216; testproject.com&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
</div>
<p>The beauty of this statement lies in the usage of replace function. This replace function will synchronously select records having &#8216;testproject.com&#8217; implementing functionality of the Where clause and generate the value to be set for the field UserLoginID as <somename>@testproject.org</p>
<p><strong>Case 2:</strong></p>
<p>This case was relatively easy. I need to find out unique entries from a table. It was not a hard job for me but still I googled a bit for this purpose. Now after some study I come to a position where I could do that using two different sql statements. They are :-</p>
<div class="codesnip-container" >
<div class="sql codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">SELECT</span> product_code <span class="kw1">FROM</span> tblproductdetails <span class="kw1">GROUP</span> <span class="kw1">BY</span> product_code;</div>
</li>
</ol>
</div>
</div>
<p>and</p>
<div class="codesnip-container" >
<div class="sql codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">SELECT</span> <span class="kw1">DISTINCT</span> product_code <span class="kw1">FROM</span> tblproductdetails;</div>
</li>
</ol>
</div>
</div>
<p>While looking at the results I found both of them produces same result but the only differnce is Select DISTINCT does not sort the result set like GROUP BY does. So I wasn&#8217;t sure which one should used. <a href="http://groups.google.com/group/udbug/browse_thread/thread/9d660cbbd91a7d63" target="_blank">SELECT DISTINCT vs GROUP BY &#8211;   udbug |  Google Groups</a> helped me to chose the correct statement as Select DISTINCT. So I used the following :-</p>
<div class="codesnip-container" >
<div class="sql codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">SELECT</span> <span class="kw1">DISTINCT</span> product_code <span class="kw1">FROM</span> tblproductdetails <span class="kw1">ORDER</span> <span class="kw1">BY</span> product_code</div>
</li>
</ol>
</div>
</div>
<p><strong>Case 3:</strong></p>
<p>This is also related with the earlier case of unique entries. This time I need to find out the ids which have duplicate entries. Almost the opposite job than the previous one. Well this statement also uses distinct but along with Group by clause gives the entries which have duplicates in the table. Here is the statement.</p>
<div class="codesnip-container" >
<div class="sql codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">SELECT</span> <span class="kw1">DISTINCT</span> regn_id <span class="kw1">FROM</span> tblstudentdetails <span class="kw1">GROUP</span> <span class="kw1">BY</span> regn_id <span class="kw1">HAVING</span> count<span class="br0">&#40;</span>regn_id<span class="br0">&#41;</span> <span class="sy0">&gt;</span> <span class="nu0">1</span>;</div>
</li>
</ol>
</div>
</div>
<p>This statement is very useful to find out entries which have duplicates in the tables.</p>
<p>Somebody asked me earlier how do I learn php and database? My answer was  &#8211; learn the basic, find some real-life project to work for, take the challenge to complete it. You would face lots and lots problem while doing that. Don&#8217;t try to get rid of them but try to solve them. When you would finish the job you will understand the difference in you in terms of practical knowledge. I hope you all agree with me. <img src='http://blog.webconsultingengineering.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.webconsultingengineering.com/development/tricky-sql-statements.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Picasa web album slideshow – Development guide</title>
		<link>http://blog.webconsultingengineering.com/phptalk/picasa-web-album-slideshow.html</link>
		<comments>http://blog.webconsultingengineering.com/phptalk/picasa-web-album-slideshow.html#comments</comments>
		<pubDate>Tue, 31 Mar 2009 13:28:54 +0000</pubDate>
		<dc:creator>Susenjit</dc:creator>
				<category><![CDATA[Php Talk]]></category>
		<category><![CDATA[album slideshow]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[picasa]]></category>
		<category><![CDATA[picasa slideshow]]></category>
		<category><![CDATA[picasaweb]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[RSS Feed]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://blog.webconsultingengineering.com/?p=44</guid>
		<description><![CDATA[I was looking for a application to embed slideshow using pictures from picase web album. I found some plugins which can be used in blog or myspace. Some of them uses the picasa slide show url opened in a iframe or div. Then you will have less control on the slideshow as it is controlled [...]]]></description>
			<content:encoded><![CDATA[<p>I was looking for a application to embed slideshow using pictures from <a title="picasa web" href="http://picasa.google.com/">picase web album</a>. I found some plugins which can be used in blog or myspace. Some of them uses the picasa slide show url opened in a iframe or div. Then you will have less control on the slideshow as it is controlled by the slideshow application of picasa. But I required more control on the images from picasa.</p>
<p>I was looking for some application which will fetch/store all the images for an album in picasa and create a slideshow with more control on the images. I found nothing thats suites my requirement. So I started to design an application of such kind. On the basis of functionality I sub devided it into two major part. First is fetch the image related information for an album and store it if required. Second is display the slideshow using those image information.</p>
<p>In picasa you can view the pictures as set or individual but you won&#8217;t get actual picture name or its location. So I found now simple way to get the pictures name and their location. While searching more for such option I found there is a RSS feed for each album. The RSS feed provides image names and its location details. It makes my job easier. Now objective became to process the RSS feed to get the image related information. For this purpose I used XML-RSS package from <a href="http://pear.php.net">PEAR</a>. Here is snapshot of the code I wrote to process the feed:</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?php</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">require_once</span> <span class="st0">&quot;XML/RSS.php&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//$FeedURL is the URL of the rss feed of an album in picasa</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$FeedURL</span> <span class="sy0">=</span> <span class="st0">&quot;http://picasaweb.google.com/data/feed/base/user/wce/albumid/5331321673727336541?alt=rss&amp;kind=photo&amp;hl=en_GB&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$rss</span> <span class="sy0">=&amp;</span> <span class="kw2">new</span> XML_RSS<span class="br0">&#40;</span><span class="re0">$FeedURL</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$rss</span><span class="sy0">-&gt;</span><span class="me1">parse</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$rssArray</span> <span class="sy0">=</span> <span class="re0">$rss</span><span class="sy0">-&gt;</span><span class="me1">getStructure</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$PicasaDataArray</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$InfoArray</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">for</span><span class="br0">&#40;</span><span class="re0">$C</span><span class="sy0">=</span><span class="nu0">0</span><span class="sy0">;</span> <span class="re0">$C</span><span class="sy0">&lt;</span>count<span class="br0">&#40;</span><span class="re0">$rssArray</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="re0">$C</span><span class="sy0">++</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$rssArray</span><span class="br0">&#91;</span><span class="re0">$C</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;type&#8217;</span><span class="br0">&#93;</span> <span class="sy0">==</span> <span class="st_h">&#8216;item&#8217;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="re0">$PicasaDataArray</span><span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;title&#8217;</span> <span class="sy0">=&gt;</span> <span class="re0">$rssArray</span><span class="br0">&#91;</span><span class="re0">$C</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;title&#8217;</span><span class="br0">&#93;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;image&#8217;</span> <span class="sy0">=&gt;</span> <span class="re0">$rssArray</span><span class="br0">&#91;</span><span class="re0">$C</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;enclosures&#8217;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;url&#8217;</span><span class="br0">&#93;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;link&#8217;</span> <span class="sy0">=&gt;</span> <span class="re0">$rssArray</span><span class="br0">&#91;</span><span class="re0">$C</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;link&#8217;</span><span class="br0">&#93;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;description&#8217;</span> <span class="sy0">=&gt;</span> <span class="re0">$rssArray</span><span class="br0">&#91;</span><span class="re0">$C</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;description&#8217;</span><span class="br0">&#93;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">elseif</span><span class="br0">&#40;</span><span class="re0">$rssArray</span><span class="br0">&#91;</span><span class="re0">$C</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;type&#8217;</span><span class="br0">&#93;</span> <span class="sy0">==</span> <span class="st_h">&#8216;image&#8217;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="re0">$AlbumTitle</span> <span class="sy0">=</span> &nbsp;<span class="re0">$rssArray</span><span class="br0">&#91;</span><span class="re0">$C</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;title&#8217;</span><span class="br0">&#93;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="re0">$AlbumPicture</span> <span class="sy0">=</span> &nbsp;<span class="re0">$rssArray</span><span class="br0">&#91;</span><span class="re0">$C</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;url&#8217;</span><span class="br0">&#93;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="re0">$CreateDate</span> <span class="sy0">=</span> &nbsp;<span class="re0">$MetaInfo</span><span class="br0">&#91;</span><span class="st_h">&#8216;lastbuilddate&#8217;</span><span class="br0">&#93;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// this $PicasaDataArray contains all the picture related information of an album from picasa web.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy1">?&gt;</span></div>
</li>
</ol>
</div>
</div>
<p>Now this $PicasaDataArray can be stored in files/database or can be directly used for the slideshow. While processing the feed by this I found the feed contain other information like title, description, link of the album, its last build date etc. So I modified the code a little more to store these information too. So the first part of my application is complete.</p>
<p>Now the second part &#8211; slideshow using $PicasaDataArray. For this section I didn&#8217;t tried to put my head to develop slide show application as I had already seen some very nice attractive slideshow application. They are also easy to use and configure. One of my favourite is <a href="http://www.lokeshdhakar.com/projects/lightbox2/">Lightbox JS</a>. Another good slideshow script is <a href="http://highslide.com/">Highslide</a>. Both of them are very nice and easy to configure. So I used one of them for my purpose. Here is another snapshot of code</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?php</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">require_once</span> <span class="st0">&quot;XML/RSS.php&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//$FeedURL is the URL of the rss feed of an album in picasa</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$FeedURL</span> <span class="sy0">=</span> <span class="st0">&quot;http://picasaweb.google.com/data/feed/base/user/wce/albumid/5331321673727336541?alt=rss&amp;kind=photo&amp;hl=en_GB&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$rss</span> <span class="sy0">=&amp;</span> <span class="kw2">new</span> XML_RSS<span class="br0">&#40;</span><span class="re0">$FeedURL</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$rss</span><span class="sy0">-&gt;</span><span class="me1">parse</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$rssArray</span> <span class="sy0">=</span> <span class="re0">$rss</span><span class="sy0">-&gt;</span><span class="me1">getStructure</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$PicasaDataArray</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$InfoArray</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">for</span><span class="br0">&#40;</span><span class="re0">$C</span><span class="sy0">=</span><span class="nu0">0</span><span class="sy0">;</span> <span class="re0">$C</span><span class="sy0">&lt;</span>count<span class="br0">&#40;</span><span class="re0">$rssArray</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="re0">$C</span><span class="sy0">++</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$rssArray</span><span class="br0">&#91;</span><span class="re0">$C</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;type&#8217;</span><span class="br0">&#93;</span> <span class="sy0">==</span> <span class="st_h">&#8216;item&#8217;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="re0">$PicasaDataArray</span><span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;title&#8217;</span> <span class="sy0">=&gt;</span> <span class="re0">$rssArray</span><span class="br0">&#91;</span><span class="re0">$C</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;title&#8217;</span><span class="br0">&#93;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;image&#8217;</span> <span class="sy0">=&gt;</span> <span class="re0">$rssArray</span><span class="br0">&#91;</span><span class="re0">$C</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;enclosures&#8217;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;url&#8217;</span><span class="br0">&#93;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;link&#8217;</span> <span class="sy0">=&gt;</span> <span class="re0">$rssArray</span><span class="br0">&#91;</span><span class="re0">$C</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;link&#8217;</span><span class="br0">&#93;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">&#8216;description&#8217;</span> <span class="sy0">=&gt;</span> <span class="re0">$rssArray</span><span class="br0">&#91;</span><span class="re0">$C</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;description&#8217;</span><span class="br0">&#93;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">elseif</span><span class="br0">&#40;</span><span class="re0">$rssArray</span><span class="br0">&#91;</span><span class="re0">$C</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;type&#8217;</span><span class="br0">&#93;</span> <span class="sy0">==</span> <span class="st_h">&#8216;image&#8217;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="re0">$AlbumTitle</span> <span class="sy0">=</span> &nbsp;<span class="re0">$rssArray</span><span class="br0">&#91;</span><span class="re0">$C</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;title&#8217;</span><span class="br0">&#93;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="re0">$AlbumPicture</span> <span class="sy0">=</span> &nbsp;<span class="re0">$rssArray</span><span class="br0">&#91;</span><span class="re0">$C</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">&#8216;url&#8217;</span><span class="br0">&#93;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="re0">$CreateDate</span> <span class="sy0">=</span> &nbsp;<span class="re0">$MetaInfo</span><span class="br0">&#91;</span><span class="st_h">&#8216;lastbuilddate&#8217;</span><span class="br0">&#93;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy1">?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&lt;html&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;head&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;title&gt;Slide Show :: <span class="kw2">&lt;?php</span> <span class="kw1">echo</span> &nbsp;<span class="re0">$AlbumTitle</span><span class="sy0">;</span><span class="sy1">?&gt;</span>&lt;/title&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;script type=&quot;text/javascript&quot; src=&quot;js/prototype.js&quot;&gt;&lt;/script&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;script type=&quot;text/javascript&quot; src=&quot;js/scriptaculous.js?load=effects,builder&quot;&gt;&lt;/script&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;script type=&quot;text/javascript&quot; src=&quot;js/lightbox.js&quot;&gt;&lt;/script&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;link rel=&quot;stylesheet&quot; href=&quot;css/lightbox.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;/head&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;body&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;a href=&quot;<span class="kw2">&lt;?php</span> <span class="kw1">echo</span> &nbsp;<span class="re0">$AlbumPicture</span><span class="sy0">;</span><span class="sy1">?&gt;</span>&quot; rel=&quot;lightbox[picasa]&quot;&gt;&lt;img src=&quot;<span class="kw2">&lt;?php</span> <span class="kw1">echo</span> &nbsp;<span class="re0">$AlbumPicture</span><span class="sy0">;</span><span class="sy1">?&gt;</span>&quot; /&gt;&lt;/a&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;div style=&quot;display:box;&quot;&gt;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?php</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">foreach</span><span class="br0">&#40;</span><span class="re0">$PicasaDataArray</span> <span class="kw1">as</span> <span class="re0">$ImageInfo</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">echo</span> <span class="st_h">&#8216;&lt;a href=&quot;&#8217;</span><span class="sy0">.</span><span class="re0">$ImageInfo</span><span class="br0">&#91;</span><span class="st_h">&#8216;image&#8217;</span><span class="br0">&#93;</span><span class="sy0">.</span><span class="st_h">&#8216;&quot;&#8217;</span> rel<span class="sy0">=</span><span class="st0">&quot;lightbox[picasa]&quot;</span><span class="sy0">&gt;</span><span class="st_h">&#8216;.$ImageInfo['</span>title<span class="st_h">'].&#8217;</span><span class="sy0">&lt;/</span>a<span class="sy0">&gt;&lt;</span>br<span class="sy0">&gt;</span> <span class="st_h">&#8216;;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="st_h">}</span></div>
</li>
<li class="li1">
<div class="de1"><span class="st_h">?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&lt;/div&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;/body&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;/html&gt;</div>
</li>
</ol>
</div>
</div>
<p>I made this  code simple and easy to use. Though I have used xml-rss class from pear but it can be repalced by and standard xml-rss parser class. Experienced developer can modify this code or enhance its feature much more as per their requirement. If like to use this code or if you have any suggestion let me know about it via your comment. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.webconsultingengineering.com/phptalk/picasa-web-album-slideshow.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
