<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ABCoder &#187; PHP</title>
	<atom:link href="http://abcoder.com/topics/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://abcoder.com</link>
	<description>ABCoder - Coding is Simple as A b c</description>
	<lastBuildDate>Sat, 17 Jul 2010 11:45:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>CakePHP Advanced Pagination &#8211; sort by derived field</title>
		<link>http://abcoder.com/php/cakephp/cakephp-advanced-pagination-sort-by-derived-field/</link>
		<comments>http://abcoder.com/php/cakephp/cakephp-advanced-pagination-sort-by-derived-field/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 09:23:41 +0000</pubDate>
		<dc:creator>adnan</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[advance]]></category>
		<category><![CDATA[built-in]]></category>
		<category><![CDATA[cake]]></category>
		<category><![CDATA[cake way]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[pass]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[solve]]></category>
		<category><![CDATA[solved]]></category>

		<guid isPermaLink="false">http://abcoder.com/?p=446</guid>
		<description><![CDATA[By default CakePHP's pagination method does not support sort by derived field. But with a very simple and easy fix you can get it working in the cake way! No need of extra new pagination component, just modify the pagination function from the model...


Related posts:<ol><li><a href='http://abcoder.com/php/cakephp/having-clause-in-cakephp-find-query/' rel='bookmark' title='Permanent Link: HAVING clause in CakePHP find query'>HAVING clause in CakePHP find query</a> <small>Is there any way to use HAVING clause in cakephp find() function parameters? I'm not sure, but I did it somehow and it works perfect!...</small></li>
<li><a href='http://abcoder.com/php/simplify-your-query-easily/' rel='bookmark' title='Permanent Link: Simplify your query easily'>Simplify your query easily</a> <small>Simplify your long insert and update mysql queries using this simple php function. Just keep the input fields name same as the field names of database table and this function will automatically generate the insert or update query. It is so simple to use. Download the code completely free....</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This is my second post on cake. Yesterday I was trying to implement pagination on my cakephp application and got frustrated as it can&#8217;t(?) sort by derived fields like SUM(), AVG(). I ransacked for the solution and got many alternate ways. Here is one from Andy Dawson: <a href="http://bakery.cakephp.org/articles/view/pagination" target="_blank">http://bakery.cakephp.org/articles/view/pagination</a>. He has done a great job. But I wanted to do it by the core pagination method and didn&#8217;t feel interested to add a new component as cake has already provided with this feature.</p>
<p>Here comes struggling &#8211; I spent a couple of hours to find out a way&#8230; and finally got it! yes it is possible to sort by derived fields using the built-in pagination feature of cakephp! Let&#8217;s talk about the solution a little later, first I&#8217;d like to introduce you with the exact problem I faced.</p>
<p>I was trying to show the list of products in a tabular format with product name and lowest price. The product title is from products table (Product model) and the lowestprice is the MIN of price field from products_of_merchants table(ProductsOfMerchant model). Each Product belongsTo a certain SubCategory and hasMany ProductsOfMerchant selling them on different price(s).</p>
<h3>Controller code segment</h3>
<pre class="brush: php; highlight: [6,8];">$this-&gt;paginate = array(
	'conditions' =&gt; array('Product.sub_category_id' =&gt; $subcategory['SubCategory']['id']),
	'fields' =&gt; array(
		'Product.id',
		'Product.title',
		'MIN(ProductsOfMerchant.price) AS lowestprice'
	),
	'order' =&gt; array('lowestprice' =&gt; 'asc'),
	'limit' =&gt; 10,
	'group' =&gt; 'Product.id'
);
$products = $this-&gt;paginate('Product');
$this-&gt;set(compact('products'));</pre>
<p>It works fine for the first time as default order by lowestprice asc. In the view, I wanted to sort the lowestprice (derived field) column interactively asc/desc.</p>
<h3>View code segment</h3>
<pre class="brush: php;">&lt;?php echo $paginator-&gt;sort('Lowest Price', 'lowestprice'); ?&gt;</pre>
<p>Also tried with</p>
<pre class="brush: php;">&lt;?php echo $paginator-&gt;sort('Lowest Price', 'ProductsOfMerchant.lowestprice'); ?&gt;</pre>
<p>I clicked the &#8216;Lowest Price&#8217; link to sort by desc, no luck! cos it&#8217;s a derived field and in debug mode there is no &#8220;ORDER BY&#8221; clause at the end of the query. I found a lot of ppl looking for the solution of this same issue and here is the solve (+backstage scenes) I&#8217;m gonna share with you.</p>
<p>From the cake book I found this <a href="http://book.cakephp.org/view/249/Custom-Query-Pagination" target="_blank">Custom Query Pagination</a>.<br />
First I added this function in the Product model for debugging.</p>
<h3>Product Model code segment</h3>
<pre class="brush: php; highlight: [2];">function paginate($conditions, $fields, $order, $limit, $page = 1, $recursive = null, $extra = array()) {
	print_r(func_get_args()); // for debugging
	$group = $extra['group'];
	return $this-&gt;find('all', compact('conditions', 'fields', 'order', 'limit', 'page', 'recursive', 'group'));
}</pre>
<p>Here is the output when I tried to sort by &#8216;lowestprice&#8217; desc by clicking the &#8216;Lowest Price&#8217; column header link:</p>
<pre class="brush: plain; highlight: [15,16,17];">Array
(
    [0] =&gt; Array
        (
            [Product.sub_category_id] =&gt; 5
        )

    [1] =&gt; Array
        (
            [0] =&gt; Product.id
            [1] =&gt; Product.title
            [2] =&gt; MIN(ProductsOfMerchant.price) AS lowestprice
        )

    [2] =&gt; Array
        (
        )

    [3] =&gt; 10
    [4] =&gt; 1
    [5] =&gt; 1
    [6] =&gt; Array
        (
            [group] =&gt; Product.id
        )
)</pre>
<p>You can see when you try to sort by a derived field the order by array (array key=2) is empty. This is definitely a bug of the pagination method, but for now we need a patch/fix to get it work and you know it&#8217;s never a good idea to modify the core of any framework. The interesting part of the paginate function is it takes an $extra argument which contains an array with &#8216;group&#8217; key. I added a dummy key-value array to the $paginate array in the controller and wow! it&#8217;s automagically appended with the $extra argument of the paginate function in the model. Now all I need is to pass the sort key somehow via the $extra array. This is exactly what I did:</p>
<h3>Controller code segment</h3>
<pre class="brush: php; highlight: [11];">$this-&gt;paginate = array(
	'conditions' =&gt; array('Product.sub_category_id' =&gt; $subcategory['SubCategory']['id']),
	'fields' =&gt; array(
		'Product.id',
		'Product.title',
		'MIN(ProductsOfMerchant.price) AS lowestprice'
	),
	'order' =&gt; array('lowestprice' =&gt; 'asc'),
	'limit' =&gt; 10,
	'group' =&gt; 'Product.id',
	'passit' =&gt; $this-&gt;passedArgs // pass via $extra
);
$products = $this-&gt;paginate('Product');
$this-&gt;set(compact('products'));</pre>
<p>I hope you know what does $this->passedArgs do. If not, no worry, you can see the output of pr($this->passedArgs) from any controller/view.</p>
<p>Here is the patch I applied to the paginate function in the model:</p>
<h3>Product Model code segment</h3>
<pre class="brush: php; highlight: [2,3,4,5];">function paginate($conditions, $fields, $order, $limit, $page = 1, $recursive = null, $extra = array()) {
	if(empty($order)){
		// great fix!
		$order = array($extra['passit']['sort'] =&gt; $extra['passit']['direction']);
	}
	$group = $extra['group'];
	return $this-&gt;find('all', compact('conditions', 'fields', 'order', 'limit', 'page', 'recursive', 'group'));
}</pre>
<p>And finally it worked great!</p>
<p>Oh! I forgot, there is a little pain in the view section. I&#8217;ve already said this is a patch, the paginate function can&#8217;t detect the current sorting direction of the derived fields automatically. The link with the derived field&#8217;s sorting column always remains direction:asc no matter you change it manually from the address bar to asc or desc! Here is the fix for view section:</p>
<h3>View code segment</h3>
<pre class="brush: php; highlight: [3,4,9];">&lt;?php
// echo $paginator-&gt;sort('Lowest Price', 'lowestprice');
// Use $html-&gt;link, not $paginator-&gt;sort
echo $html-&gt;link(__('Lowest Price', true), array(
	'controller' =&gt; 'sub_categories',
	'action' =&gt; 'view',
	'page' =&gt; $this-&gt;passedArgs['page'],
	'sort' =&gt; 'lowestprice',
	'direction' =&gt; (empty($this-&gt;passedArgs['direction']) || $this-&gt;passedArgs['direction'] == 'asc')?'desc' : 'asc',
	'limit' =&gt; $this-&gt;passedArgs['limit']
));
?&gt;</pre>
<p>Please turn off debugging by Configure::write(&#8216;debug&#8217;, 0) otherwise you may see some annoying warnings and notices of undefined variables. Or you may use isset to check if the vars are set or not and modify the view code accordingly. To me it&#8217;s less important and didn&#8217;t bother to fix it.</p>
<p>It&#8217;s almost perfect now and worked happily ever after.. ;)</p>
<p>If you have any better idea or suggestion please share in the comments.</p>


<p>Related posts:</p><ol><li><a href='http://abcoder.com/php/cakephp/having-clause-in-cakephp-find-query/' rel='bookmark' title='Permanent Link: HAVING clause in CakePHP find query'>HAVING clause in CakePHP find query</a> <small>Is there any way to use HAVING clause in cakephp find() function parameters? I'm not sure, but I did it somehow and it works perfect!...</small></li>
<li><a href='http://abcoder.com/php/simplify-your-query-easily/' rel='bookmark' title='Permanent Link: Simplify your query easily'>Simplify your query easily</a> <small>Simplify your long insert and update mysql queries using this simple php function. Just keep the input fields name same as the field names of database table and this function will automatically generate the insert or update query. It is so simple to use. Download the code completely free....</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://abcoder.com/php/cakephp/cakephp-advanced-pagination-sort-by-derived-field/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>HAVING clause in CakePHP find query</title>
		<link>http://abcoder.com/php/cakephp/having-clause-in-cakephp-find-query/</link>
		<comments>http://abcoder.com/php/cakephp/having-clause-in-cakephp-find-query/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 10:45:42 +0000</pubDate>
		<dc:creator>adnan</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[cake]]></category>
		<category><![CDATA[cake way]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[HAVING]]></category>
		<category><![CDATA[ingredients]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://abcoder.com/?p=409</guid>
		<description><![CDATA[Is there any way to use HAVING clause in cakephp find() function parameters? I'm not sure, but I did it somehow and it works perfect!


Related posts:<ol><li><a href='http://abcoder.com/php/cakephp/cakephp-advanced-pagination-sort-by-derived-field/' rel='bookmark' title='Permanent Link: CakePHP Advanced Pagination &#8211; sort by derived field'>CakePHP Advanced Pagination &#8211; sort by derived field</a> <small>By default CakePHP's pagination method does not support sort by derived field. But with a very simple and easy fix you can get it working in the cake way! No need of extra new pagination component, just modify the pagination function from the model......</small></li>
<li><a href='http://abcoder.com/php/simplify-your-query-easily/' rel='bookmark' title='Permanent Link: Simplify your query easily'>Simplify your query easily</a> <small>Simplify your long insert and update mysql queries using this simple php function. Just keep the input fields name same as the field names of database table and this function will automatically generate the insert or update query. It is so simple to use. Download the code completely free....</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;m in love with Cake. Yes it&#8217;s true cake is too much addictive. ;) As a novice it&#8217;s not that comfortable to start with cakephp framework, cos most of the stuffs from the cake book hardly work perfectly, it&#8217;s good they update their code too frequently, but not the cake book. I&#8217;ll write several posts on cakephp issues for beginners with solutions in the coming days. Still a lot of ingredients of the cake are mysterious to me, but there is no doubt, I won&#8217;t hesitate to give them two thumbs up with 5 star rating :)</p>
<p>Right now I&#8217;m working on a price-comparison project using cakephp. This is the first time I&#8217;m using cake. I know you&#8217;d say why didn&#8217;t I try a smaller project first, actually I like to take risk (once my astrologist friend Imon told me this).</p>
<p>Whatever, lets get back to the &#8220;title&#8221; of this post. One of my queries needed HAVING clause, but did not find any way to use HAVING clause with cakephp find() function. I searched a lot on google, didn&#8217;t find anything, even very few people asked for it on popular groups/forums like google/nabble! The SQL query I wanted to run is:</p>
<pre class="brush: sql;">SELECT `Product`.`id` , `Product`.`title` , `Product`.`image_link` , MIN( `ProductsOfMerchant`.`price` ) AS lowest_price, AVG( `ProductReview`.`rating` ) AS average_rating, COUNT( DISTINCT (
`ProductReview`.`id`
) ) AS total_reviews
FROM `products` AS `Product`
LEFT JOIN `products_of_merchants` AS `ProductsOfMerchant` ON ( `ProductsOfMerchant`.`is_active` =1
AND `ProductsOfMerchant`.`product_id` = `Product`.`id` )
LEFT JOIN `product_reviews` AS `ProductReview` ON ( `ProductReview`.`is_approved` =1
AND `ProductReview`.`product_id` = `Product`.`id` )
WHERE `Product`.`is_active` =1
GROUP BY `Product`.`id`
HAVING total_reviews &#038; gt ; =2
ORDER BY `average_rating` DESC
LIMIT 4 </pre>
<p>I added the &#8220;HAVING&#8221; in &#8216;group&#8217; key of the find() function&#8217;s parameters. This is the cakephp code I used and it worked great!</p>
<pre class="brush: php; highlight: [5];">$highRatedProducts = $this-&gt;find('all', array(
	'fields' =&gt; array('Product.id', 'Product.title', 'Product.image_link', 'MIN(ProductsOfMerchant.price) AS lowest_price', 'AVG(ProductReview.rating) AS average_rating', 'COUNT(DISTINCT(ProductReview.id)) AS total_reviews'),
	'conditions' =&gt; array('Product.is_active' =&gt; 1),
	'order' =&gt; 'average_rating DESC',
	'group' =&gt; 'Product.id HAVING total_reviews &gt;= 2',
	'limit' =&gt; 4)
);</pre>
<p>Please share in comments if you know any better(proper) &#8220;Cake way&#8221; to accomplish this.</p>


<p>Related posts:</p><ol><li><a href='http://abcoder.com/php/cakephp/cakephp-advanced-pagination-sort-by-derived-field/' rel='bookmark' title='Permanent Link: CakePHP Advanced Pagination &#8211; sort by derived field'>CakePHP Advanced Pagination &#8211; sort by derived field</a> <small>By default CakePHP's pagination method does not support sort by derived field. But with a very simple and easy fix you can get it working in the cake way! No need of extra new pagination component, just modify the pagination function from the model......</small></li>
<li><a href='http://abcoder.com/php/simplify-your-query-easily/' rel='bookmark' title='Permanent Link: Simplify your query easily'>Simplify your query easily</a> <small>Simplify your long insert and update mysql queries using this simple php function. Just keep the input fields name same as the field names of database table and this function will automatically generate the insert or update query. It is so simple to use. Download the code completely free....</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://abcoder.com/php/cakephp/having-clause-in-cakephp-find-query/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Get Google and Alexa rank of a domain using PHP</title>
		<link>http://abcoder.com/php/get-google-page-rank-and-alexa-rank-of-a-domain-using-php/</link>
		<comments>http://abcoder.com/php/get-google-page-rank-and-alexa-rank-of-a-domain-using-php/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 12:20:48 +0000</pubDate>
		<dc:creator>adnan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[alexa]]></category>
		<category><![CDATA[alexa rank]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[page rank]]></category>

		<guid isPermaLink="false">http://abcoder.com/?p=100</guid>
		<description><![CDATA[Find google page rank and alexa rank using php functions. Here is the simple code, free to use/download. Please feel free to share any better idea via comments.


Related posts:<ol><li><a href='http://abcoder.com/others/most-expensive-domain-names/' rel='bookmark' title='Permanent Link: Most expensive domain names'>Most expensive domain names</a> <small>Here is a list of most expensive domain names. If you have a unnecessary money you can buy one or more, for example tipsurf.com (it costs just $7,332,240) auburnvet.com &#8211; $1,763,200 buyshoes.com &#8211; $1,300,000 callcash.com &#8211; $6,817,500 debtreliefusa.com &#8211; $1,072,000 evayadan.com &#8211; $1,220,200 fantasmas.com &#8211; $2,500,000 gogal.com &#8211; $4,971,200 halfmoon.org &#8211; $980,000 indianrailway.com &#8211; $6,064,800 [...]...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>There are already a lot of ways to find gpr/alexa rank of a domain using php. But not all of them work on 64bit servers. Here is the code that I always use for finding the google page rank and alexa rank of a website.</p>
<h3>Get Google Page rank</h3>
<pre class="brush: php;">function google_page_rank($url) { // URL or domain name
    if (strlen(trim($url))&gt;0) {
        $_url = eregi(&quot;http://&quot;,$url)? $url:&quot;http://&quot;.$url;
        $pagerank = trim(GooglePageRank($_url));
        if (empty($pagerank)) $pagerank = 0;
        return (int)($pagerank);
    }
    return 0;
}

function GooglePageRank($url) {
    $fp = fsockopen(&quot;toolbarqueries.google.com&quot;, 80, $errno, $errstr, 30);
    if (!$fp) {
        echo &quot;$errstr ($errno)&lt;br /&gt;\n&quot;;
        } else {
        $out = &quot;GET /search?client=navclient-auto&amp;ch=&quot;.CheckHash(HashURL($url)).&quot;&amp;features=Rank&amp;q=info:&quot;.$url.&quot;&amp;num=100&amp;filter=0 HTTP/1.1\r\n&quot;;
        $out .= &quot;Host: toolbarqueries.google.com\r\n&quot;;
        $out .= &quot;User-Agent: Mozilla/4.0 (compatible; GoogleToolbar 2.0.114-big; Windows XP 5.1)\r\n&quot;;
        $out .= &quot;Connection: Close\r\n\r\n&quot;;
        fwrite($fp, $out);

        while (!feof($fp)) {
            $data = fgets($fp, 128);
            $pos = strpos($data, &quot;Rank_&quot;);
        if($pos === false){} else{
                $pagerank = substr($data, $pos + 9);
            }
        }
        fclose($fp);
        return $pagerank;
    }
}

function StrToNum($Str, $Check, $Magic) {
    $Int32Unit = 4294967296; // 2^32
    $length = strlen($Str);
    for ($i = 0; $i &lt; $length; $i++) {
        $Check *= $Magic;
        if ($Check &gt;= $Int32Unit) {
            $Check = ($Check - $Int32Unit * (int) ($Check / $Int32Unit));
            $Check = ($Check &lt; -2147483648)? ($Check + $Int32Unit) : $Check;
        }
        $Check += ord($Str{$i});
    }
    return $Check;
}

function HashURL($String) {
    $Check1 = StrToNum($String, 0x1505, 0x21);
    $Check2 = StrToNum($String, 0, 0x1003F);
    $Check1 &gt;&gt;= 2;
    $Check1 = (($Check1 &gt;&gt; 4) &amp; 0x3FFFFC0 ) | ($Check1 &amp; 0x3F);
    $Check1 = (($Check1 &gt;&gt; 4) &amp; 0x3FFC00 ) | ($Check1 &amp; 0x3FF);
    $Check1 = (($Check1 &gt;&gt; 4) &amp; 0x3C000 ) | ($Check1 &amp; 0x3FFF);
    $T1 = (((($Check1 &amp; 0x3C0) &lt; &lt; 4) | ($Check1 &amp; 0x3C)) &lt;&lt; 2 ) | ($Check2 &amp; 0xF0F );
    $T2 = (((($Check1 &amp; 0xFFFFC000) &lt;&lt; 4) | ($Check1 &amp; 0x3C00)) &lt;&lt; 0xA) | ($Check2 &amp; 0xF0F0000 );
    return ($T1 | $T2);
}

function CheckHash($Hashnum) {
    $CheckByte = 0;
    $Flag = 0;
    $HashStr = sprintf('%u', $Hashnum) ;
    $length = strlen($HashStr);
    for ($i = $length - 1; $i &gt;= 0; $i --) {
        $Re = $HashStr{$i};
        if (1 === ($Flag % 2)) {
            $Re += $Re;
            $Re = (int)($Re / 10) + ($Re % 10);
        }
        $CheckByte += $Re;
        $Flag ++;
    }
    $CheckByte %= 10;
    if (0!== $CheckByte) {
        $CheckByte = 10 - $CheckByte;
        if (1 === ($Flag % 2) ) {
            if (1 === ($CheckByte % 2)) {
                $CheckByte += 9;
            }
            $CheckByte &gt;&gt;= 1;
        }
    }
    return '7'.$CheckByte.$HashStr;
}</pre>
<h3>Find Alexa Rank</h3>
<pre class="brush: php;">function alexaRank($domain){
    $remote_url = 'http://data.alexa.com/data?cli=10&amp;dat=snbamz&amp;url='.trim($domain);
    $search_for = '&lt;POPULARITY URL';
    if ($handle = @fopen($remote_url, &quot;r&quot;)) {
        while (!feof($handle)) {
            $part .= fread($handle, 100);
            $pos = strpos($part, $search_for);
            if ($pos === false)
            continue;
            else
            break;
        }
        $part .= fread($handle, 100);
        fclose($handle);
    }
    $str = explode($search_for, $part);
    $str = array_shift(explode('&quot;/&gt;', $str[1]));
    $str = explode('TEXT=&quot;', $str);

    return $str[1];
}</pre>
<p>Hope this will help you. If you know any better(working) solution please let me know via comments.</p>


<p>Related posts:</p><ol><li><a href='http://abcoder.com/others/most-expensive-domain-names/' rel='bookmark' title='Permanent Link: Most expensive domain names'>Most expensive domain names</a> <small>Here is a list of most expensive domain names. If you have a unnecessary money you can buy one or more, for example tipsurf.com (it costs just $7,332,240) auburnvet.com &#8211; $1,763,200 buyshoes.com &#8211; $1,300,000 callcash.com &#8211; $6,817,500 debtreliefusa.com &#8211; $1,072,000 evayadan.com &#8211; $1,220,200 fantasmas.com &#8211; $2,500,000 gogal.com &#8211; $4,971,200 halfmoon.org &#8211; $980,000 indianrailway.com &#8211; $6,064,800 [...]...</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://abcoder.com/php/get-google-page-rank-and-alexa-rank-of-a-domain-using-php/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Problem with resizing corrupted images using PHP image functions</title>
		<link>http://abcoder.com/php/problem-with-resizing-corrupted-images-using-php-image-functions/</link>
		<comments>http://abcoder.com/php/problem-with-resizing-corrupted-images-using-php-image-functions/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 05:51:59 +0000</pubDate>
		<dc:creator>adnan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[corrupted]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[GD]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[imagemagick]]></category>
		<category><![CDATA[phpThumb]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[resize]]></category>
		<category><![CDATA[solved]]></category>
		<category><![CDATA[upload]]></category>
		<category><![CDATA[using]]></category>

		<guid isPermaLink="false">http://abcoder.com/?p=51</guid>
		<description><![CDATA[PHP image functions can not resize corrupted image files. Use phpThumb for resizing images and you'll save a lot of time. Please read the full article for source code. Thanks again to phpThumb for their great effort!


Related posts:<ol><li><a href='http://abcoder.com/javascript/ie6-png-alpha-transparency-fix-for-dynamically-loaded-images-via-ajax/' rel='bookmark' title='Permanent Link: IE6 png alpha transparency fix for dynamically loaded images via ajax'>IE6 png alpha transparency fix for dynamically loaded images via ajax</a> <small>Simple javascript and jQuery code for fixing the alpha transparency problem of png image on Internet explorer 6. iepngfix.htc does not work for dynamic images loaded via ajax call. But this simple code works great for dynamically loaded images....</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>As a programmer we must always think about the exceptional situations. Generally I use my own function to resize uploaded images. It supports jpg, gif, png images with transparency which is &#8220;almost&#8221; okay.</p>
<pre class="brush: php;">&lt;?php
// example use
// resizeImage(&quot;corrupted_image_1.jpg&quot;, &quot;corrupted_image_resized.jpg&quot;, 100, 100, &quot;jpg&quot;);
function chkImgExt($n){
	$tmp = explode('.', $n);
	$ext = strtolower(array_pop($tmp));
	if($ext == 'jpg' || $ext == 'jpeg' || $ext == 'gif' || $ext == 'png')
		return $ext;
	else
		return false;
}

function resizeImage($src, $dest, $w, $h, $ext){
	$real_path = dirname(__FILE__) . '/';
	$tmpFile = $real_path.&quot;tmp_images/&quot;.time().'TMP.'.$ext;
	copy($src, $tmpFile); // you may use move_uploaded_file() if the $src is a $_FILES referance
	@chmod($tmpFile, 0777);
	$src = $tmpFile;
	list($width, $height) = @getimagesize($src);
	$new_width = $w;
	$new_height = $h;

	switch($ext){
		case 'jpg':
			$image = imagecreatefromjpeg($src);
			break;
		case 'jpeg':
			$image = imagecreatefromjpeg($src);
			break;
		case 'gif':
			$image = imagecreatefromgif($src);
			break;
		case 'png':
			$image = imagecreatefrompng($src);
			break;
		} 	

	// Resample
	$image_p = @imagecreatetruecolor($new_width, $new_height);
	if ( ($ext == 'gif') || ($ext == 'png') ) {
		$trnprt_indx = imagecolortransparent($image);

		// If we have a specific transparent color
		if ($trnprt_indx &gt;= 0) {

			// Get the original image's transparent color's RGB values
			$trnprt_color = imagecolorsforindex($image, $trnprt_indx);

			// Allocate the same color in the new image resource
			$trnprt_indx = imagecolorallocate($image_p, $trnprt_color['red'], $trnprt_color['green'], $trnprt_color['blue']);

			// Completely fill the background of the new image with allocated color.
			imagefill($image_p, 0, 0, $trnprt_indx);

			// Set the background color for new image to transparent
			imagecolortransparent($image_p, $trnprt_indx);
		}
		// Always make a transparent background color for PNGs that don't have one allocated already
		elseif ($ext == 'png'){
			// Turn off transparency blending (temporarily)
			imagealphablending($image_p, false);

			// Create a new transparent color for image
			$color = imagecolorallocatealpha($image_p, 0, 0, 0, 127);

			// Completely fill the background of the new image with allocated color.
			imagefill($image_p, 0, 0, $color);

			// Restore transparency blending
			imagesavealpha($image_p, true);
		}
	}

	imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);

	if(file_exists($dest)){
		@unlink($dest);
	}
	// Output
	switch($ext){
		case 'jpg':
			imagejpeg($image_p, $dest, 100);
			break;
		case 'jpeg':
			imagejpeg($image_p, $dest, 100);
			break;
		case 'gif':
			imagegif($image_p, $dest);
			break;
		case 'png':
			imagepng($image_p, $dest);
			break;
	}

	imagedestroy($image_p);
	unlink($tmpFile);
	return true;
}
?&gt;</pre>
<p>But when I tried resizing these 2 images (<a title="Corrupted image" href="http://abcoder.com/images/corrupted_image_1.jpg" target="_blank">corrupted_image_1.jpg</a>, <a title="Corrupted image" href="http://abcoder.com/images/corrupted_image_2.jpg" target="_blank">corrupted_image_2.jpg</a>) it failed! The error is:</p>
<pre class="brush: plain; highlight: [1]; light: true;">gd-jpeg, libjpeg: recoverable error: Corrupt JPEG data: 9 extraneous bytes before marker 0xd9</pre>
<p>I don&#8217;t know what does it mean!</p>
<p>First I thought the problem may be due to large file size or GD. I tried with larger file and it worked fine! Then I opened the corrupted images with photoshop and just save as jpg again, and yes it worked. It does not make good sense to me. How a general user will do that? I searched a lot on Google and got a lot of alternative image resizing codes and none of them worked. :(</p>
<p>Now what? Yes I used phpThumb long ago and to me (also most of you) it feels like using a lot of unnecessary codes just for simply resizing a silly image! I can&#8217;t believe phpThumb created the thumbnails of both of the corrupted images! yes, using GD! no imagemagick.</p>
<p>I have no idea how phpThumb do it? I never dare to look inside their codes :P<br />
Here is the code using phpThumb to resize the images:</p>
<pre class="brush: php;">&lt;?php
	require_once('phpthumb/phpthumb.class.php');
	$phpThumb = new phpThumb();
	$capture_raw_data = false; 	$phpThumb-&gt;resetObject();
	$phpThumb-&gt;setSourceFilename($targetFile); // your source image file
	$output_filename = $tpath; // output file path
	$phpThumb-&gt;setParameter('w', 100); // thumbnail width
	$phpThumb-&gt;setParameter('q', 100); // thumbnail quality
	$phpThumb-&gt;setParameter('config_output_format', 'jpeg'); // preferred thumbnail format 

	if ($phpThumb-&gt;GenerateThumbnail()){
		if($phpThumb-&gt;RenderToFile($output_filename)){
			// success
		} else {
			$msg = &quot;Error during resizing \n&quot; . $phpThumb-&gt;fatalerror . '  ' . $phpThumb-&gt;debugmessages;
		}
	} else {
		$msg = &quot;Error with file\n&quot; . $phpThumb-&gt;fatalerror . '  ' . $phpThumb-&gt;debugmessages;
	}
?&gt;</pre>
<p>If you are using your own function for image resizing please check with these 2 files (<a title="Corrupted image" href="http://abcoder.com/images/corrupted_image_1.jpg" target="_blank">corrupted_image_1.jpg</a>, <a title="Corrupted image" href="http://abcoder.com/images/corrupted_image_2.jpg" target="_blank">corrupted_image_2.jpg</a>). If you see it doesn&#8217;t work I would suggest to use phpThumb, it&#8217;s free. You should also make sure your <a href="http://www.webhostingsearch.com/">web host</a> has the latest php version on the server or go with a <a href="http://www.webhostingsearch.com/php-web-hosting.php">php hosting provider</a>, that specializes in it.</p>
<p>Thanks a lot to phpThumb for their amazing work!</p>


<p>Related posts:</p><ol><li><a href='http://abcoder.com/javascript/ie6-png-alpha-transparency-fix-for-dynamically-loaded-images-via-ajax/' rel='bookmark' title='Permanent Link: IE6 png alpha transparency fix for dynamically loaded images via ajax'>IE6 png alpha transparency fix for dynamically loaded images via ajax</a> <small>Simple javascript and jQuery code for fixing the alpha transparency problem of png image on Internet explorer 6. iepngfix.htc does not work for dynamic images loaded via ajax call. But this simple code works great for dynamically loaded images....</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://abcoder.com/php/problem-with-resizing-corrupted-images-using-php-image-functions/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>How to get currently logged on windows username in PHP and Javascript</title>
		<link>http://abcoder.com/javascript/how-to-get-currently-logged-on-windows-username-in-php-javascript/</link>
		<comments>http://abcoder.com/javascript/how-to-get-currently-logged-on-windows-username-in-php-javascript/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 17:51:56 +0000</pubDate>
		<dc:creator>adnan</dc:creator>
				<category><![CDATA[Core JavaScript]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[easy]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[get currently logged on windows username]]></category>
		<category><![CDATA[get user]]></category>
		<category><![CDATA[get windows user name using javascript]]></category>
		<category><![CDATA[pull username]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[username]]></category>
		<category><![CDATA[VBscript]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[windows system variable]]></category>
		<category><![CDATA[windows username]]></category>

		<guid isPermaLink="false">http://abcoder.com/?p=23</guid>
		<description><![CDATA[Get current windows username in php and javascript! Is that possible?


Related posts:<ol><li><a href='http://abcoder.com/microsoft/windows-7-reduces-battery-life/' rel='bookmark' title='Permanent Link: Under Windows 7 laptop reduces more battery life'>Under Windows 7 laptop reduces more battery life</a> <small>Based on various forum posts, users are claiming that battery life running out very quickly after a laptop is upgraded from an older OS to Windows 7....</small></li>
<li><a href='http://abcoder.com/microsoft/windows-phone-7-cannot-run-applications-written-for-older-versions/' rel='bookmark' title='Permanent Link: Windows phone 7 cannot run applications written for older versions'>Windows phone 7 cannot run applications written for older versions</a> <small>Microsoft Corp. has said its new software for smart phones, Windows Phone 7 series, is a "clean break" with the past. But Windows phone 7 cannot run any applications written for older versions of Microsoft's phone software. Windows Phone 7 Series is designed for touch screens that work well with fingers but don't work with fine styluses....</small></li>
<li><a href='http://abcoder.com/javascript/core_javascript/javascript_timer/' rel='bookmark' title='Permanent Link: Javascript timer &#8211; advanced features, simple to use'>Javascript timer &#8211; advanced features, simple to use</a> <small>javascript is the core of rich UI development and ajax driven website. i enjoy doing these. but in many cases, i thought things would be easier if the setTimeout(&#8230;) or setInterval(&#8230;) functions were simpler to handle. if you ever tried to make something like fadeout effect or accordion or anything that happens with a certain [...]...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>It is very simple to get the current windows username in PHP. The following one line of code will output the username of the system where the server is running. If you are running this from localhost then your system login name will be shown. But you can not get the visitor&#8217;s system login username.</p>
<pre class="brush: php;">&lt;?php echo getenv(&quot;username&quot;); ?&gt;</pre>
<p>By using javascript (actually VBscript) you can get the visitor&#8217;s windows username. But there are also limitations. It only works on IE.</p>
<pre class="brush: jscript;">&lt;script language=&quot;VBscript&quot;&gt;
Dim X
set X = createobject(&quot;WSCRIPT.Network&quot;)
dim U
U=x.UserName
MsgBox &quot;username: &quot; &amp; U
&lt;/script&gt;
&lt;script language=&quot;Javascript&quot;&gt;
var a = U;
alert(&quot;Hello, &quot; + a.toString());
&lt;/script&gt;</pre>
<p>This code will show you the current windows username. But won&#8217;t work if run from http://. Open the page from your computer with IE and it&#8217;ll work, otherwise not.</p>
<p>Actually it is not possible to get the windows username of your website visitors as it is a security issue. So don&#8217;t waste your time if you are trying to do that.</p>


<p>Related posts:</p><ol><li><a href='http://abcoder.com/microsoft/windows-7-reduces-battery-life/' rel='bookmark' title='Permanent Link: Under Windows 7 laptop reduces more battery life'>Under Windows 7 laptop reduces more battery life</a> <small>Based on various forum posts, users are claiming that battery life running out very quickly after a laptop is upgraded from an older OS to Windows 7....</small></li>
<li><a href='http://abcoder.com/microsoft/windows-phone-7-cannot-run-applications-written-for-older-versions/' rel='bookmark' title='Permanent Link: Windows phone 7 cannot run applications written for older versions'>Windows phone 7 cannot run applications written for older versions</a> <small>Microsoft Corp. has said its new software for smart phones, Windows Phone 7 series, is a "clean break" with the past. But Windows phone 7 cannot run any applications written for older versions of Microsoft's phone software. Windows Phone 7 Series is designed for touch screens that work well with fingers but don't work with fine styluses....</small></li>
<li><a href='http://abcoder.com/javascript/core_javascript/javascript_timer/' rel='bookmark' title='Permanent Link: Javascript timer &#8211; advanced features, simple to use'>Javascript timer &#8211; advanced features, simple to use</a> <small>javascript is the core of rich UI development and ajax driven website. i enjoy doing these. but in many cases, i thought things would be easier if the setTimeout(&#8230;) or setInterval(&#8230;) functions were simpler to handle. if you ever tried to make something like fadeout effect or accordion or anything that happens with a certain [...]...</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://abcoder.com/javascript/how-to-get-currently-logged-on-windows-username-in-php-javascript/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Simplify your query easily</title>
		<link>http://abcoder.com/php/simplify-your-query-easily/</link>
		<comments>http://abcoder.com/php/simplify-your-query-easily/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 18:42:16 +0000</pubDate>
		<dc:creator>adnan</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[easy]]></category>
		<category><![CDATA[easy sql query simplifier function]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[simple insert update query]]></category>
		<category><![CDATA[simplify query]]></category>

		<guid isPermaLink="false">http://abcoder.com/?p=22</guid>
		<description><![CDATA[Simplify your long insert and update mysql queries using this simple php function. Just keep the input fields name same as the field names of database table and this function will automatically generate the insert or update query. It is so simple to use. Download the code completely free.


Related posts:<ol><li><a href='http://abcoder.com/javascript/using-dreamweaver-spry-validation-with-jquery-ajax-form-plugin/' rel='bookmark' title='Permanent Link: Using Dreamweaver Spry validation with jQuery ajax form plugin'>Using Dreamweaver Spry validation with jQuery ajax form plugin</a> <small>A simple function for using Spry form validation of Dreamweaver with jQuery ajax form submit plugin. Just put this 3 lines of code in the "beforeSubmit" parameter of $.ajaxForm and that's all!...</small></li>
<li><a href='http://abcoder.com/php/cakephp/having-clause-in-cakephp-find-query/' rel='bookmark' title='Permanent Link: HAVING clause in CakePHP find query'>HAVING clause in CakePHP find query</a> <small>Is there any way to use HAVING clause in cakephp find() function parameters? I'm not sure, but I did it somehow and it works perfect!...</small></li>
<li><a href='http://abcoder.com/javascript/how-to-get-currently-logged-on-windows-username-in-php-javascript/' rel='bookmark' title='Permanent Link: How to get currently logged on windows username in PHP and Javascript'>How to get currently logged on windows username in PHP and Javascript</a> <small>Get current windows username in php and javascript! Is that possible?...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s always boring and time consuming writing long INSERT/UPDATE query. Generally when you need to insert a form data with a large number of fields into a single table it does not make any good sense to write the full query manually. For example &#8220;INSERT into tbl set name = &#8216;$_POST[name]&#8216; , email = &#8216;$_POST[email]&#8216; , &#8230;.. may be 30 fields! So how can you minimize your effort?</p>
<p>I have written a very simple PHP function for this:</p>
<pre class="brush: php;">&lt;?php
function genquery($table, $data, $mode = 'insert into', $condition = '', $raw = '') {
	$res = mysql_query(&quot;select * from $table limit 1&quot;);

	$field_arr = array();
	for($i=0; $i &lt; mysql_num_fields($res); $i++) {
		$field_arr[] = mysql_field_name($res, $i);
	}
	mysql_free_result($res);

	$qstr = $mode.&quot; &quot;.$table.&quot; set &quot;;
	$arr = array();
	foreach($data as $k =&gt; $v) {
		if(!in_array($k, $field_arr)) continue;
		$arr[] = $k.&quot; = '&quot;.$v.&quot;'&quot;;
	}
	$qstr .= implode(', ', $arr);

	$qstr .= ' ' . $raw;

	if($mode == 'update' &amp;&amp; $condition != ''){
		$qstr .= ' where ' . $condition;
	}
	return $qstr;
}
?&gt;</pre>
<p>You must follow a simple way for using this function. The name of the input fields in the form should be same as the fields in the table of your database. I assume your form will be submitted in POST format. In fact a form with many fields is always submitted in post method.</p>
<p>Here is how to use this function:</p>
<pre class="brush: php;">&lt;?php
include(&quot;qfn.php&quot;);
if(isset($_POST['submit'])){  // if the form is submitted

$q = genquery(&quot;tableName&quot;, $_POST, &quot;INSERT INTO&quot;, '', '');
mysql_query($q);
}
?&gt;</pre>
<p>For updating use:</p>
<pre class="brush: php;">$q = genquery(&quot;tableName&quot;, $_POST, &quot;UPDATE&quot;, &quot; id = '$_SESSION[id]' &quot;, '');
// the 4th parameter is the condition for update. Use your own condition.</pre>
<p>You can use more than one condition like:</p>
<pre class="brush: php;">$q = genquery(&quot;tableName&quot;, $_POST, &quot;UPDATE&quot;, &quot; id = '$_SESSION[id]' AND uid = '$_SESSION[uid]' &quot;, '');</pre>
<p>The 5th parameter is for raw values like
<pre class="brush: php;">&quot;entry_date = CURDATE(), status = '1' &quot;</pre>
<p>You can use the 5th parameter both for INSERT and UPDATE query. But the 4th parameter is only for UPDATE query.</p>
<p>Hope this will help you a lot and save your time &amp; energy.</p>
<p><a title="Download query simplifier " href="http://abcoder.com/qfn.zip">Download the php file in zip format.</a></p>


<p>Related posts:</p><ol><li><a href='http://abcoder.com/javascript/using-dreamweaver-spry-validation-with-jquery-ajax-form-plugin/' rel='bookmark' title='Permanent Link: Using Dreamweaver Spry validation with jQuery ajax form plugin'>Using Dreamweaver Spry validation with jQuery ajax form plugin</a> <small>A simple function for using Spry form validation of Dreamweaver with jQuery ajax form submit plugin. Just put this 3 lines of code in the "beforeSubmit" parameter of $.ajaxForm and that's all!...</small></li>
<li><a href='http://abcoder.com/php/cakephp/having-clause-in-cakephp-find-query/' rel='bookmark' title='Permanent Link: HAVING clause in CakePHP find query'>HAVING clause in CakePHP find query</a> <small>Is there any way to use HAVING clause in cakephp find() function parameters? I'm not sure, but I did it somehow and it works perfect!...</small></li>
<li><a href='http://abcoder.com/javascript/how-to-get-currently-logged-on-windows-username-in-php-javascript/' rel='bookmark' title='Permanent Link: How to get currently logged on windows username in PHP and Javascript'>How to get currently logged on windows username in PHP and Javascript</a> <small>Get current windows username in php and javascript! Is that possible?...</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://abcoder.com/php/simplify-your-query-easily/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flickr Uploader Clone: Free Download with source code</title>
		<link>http://abcoder.com/javascript/flickr-uploader-clone-free-download-with-source-code/</link>
		<comments>http://abcoder.com/javascript/flickr-uploader-clone-free-download-with-source-code/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 18:13:44 +0000</pubDate>
		<dc:creator>adnan</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Core JavaScript]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[flash uploader]]></category>
		<category><![CDATA[Flickr]]></category>
		<category><![CDATA[Flickr Uploader]]></category>
		<category><![CDATA[Javascript uploader with progress bar]]></category>
		<category><![CDATA[Uploader]]></category>

		<guid isPermaLink="false">http://abcoder.com/?p=18</guid>
		<description><![CDATA[Flickr Uploader clone for free using javascript and flash. PHP is used for server side. Download if for completely free in one zip file.


Related posts:<ol><li><a href='http://abcoder.com/javascript/gmail-uploader-clone-with-drag-drop-feature-free-download-with-source-code/' rel='bookmark' title='Permanent Link: Gmail uploader clone with drag drop feature : Free Download with source code'>Gmail uploader clone with drag drop feature : Free Download with source code</a> <small>Gmail file uploader clone with drag drop feature using jQuery. Download full working source code in a single zip file for free....</small></li>
<li><a href='http://abcoder.com/javascript/how-to-get-currently-logged-on-windows-username-in-php-javascript/' rel='bookmark' title='Permanent Link: How to get currently logged on windows username in PHP and Javascript'>How to get currently logged on windows username in PHP and Javascript</a> <small>Get current windows username in php and javascript! Is that possible?...</small></li>
<li><a href='http://abcoder.com/flickr/flicka-on-android-market-is-knocking-at/' rel='bookmark' title='Permanent Link: Flicka on Android Market is knocking at'>Flicka on Android Market is knocking at</a> <small>Flickr.com is going to introduce its aptitude through Flicka on Android phone....</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I have been searching for flickr uploader clone script online for one of my project. But no luck! There is no such thing on internet. Then I started with analyzing the javascript code of flickr uploader. Lucky that they did not packed their js. Though it was minified by removing white spaces. I used an online javascript code beautifier to make it pretty readable. After that the challenging part began. Cos, the code normally does not work on my local server. After huge hard working of long one week I made it finally. It works great! Even it works for videos too. You can modify the code for uploading any types of file. FYI, Flickr has used YUI (Yahoo User Interface) library for their uploader. So there is no licensing problem if you use this uploader for your own.</p>
<p>For my own need I added 2 extra fields. They are sent to server via POST method along with the FILES. One thing I&#8217;ve noticed, it can upload file faster than normal file uploading method. Cos, the file is encoded first via the flash uploader and somehow it is faster than normal.</p>
<p><img src="http://abcoder.com/YUI/select-multiple-files.jpg" alt="Upload Multiple File Once" width="500" height="299" /></p>
<p>And the great advantage is you can select multiple files during browsing by pressing Ctlr + A or select your files by dragging mouse. By using html &lt;input type=&#8221;file&#8221; /&gt; you can only select one file at a time which is really so boaring and life-taking when you want to upload hundreds of images.</p>
<p><img src="http://abcoder.com/YUI/Flickr-YUI-Uploader.jpg" alt="Flickr YUI Uploader" width="500" height="600" /></p>
<p><a title="Flickr Uploader using YUI" href="http://abcoder.com/YUI" target="_blank"><strong>Here is the online demo</strong></a>. The files are not being saved on my server for my own security!</p>
<p><a title="Free download Flickr Uploader using YUI - zip file." href="http://abcoder.com/YUI/Flickr-YUI.zip" target="_blank">Download it here completely free in a single zip file</a>!</p>
<p><strong>Modify the index_files/config.js file line no 49,<br />
var _site_root = &#8216;your script location&#8217;;</strong><br />
<strong>It won&#8217;t work for you until you change _site_root</strong></p>
<p>I have no problem if you use it for your own use. But I do not actually want anyone to put the files/zip on their own site to drive the traffics away from our blog.</p>
<p>If you need any support for modifying or setting it up or any bug report please contact me directly at <a title="adnan.eee@gmail.com" href="mailto:adnan.eee@gmail.com" target="_blank">adnan.eee@gmail.com</a></p>
<p>Thanks<br />
Have a pain-less uploading experience!</p>


<p>Related posts:</p><ol><li><a href='http://abcoder.com/javascript/gmail-uploader-clone-with-drag-drop-feature-free-download-with-source-code/' rel='bookmark' title='Permanent Link: Gmail uploader clone with drag drop feature : Free Download with source code'>Gmail uploader clone with drag drop feature : Free Download with source code</a> <small>Gmail file uploader clone with drag drop feature using jQuery. Download full working source code in a single zip file for free....</small></li>
<li><a href='http://abcoder.com/javascript/how-to-get-currently-logged-on-windows-username-in-php-javascript/' rel='bookmark' title='Permanent Link: How to get currently logged on windows username in PHP and Javascript'>How to get currently logged on windows username in PHP and Javascript</a> <small>Get current windows username in php and javascript! Is that possible?...</small></li>
<li><a href='http://abcoder.com/flickr/flicka-on-android-market-is-knocking-at/' rel='bookmark' title='Permanent Link: Flicka on Android Market is knocking at'>Flicka on Android Market is knocking at</a> <small>Flickr.com is going to introduce its aptitude through Flicka on Android phone....</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://abcoder.com/javascript/flickr-uploader-clone-free-download-with-source-code/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
	</channel>
</rss>
