<?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>Digicorp &#187; php</title>
	<atom:link href="http://dev.digi-corp.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.digi-corp.com</link>
	<description>&#62;&#62; Developer Blog</description>
	<lastBuildDate>Wed, 22 Jun 2011 14:13:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Qmail send conflict with google apps SMTP</title>
		<link>http://dev.digi-corp.com/2011/06/qmail-send-conflict-with-google-apps-smtp/</link>
		<comments>http://dev.digi-corp.com/2011/06/qmail-send-conflict-with-google-apps-smtp/#comments</comments>
		<pubDate>Fri, 10 Jun 2011 09:39:56 +0000</pubDate>
		<dc:creator>sonal.shah</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://dev.digi-corp.com/?p=1929</guid>
		<description><![CDATA[Recently I have faced one issue during server transfer.we needed to transfer server from shared to dedicated.this dedicated server was having parallel plesk control panel,which has by default qmail-send program enabled for mail sending. we choose google apps SMTP server for mail send. Now Issue we encountered was as below : In Our Site,Two e-mails [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I have faced one issue during server transfer.we needed to transfer server from shared  to dedicated.this dedicated server was having parallel plesk control panel,which has by default qmail-send program enabled for mail sending. we choose google apps SMTP server for mail send.</p>
<p>Now Issue we encountered was as below :<br />
In Our Site,Two e-mails are sent when filling out our &#8220;Contact Us&#8221; form.<br />
(1) One E-mail sent to the person who filled out the form<br />
(2) A copy of the inquiry is sent to admin@mysite.com<br />
1st was working fine,but 2nd was not working..we were not receiving any mails on admin@mysite.com  </p>
<p>every time we were getting failure notice,while sending mail to admin@mysite.com  </p>
<p>It was like below :  </p>
<p>&#8216;Hi. This is the qmail-send program at mysite.com.<br />
I&#8217;m afraid I wasn&#8217;t able to deliver your message to the following addresses.<br />
This is a permanent error; I&#8217;ve given up.<br />
Sorry it didn&#8217;t work out.  : This address no longer accepts mail. &#8216;</p>
<p><strong>Solution of this issue is as below :-</strong></p>
<p>For Mail Purpose, we were using google apps SMTP server which means external MX-record was enabled,<br />
while parallel plesk control panel has by default internal MX-record service was enabled.</p>
<p>we can not have 2 MX-records enabled at the same time.<br />
so we need to disable internal MX-record.so we disabled mail service from PPP(parallel plesk panel) and all started to work properly!!!.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.digi-corp.com/2011/06/qmail-send-conflict-with-google-apps-smtp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Paypal shopping cart integration using HTML for Beginners</title>
		<link>http://dev.digi-corp.com/2009/11/paypal-shopping-cart-integration-using-html/</link>
		<comments>http://dev.digi-corp.com/2009/11/paypal-shopping-cart-integration-using-html/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 07:49:08 +0000</pubDate>
		<dc:creator>devdatt.mehta</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://dev.digi-corp.com/?p=1760</guid>
		<description><![CDATA[In online payment paradigm Paypal is one of the best and popular online payment services. Through this article I will share my experience with you about integration of online payment services. Novice developer may find this post very useful. I have used following methods for the online payment integration in my shopping cart. In development [...]]]></description>
			<content:encoded><![CDATA[<p>In online payment paradigm Paypal is one of the best and popular online payment services. Through this article I will share my experience with you about integration of online payment services.</p>
<p>Novice developer may find this post very useful.</p>
<p>I have used following methods for the online payment integration in my shopping cart.</p>
<p>In development process you need to create paypal testing account for that create paypal sandbox account for the testing purpose.</p>
<p>Step 1: https://developer.paypal.com/<br />
Step 2: Create new account<br />
Step 3: Paypal will send you activation link in your email inbox.<br />
Step 4: Login in sandbox<br />
Step 5: Create Test Accounts for buyer and seller accounts</p>
<p>Go to the Test Account page in paypal. Basically you need to type of account for your site integration<br />
1.Buyer Account<br />
2.Merchant Account.</p>
<p>Select country &#8220;United States&#8221;.<br />
If you want to create buyer account choose Account Type: Buyer<br />
Fill the form accordingly. Keep your login and password some where.<br />
Click on &#8220;Show Advanced Options&#8221;.<br />
Choose what card you want to use when will do online purchase for testing.<br />
Set Account Balance.</p>
<p>Create seller account in same way as above.</p>
<p>Paypal gives you many ways to integrate your site with but here I will explain one method for the integration.</p>
<p>Simple Integration<br />
==================<br />
In simple integration with your site you need to know some predefined html variable created by paypal.</p>
<p>Not all the HTML variables I shown here but some of the important that I showed here out of other it is depend on your merchant account and situation.</p>
<p>Ref: https://cms.paypal.com/us/cgi-bin/?&amp;cmd=_render-content&amp;content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables</p>
<p>set following html variable as hidden in your Buy Now button page in your shopping cart page.</p>
<p>Replace all the value as per given instructions under the value attribute.<br />
&lt;FORM name=&#8221;redirectoPaypal&#8221; METHOD=&#8221;POST&#8221; ACTION=&#8221;https://www.sandbox.paypal.com/cgi-bin/webscr&#8221; /&gt;<br />
&lt;INPUT TYPE=&#8221;hidden&#8221; name=&#8221;CMD&#8221; value=&#8221;_xclick&#8221; /&gt;<br />
&lt;INPUT TYPE=&#8221;hidden&#8221; name=&#8221;amount&#8221; value=&#8221;shopping cart total amount of selected items&#8221; /&gt;<br />
&lt;INPUT TYPE=&#8221;hidden&#8221; name=&#8221;item_name&#8221; value=&#8221;shopping cart item description or name&#8221; /&gt;<br />
&lt;INPUT TYPE=&#8221;hidden&#8221; name=&#8221;item_number&#8221; value=&#8221;selected item number&#8221; /&gt;<br />
&lt;INPUT TYPE=&#8221;hidden&#8221; name=&#8221;quantity&#8221; value=&#8221;selected item quantity&#8221; /&gt;<br />
&lt;INPUT TYPE=&#8221;hidden&#8221; name=&#8221;currency_ code&#8221; value=&#8221;USD&#8221; /&gt;<br />
&lt;INPUT TYPE=&#8221;hidden&#8221; name=&#8221;invoice&#8221; value=&#8221;invoice number&#8221; /&gt;<br />
&lt;INPUT TYPE=&#8221;hidden&#8221; name=&#8221;business&#8221; value=&#8221;your merchant paypal login id&#8221; /&gt;<br />
&lt;INPUT TYPE=&#8221;hidden&#8221; name=&#8221;return&#8221; value=&#8221;site url for success page&#8221; /&gt;<br />
&lt;INPUT TYPE=&#8221;hidden&#8221; name=&#8221;cancel_return&#8221; value=&#8221;site url for cancel paypal payment page&#8221; /&gt;<br />
&lt;/FORM&gt;</p>
<p>more explanation of html variables.<br />
&#8220;CMD&#8221; is use for shopping cart do not change it.<br />
&#8220;business&#8221; in testing set seller account id here after complete testing change to real merchant account id.<br />
&#8220;return&#8221; is page url of your site paypal will redirect on this page with some extra variable such as transaction id. just debug with var_dump($_GET)<br />
and use.<br />
&#8220;cancel_return&#8221; is page url of your site. paypal will redirect on this page if user will denied to confirm the payment.</p>
<p>put above code in your page and test it.<br />
when your set-up working successfully. change the action url to &#8220;https://www.paypal.com/cgi-bin/webscr&#8221; for live.</p>
<p>API Integration<br />
================<br />
coming soon&#8230;&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.digi-corp.com/2009/11/paypal-shopping-cart-integration-using-html/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Magic of Indexing</title>
		<link>http://dev.digi-corp.com/2009/07/magic-of-indexing/</link>
		<comments>http://dev.digi-corp.com/2009/07/magic-of-indexing/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 13:00:51 +0000</pubDate>
		<dc:creator>divyang.shah</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[indexing]]></category>

		<guid isPermaLink="false">http://dev.digi-corp.com/?p=1039</guid>
		<description><![CDATA[Today I am going to share something I know about indexing. I am sure you all must be using it somewhere or must have heard of it. Let&#8217;s see one wonderful example of its usage today which will show how important it is to use indexes properly in Database. I would like to thank my [...]]]></description>
			<content:encoded><![CDATA[<p>Today I am going to share something I know about indexing. I am sure you all must be using it somewhere or must have heard of it.</p>
<p>Let&#8217;s see one wonderful example of its usage today which will show how important it is to use indexes properly in Database. I would like to thank my client and my mentor Stephen Fegel of <a href="http://galatea.nl" target="_blank">Galatea Systems</a> for imparting this wonderful knowledge.</p>
<p>We all use <em>&#8220;Select&#8221;</em> for retrieving data from the tables. In most cases if data is not too much it takes minimal time to fetch records without indexing also. But in case of large data this may be a severe problem.</p>
<p>Lets take an example:</p>
<p>I have two tables one is <strong><em>houses</em></strong> which is my main table and it has 25,666 records.</p>
<p>And another table is <strong><em>house_desc</em></strong> which has 6,04,255 records.</p>
<p>And the query is</p>
<p style="padding-left: 30px;">SELECT<br />
SQL_NO_CACHE h.*,<br />
(SELECT<br />
SQL_NO_CACHE desc_value<br />
FROM<br />
house_desc AS d<br />
WHERE<br />
language_id = &#8216;EN&#8217;<br />
AND<br />
d.house_id = h.house_id<br />
AND<br />
(<br />
desc_type = &#8216;description&#8217;<br />
OR<br />
desc_type = &#8216;introduction&#8217;<br />
)<br />
ORDER BY desc_type<br />
LIMIT 0 , 1<br />
)<br />
AS<br />
desc_value<br />
FROM<br />
houses AS h<br />
WHERE<br />
house_id<br />
IN (&#8217;12345678&#8242;)</p>
<p>Now lets join both the tables and fire sub query for retrieving data from <strong><em>house_desc</em></strong> table.</p>
<p>Structure of the <strong><em>house_desc</em></strong> is</p>
<p style="padding-left: 30px;">`c_code` varchar(50)<br />
`house_id` int(10)<br />
`country` char(2)<br />
`language_id` enum(&#8216;NL&#8217;,'EN&#8217;,'DE&#8217;,'FR&#8217;,'ES&#8217;,'IT&#8217;)<br />
`desc_type` varchar(50)<br />
`desc_value` longtext</p>
<p>So when I fire the query without indexing and I get following result</p>
<p><strong>Showing rows 0 &#8211; 0 (1 total, Query took 13.0067 sec)<br />
</strong></p>
<p><strong>It returns only 1 row but still it took 13 secs!!</strong></p>
<p>Now just see the magic of indexing here. Just set the index on <strong><em>house_id</em> </strong>field<br />
Fire the same query again and here is the result:</p>
<p><strong>Showing rows 0 &#8211; 0 (1 total, Query took 0.0899 sec)</strong></p>
<p>Output is same but just look at the difference in time to fetch records!</p>
<p><strong>Before indexing it took 13.0067 seconds and after indexing it took 0.0899 seconds i.e. it is 1000 time faster than without indexing. </strong></p>
<p>The result may be different in your case as in sometimes it can be 100 time faster or 10 time faster but one thing is for sure that it will be faster than without indexing (if done correctly!).</p>
<p>When you have large amount of records in your table and you want to search that table then it is better to set index on those fields which are there in where clause.</p>
<p>You can&#8217;t set index on all the fields from table. It is also very important thing on which filed you set the index.</p>
<p>You can read more on indexing from this<br />
<a href="http://www.informit.com/articles/article.aspx?p=377652" target="_blank">http://www.informit.com/articles/article.aspx?p=377652</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dev.digi-corp.com/2009/07/magic-of-indexing/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Create ZIP file archives on the fly-PHP</title>
		<link>http://dev.digi-corp.com/2009/05/create-zip-file-archives-on-the-fly-php/</link>
		<comments>http://dev.digi-corp.com/2009/05/create-zip-file-archives-on-the-fly-php/#comments</comments>
		<pubDate>Sat, 30 May 2009 05:55:50 +0000</pubDate>
		<dc:creator>vidyadhar.yagnik</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://dev.digi-corp.com/?p=388</guid>
		<description><![CDATA[In some website there is need of downloading functionality of multiple files. In that case it is headache for PHP developer that how to give option for download multiple file in single click with lower bandwidth. So, the solution is here: just create zip file containing all the files and give one link for download [...]]]></description>
			<content:encoded><![CDATA[<p>In some website there is need of downloading functionality of multiple files. In that case it is headache for PHP developer that how to give option for download multiple file in single click with lower bandwidth. So, the solution is here: just create zip file containing all the files and give one link for download the zip files.</p>
<p>createZip.inc.php is a class which creates zip file from different files stored on various directories on server and output the necessary request response headers to serve the generated ZIP archive for download.</p>
<p><strong>Example Code Snippet:</strong></p>
<p><code> include_once("createZip.inc.php");<br />
$createZip = new createZip;<br />
$directoryName = "DownloadImages/";</code></p>
<p>$createZip -&gt; addDirectory($directoryName); // Adding Directory to ZIP file</p>
<p>$file1ToZip = “image1.jpeg”; // filename1 which is to be added in zip<br />
$fileContents=file_get_contents($file1ToZip);<br />
$createZipFile-&gt;addFile($fileContents, $directoryName.$file1ToZip);</p>
<p>$file2ToZip = “image2.jpeg”; // filename2 which is to be added in zip<br />
$fileContents=file_get_contents($file2ToZip);<br />
$createZipFile-&gt;addFile($fileContents, $directoryName.$fileToZip);</p>
<p>$outputDir = “./”;<br />
$outputFile = $outputDir.”Images.zip&#8221;; // Zip file name</p>
<p>$fd = fopen ($outputFile, &#8220;wb&#8221;); // Temporary Creating file on disk<br />
$out = fwrite ($fd, $createZip -&gt; getZippedfile()); // Writing zip contents to temporary file<br />
fclose ($fd);</p>
<p>$createZip -&gt; forceDownload($outputFile); // stream the generated ZIP archive for download</p>
<p>@unlink($outputFile); // unlink temporary file</p>
<p>Credits goes to Author of the class: “Rochak Chauhan”<br />
Source: http://www.phpclasses.org/browse/package/2322.html</p>
<p><strong>Author:</strong><br />
Vidyadhar Yagnik<br />
PHP Developer: Digicorp Information Systems Pvt. Ltd.<br />
vidyadhar.yagnik@digi-corp.com</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.digi-corp.com/2009/05/create-zip-file-archives-on-the-fly-php/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Things to take care while developing Arabic Sites and Applications</title>
		<link>http://dev.digi-corp.com/2009/05/things-to-take-care-while-developing-arabic-sites-and-applications/</link>
		<comments>http://dev.digi-corp.com/2009/05/things-to-take-care-while-developing-arabic-sites-and-applications/#comments</comments>
		<pubDate>Tue, 26 May 2009 11:00:49 +0000</pubDate>
		<dc:creator>devdatt.mehta</dc:creator>
				<category><![CDATA[Arabic]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://dev.digi-corp.com/?p=286</guid>
		<description><![CDATA[We are working with clients in Middle East for almost 5 years now and we have learned lot of things about development in Arabic language. Following are some points which will help you in developing any website or application in Arabic. Arabic is written right to left If you are developing it for Kuwait clients [...]]]></description>
			<content:encoded><![CDATA[<p>We are working with clients in Middle East for almost 5 years now and we have learned lot of things about development in Arabic language.</p>
<p>Following are some points which will help you in developing any website or application in Arabic.</p>
<ul>
<li>Arabic is written right to left</li>
<li>If you are developing it for Kuwait clients price should be in KD and with 3 Decimal pleases.</li>
<li>How to display Arabic word in html ? Should I use UTF-8 charset to 	display Arabic in html page ?</li>
</ul>
<p style="padding-left:40px;margin-bottom: 0cm;"><strong> For example =&gt;</strong></p>
<p style="padding-left:45px;margin-bottom: 0cm;">HTML HEAD TAG definition.</p>
<p style="padding-left:45px;margin-bottom: 0cm;">&lt;html xmlns=http://www.w3.org/1999/xhtml&gt;</p>
<p style="padding-left:50px;margin-bottom: 0cm;">&lt;head&gt;</p>
<p style="padding-left:55px;margin-bottom: 0cm;">&lt;meta http-equiv=&#8217;content-type&#8217; content=&#8217;text/html; charset=UTF-8&#8242;&gt;</p>
<p style="padding-left:55px;margin-bottom: 0cm;">&lt;title&gt;<span style="font-family: DejaVu Sans;">الاختبار</span>&lt;/title&gt;</p>
<p style="padding-left:50px;margin-bottom: 0cm;">&lt;/head&gt;</p>
<p style="padding-left:50px;margin-bottom: 0cm;">&lt;body dir=&#8217;rtl&#8217;&gt;</p>
<p style="padding-left:55px;margin-bottom: 0cm;"><span style="font-family: DejaVu Sans;"> الاختبار<br />
</span></p>
<p style="padding-left:50px;margin-bottom: 0cm;">&lt;/body&gt;</p>
<p style="padding-left:45px;margin-bottom: 0cm;">&lt;/html&gt;</p>
<ul>
<li> How to convert direction in html for Arabic ?</li>
</ul>
<p style="padding-left:50px;margin-bottom: 0cm;text-align:justify;">Arabic script is written from right to left direction of the page so to Display Arabic content use dir=&#8217;rtl&#8217; attribute in html tag or direction=&#8217;rtl&#8217;   for css/inline style sheet. It is always right aligned.</p>
<p style="margin-bottom: 0cm;"><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p style="padding-left:50px;margin-bottom: 0cm;"><strong>For example </strong></p>
<p style="padding-left:50px;margin-bottom: 0cm;">&lt;html xmlns=http://www.w3.org/1999/xhtml&gt;</p>
<p style="padding-left:55px;margin-bottom: 0cm;">&lt;head&gt;</p>
<p style="padding-left:60px;margin-bottom: 0cm;">&lt;meta http-equiv=&#8217;content-type&#8217; content=&#8217;text/html; charset=UTF-8&#8242;&gt;</p>
<p style="padding-left:65px;margin-bottom: 0cm;">&lt;title&gt;<span style="font-family: DejaVu Sans;">الاختبار</span>&lt;/title&gt;</p>
<p style="padding-left:55px;margin-bottom: 0cm;">&lt;body dir=&#8217;rtl&#8217;&gt;</p>
<p style="padding-left:60px;margin-bottom: 0cm;">&lt;div style=&#8217;<span class="cssPropName editable">direction</span><span class="cssColon">:</span><span class="cssPropValue editable">rtl</span><span class="cssSemi">;</span>&#8216;&gt;</p>
<p style="padding-left:65px;margin-bottom: 0cm;"><span style="font-family: DejaVu Sans;">الاختبار</span></p>
<p style="padding-left:60px;margin-bottom: 0cm;">&lt;/div&gt;</p>
<p style="padding-left:60px;margin-bottom: 0cm;">&lt;table dir=”rtl”&gt;</p>
<p style="padding-left:65px;margin-bottom: 0cm;">&lt;tr&gt;</p>
<p style="padding-left:70px;margin-bottom: 0cm;">&lt;td align=&#8217;right&#8217;&gt;<span style="font-family: DejaVu Sans;">الاختبار</span>&lt;/td&gt;</p>
<p style="padding-left:65px;margin-bottom: 0cm;">&lt;/tr&gt;</p>
<p style="padding-left:60px;margin-bottom: 0cm;">&lt;/table&gt;</p>
<p style="padding-left:55px;margin-bottom: 0cm;">&lt;/body&gt;</p>
<p style="padding-left:50px;margin-bottom: 0cm;">&lt;/html&gt;</p>
<p style="margin-bottom: 0cm;"><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<ul>
<li>Which format of Arabic words are displayed properly and in readable format ?</li>
</ul>
<p><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p style="padding-left:50px;margin-bottom: 0cm;">Use Font to display Arabic words in “Tahoma: font size 12”.</p>
<p style="margin-bottom: 0cm;"><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p style="padding-left:50px;margin-bottom: 0cm;"><strong>For example </strong></p>
<p style="padding-left:55px;margin-bottom: 0cm;">&lt;html xmlns=http://www.w3.org/1999/xhtml&gt;</p>
<p style="padding-left:60px;margin-bottom: 0cm;">&lt;head&gt;</p>
<p style="padding-left:65px;margin-bottom: 0cm;">&lt;meta http-equiv=&#8217;content-type&#8217; content=&#8217;text/html; charset=UTF-8&#8242;&gt;</p>
<p style="padding-left:60px;margin-bottom: 0cm;">&lt;title&gt;<span style="font-family: DejaVu Sans;">الاختبار</span>&lt;/title&gt;</p>
<p style="padding-left:60px;margin-bottom: 0cm;">&lt;body dir=”rtl” style=”font-size:12px;font-family:Tahoma,Arial;”&gt;</p>
<p style="padding-left:65px;margin-bottom: 0cm;">&lt;div style=”direction:rtl;text-align:right;”&gt;<span style="font-family: DejaVu Sans;">الاختبار</span>&lt;/div&gt;</p>
<p style="padding-left:60px;margin-bottom: 0cm;">&lt;/body&gt;</p>
<p style="padding-left:55px;margin-bottom: 0cm;">&lt;/html&gt;</p>
<p><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<ul>
<li>How to save Arabic data in MySQL or database ?</li>
</ul>
<p><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p style="padding-left:50px;margin-bottom: 0cm;">Use following step to insert, save and retrieve Arabic data.</p>
<p style="padding-left:50px;margin-bottom: 0cm;"><strong>Step &#8211; 1</strong> Table <strong>collection</strong> should be in “utf8_unicode_ci”</p>
<p style="padding-left:50px;margin-bottom: 0cm;"><strong>Step &#8211; 2</strong> Field <strong>collection</strong> should be in “utf8_unicode_ci”</p>
<p style="padding-left:50px;margin-bottom: 0cm;"><strong>Step &#8211; 3</strong> Use following code after connection with database. it will</p>
<p style="padding-left:60px;margin-bottom: 0cm;">set MySQL server in “utf8 character set”.</p>
<p style="padding-left:60px;margin-bottom: 0cm;"><strong>mysql_query(&#8220;SET NAMES &#8216;utf8&#8242;&#8221;); </strong></p>
<p style="padding-left:50px;margin-bottom: 0cm;">For Ref:<a href="http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html">http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html</a></p>
<p style="margin-bottom: 0cm;"><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<ul>
<li>
<p style="margin-bottom: 0cm;">How to search Arabic word in php 	scripts?</p>
<p style="margin-bottom: 0cm;">or</p>
<p style="margin-bottom: 0cm;">How to develop Arabic search 	functionality in php scripts ?</p>
</li>
</ul>
<p><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p style="padding-left:50px;margin-bottom: 0cm;">If you are not storing data in UTF-8 then you must use “urlencode” and   “urldecode” function</p>
<p style="padding-left:50px;margin-bottom: 0cm;"><strong>For example </strong></p>
<p style="padding-left:60px;margin-bottom: 0cm;"><strong>At the time of request.</strong></p>
<p style="padding-left:65px;margin-bottom: 0cm;">$keyword = urldecode($_POST['keyword']);</p>
<p style="padding-left:65px;margin-bottom: 0cm;">SELECT * FROM &lt;table_name&gt; WHERE &lt;Field Name&gt; LIKE &#8216;%$keyword%&#8217;</p>
<p style="padding-left:60px;margin-bottom: 0cm;"><strong>At the time of redirect.</strong></p>
<p style="padding-left:65px;margin-bottom: 0cm;">$keyword = urlencode($keyword);</p>
<p style="margin-bottom: 0cm;"><strong> </strong></p>
<p style="padding-left:65px;margin-bottom: 0cm;"><strong>header(&#8216;location: file.php?keyword=$keyword&#8217;); </strong></p>
<p style="padding-left:70px;margin-bottom: 0cm;">or</p>
<p style="padding-left:65px;margin-bottom: 0cm;">&lt;script type=&#8217;text/javascript&#8217;&gt;</p>
<p style="padding-left:70px;margin-bottom: 0cm;">window.location.href = “file.php?keyword=&lt;?=$keyword?&gt;”;</p>
<p style="padding-left:65px;margin-bottom: 0cm;">&lt;/script&gt;</p>
<p style="margin-bottom: 0cm;"><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<ul>
<li>Suggestion for multi language application setup</li>
</ul>
<p style="margin-bottom: 0cm;"><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p style="padding-left:50px;margin-bottom: 0cm;">For example English and Arabic</p>
<p style="padding-left:60px;margin-bottom: 0cm;"><strong>1</strong>.  Use prefix/LANG_CODE &#8220;ar_&#8221; and &#8220;en_&#8221; concat with field name.&lt;/</p>
<p style="margin-bottom: 0cm;"> </p>
<p style="padding-left:60px;margin-bottom: 0cm;"><strong>2</strong>.  Query format</p>
<p style="padding-left:80px;margin-bottom: 0cm;">SELECT LANG_CODE.&#8221;field1&#8243;, LANG_CODE.&#8221;field2&#8243;,&#8230;.</p>
<p style="padding-left:60px;margin-bottom: 0cm;"><strong>3</strong> Multi language application folder structure. It is better that you should store css and images in different folder.</p>
<p style="padding-left:65px;margin-bottom: 0cm;"><strong>For example </strong></p>
<p style="padding-left:65px;margin-bottom: 0cm;">Folder Structure</p>
<p style="padding-left:65px;margin-bottom: 0cm;">-CSS_EN</p>
<p style="padding-left:70px;margin-bottom: 0cm;">-CSS_AR</p>
<p style="padding-left:70px;margin-bottom: 0cm;">-IMAGES_EN</p>
<p style="padding-left:70px;margin-bottom: 0cm;">-IMAGES_AR</p>
<p style="padding-left:60px;margin-bottom: 0cm;"><strong>4</strong>. Words module</p>
<p style="padding-left:70px;margin-bottom: 0cm;">- Give rights  to administrator to edit Arabic and English word to rectify any mistake, if any.</p>
<p style="padding-left:70px;margin-bottom: 0cm;">- For retrieve data rapidly must store all Arabic and English word in  .xml file.</p>
<p style="padding-left:70px;margin-bottom: 0cm;"><strong>For example </strong></p>
<p style="padding-left:70px;margin-bottom: 0cm;">&lt;?xml version=&#8217;1.0&#8242; encoding=&#8217;UTF-8&#8242;?&gt;</p>
<p style="padding-left:70px;margin-bottom: 0cm;">&lt;lang&gt;</p>
<p style="padding-left:75px;margin-bottom: 0cm;">&lt;words&gt;</p>
<p style="padding-left:80px;margin-bottom: 0cm;">&lt;word  id=&#8221;1&#8243; english=&#8221;Sign In&#8221; arabic=&#8221;<span style="font-family: DejaVu Sans;">تسجيل</span>&#8220;&gt;&lt;/word&gt;</p>
<p style="padding-left:75px;margin-bottom: 0cm;">&lt;/words&gt;</p>
<p style="padding-left:70px;margin-bottom: 0cm;">&lt;/lang&gt;</p>
<p style="padding-left:70px;margin-bottom: 0cm;">Create PHP constant file for words.</p>
<p style="padding-left:75px;margin-bottom: 0cm;">ar_words.php</p>
<p style="padding-left:80px;margin-bottom: 0cm;">&lt;?php</p>
<p style="padding-left:85px;margin-bottom: 0cm;"><span style="font-size: x-small;">define(SIGNIN,trim(str_replace(&#8216;#&#8217;,'&amp;#&#8217;,$p-&gt;output['0']['child'][0]['child'][3]['attrs']['ARABIC'])),&#8221; &#8220;); </span></p>
<p style="padding-left:75px;margin-bottom: 0cm;">?&gt;</p>
<p style="padding-left:75px;margin-bottom: 0cm;">en_words.php</p>
<p style="padding-left:75px;margin-bottom: 0cm;">&lt;?php</p>
<p style="padding-left:80px;margin-bottom: 0cm;"><span style="font-size: x-small;">define(SIGNIN,$p-&gt;output['0']['child'][0]['child'][3]['attrs']['ENGLISH']); </span></p>
<p style="padding-left:75px;margin-bottom: 0cm;">?&gt;</p>
<p>Let us know if you feel some important points are missing here.</p>
<p> </p>
<p style="margin-bottom: 0cm;"> </p>
]]></content:encoded>
			<wfw:commentRss>http://dev.digi-corp.com/2009/05/things-to-take-care-while-developing-arabic-sites-and-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Install and Configure MySql, Apache2, PHP, ffmpeg on Fedora Linux</title>
		<link>http://dev.digi-corp.com/2009/05/how-to-install-mysql-apache2-php-ffmpeg-on-fedora-linux/</link>
		<comments>http://dev.digi-corp.com/2009/05/how-to-install-mysql-apache2-php-ffmpeg-on-fedora-linux/#comments</comments>
		<pubDate>Tue, 26 May 2009 10:26:09 +0000</pubDate>
		<dc:creator>bhumish.shah</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Apache2]]></category>
		<category><![CDATA[Fedora Linux]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://dev.digi-corp.com/?p=278</guid>
		<description><![CDATA[Following Are The Steps for MySql Server Installation 1. To download MySql Source Go To Below link Note: There Are 2 Versions Available For MySql 1) Community Edition: (It’s a Free Edition) 2) Enterprise Edition: (You Have To Purchase License For MySql) http://dev.mysql.com/downloads/ 2. In This Example We Are Going To Install Mysql-communitiry Edition Rpm [...]]]></description>
			<content:encoded><![CDATA[<p><!--[if gte mso 9]&gt;  Normal 0   false false false        MicrosoftInternetExplorer4  &lt;![endif]--><!--[if gte mso 9]&gt;   &lt;![endif]--></p>
<h2 class="MsoNormal"><strong><span style="font-size: 16pt;"> </span></strong><strong>Following Are The Steps for MySql Server Installation </strong></h2>
<p class="MsoNormal"><strong><span style="text-decoration: underline;"><span style="text-decoration: none;"> </span></span></strong></p>
<h4 class="MsoNormal">1. To download MySql Source Go To Below link</h4>
<p class="MsoNormal">Note: There Are 2 Versions Available For MySql</p>
<p class="MsoNormal">1) Community Edition: (It’s a Free Edition)</p>
<p class="MsoNormal">2) Enterprise Edition: (You Have To Purchase License For MySql)</p>
<p class="MsoNormal"><a href="http://dev.mysql.com/downloads/">http://dev.mysql.com/downloads/</a></p>
<h4 class="MsoNormal"><strong>2. In This Example We Are Going To Install Mysql-communitiry Edition</strong></h4>
<p class="MsoNormal">Rpm Package for <strong>MySql MySQL-server-community-5.1.34-0.rhel5.i386.rpm</strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><span> </span>Note:<span> </span>For Example if you are Using Fedora, Redhat, CentOS, Then You Have to Download <strong>RPM</strong> Package .<span> </span></p>
<p class="MsoNormal">If You Are Using Debian, Ubuntu Then You have to download <strong>deb</strong> Package</p>
<h4 class="MsoNormal"><strong>3. For Mysql-Server Installation Type the Following Command on Terminal</strong></h4>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>rpm -ivh<span> </span>MySQL-server-community-5.1.34-0.rhel5.i386.rpm</strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal">You Can Also Install MySql Server on Server Using the Following command</p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>yum install mysql-server</strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal">To start Mysql Automatically After System Reboot</p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>chkconfig mysqld on</strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal">To Check Whether mysql Server is Installed or Not</p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>rpm -q mysql</strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal">This command Give the Output of Mysql Installed Version on Server</p>
<p class="MsoNormal">To Restart, Stop, Start Mysql Use the Following Command</p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>/etc/init.d/mysqld restart</strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>/etc/init.d/mysqld stop</strong></p>
<p class="MsoNormal" style="padding-left: 30px;"><strong> </strong></p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>/etc/init.d/mysqld start </strong></p>
<h4 class="MsoNormal"><strong>4. For MySql Administration you have to install Mysql-administrator And MySql-Query-Browser</strong></h4>
<p class="MsoNormal">To Do This</p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>Yum install mysql-Query-browser</strong></p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>Yum install mysql-administrator</strong></p>
<p class="MsoNormal" style="padding-left: 30px;"><strong><br />
</strong></p>
<h2 class="MsoNormal"><strong>How to Install Apache2 on Linux Server ?</strong></h2>
<p class="MsoNormal">1. Apache2 Is Installed by Default in Many Version of Linux If You Select WebServer Option during Your Linux Server Installation</p>
<p class="MsoNormal">
<p class="MsoNormal">2. You Can Also Manually Install Apache2 using Following RPMS on your Linux distribution CD</p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>rpm -ivh httpd</strong></p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>rpm -ivh httpd-devel</strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal">3. To Install Apache2 with Yum Type The Following Command</p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>Yum install httpd</strong></p>
<p class="MsoNormal">To check whether apache2 is installed or not</p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>rpm -q httpd</strong></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal">To Start Apache2 When System boots</p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>Chkconfig httpd on</strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal">To Restart , Stop , Start apache2 Use The Following command</p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>/etc/init.d/httpd restart</strong></p>
<p class="MsoNormal" style="padding-left: 30px;"><strong> </strong></p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>/etc/init.d/httpd stop</strong></p>
<p class="MsoNormal" style="padding-left: 30px;"><strong> </strong></p>
<p class="MsoNormal" style="padding-left: 30px;"><strong>/etc/init.d/httpd start</strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong><span style="text-decoration: underline;">Note: /var/www/html/ is Root Folder for Apache2.<span> </span>You have To Put Your Application In /var/root/html/ Folder To Run Your Site </span></strong></p>
<p class="MsoNormal"><strong><span style="text-decoration: underline;"><br />
</span></strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<h2 class="MsoNormal"><strong>How to Install PHP on Linux Server ? </strong></h2>
<p class="MsoNormal"><strong><span style="text-decoration: underline;"><span style="text-decoration: none;"> </span></span></strong></p>
<p class="MsoNormal">PHP Is Installed By Default In Many Linux Edition. To Install PHP Type The Following Command</p>
<p class="MsoNormal">
<p class="MsoNormal">1. Yum install php</p>
<p class="MsoNormal">
<p class="MsoNormal"><span style="text-decoration: underline;">Note : php.ini File Is Located On /etc/<span> </span>Folder .</span></p>
<p class="MsoNormal"><strong><span style="text-decoration: underline;"><br />
</span></strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong> </strong></p>
<h2 class="MsoNormal"><strong>How to Install FFMPEG on Linux Server ?</strong></h2>
<p class="MsoNormal"><strong><span style="text-decoration: none;"> </span></strong></p>
<p class="MsoNormal"><strong><span style="text-decoration: none;"> </span></strong></p>
<p class="MsoNormal">1. Install PHP, necessary extensions and supporting software.</p>
<p class="MsoNormal">Open Terminal &amp; Type the Following Command</p>
<p class="MsoNormal">2. Yum -y install php-devel php-gd php-mbstring gcc gcc-c++ libtool svn git yasm gsm-devel libogg-devel libvorbis-devel libtheora-devel;</p>
<p class="MsoNormal">3. wget http://downloads.sourceforge.net/ffmpeg-php/ffmpeg-php-0.5.3.1.tbz2; \</p>
<p class="MsoNormal">4. tar -jxvf ffmpeg-php-0.5.3.1.tbz2; \</p>
<p class="MsoNormal">5. cd ffmpeg-php-0.5.3.1; \</p>
<p class="MsoNormal">6. phpize; \</p>
<p class="MsoNormal">7  ./configure &#8211;prefix=/usr; \</p>
<p class="MsoNormal">8. make; \</p>
<p class="MsoNormal">9. make install; \</p>
<p class="MsoNormal">10. cd ..;</p>
<p class="MsoNormal">11. add ffmpeg.so extension to php.ini file</p>
<p class="MsoNormal" style="padding-left: 30px;">Extension=ffmpeg.so</p>
<p class="MsoNormal">12. Restart httpd Service</p>
<p class="MsoNormal" style="padding-left: 30px;">/etc/init.d/httpd restart</p>
<p class="MsoNormal">13. To Verify ffmpeg Installation run phpinfo file on server &amp; Find ffmpeg Entry</p>
<p class="MsoNormal">14. To download ffmpeg php Extension Go to Below Link</p>
<p class="MsoNormal"><a href="http://sourceforge.net/projects/ffmpeg-php/" target="_blank">http://sourceforge.net/projects/ffmpeg-php/</a></p>
<p class="MsoNormal">open above link and click in Download ffmpeg-php -0.6.0</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.digi-corp.com/2009/05/how-to-install-mysql-apache2-php-ffmpeg-on-fedora-linux/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Prevention of Sql Injection with PHP</title>
		<link>http://dev.digi-corp.com/2009/05/prevention-of-sql-injection-with-php/</link>
		<comments>http://dev.digi-corp.com/2009/05/prevention-of-sql-injection-with-php/#comments</comments>
		<pubDate>Fri, 22 May 2009 10:03:21 +0000</pubDate>
		<dc:creator>divyang.shah</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[prevention]]></category>
		<category><![CDATA[SQL Injection]]></category>

		<guid isPermaLink="false">http://dev.digi-corp.com/?p=269</guid>
		<description><![CDATA[Preventing SQL injection attack is becoming a headache now a days for many application developers and especially for web application developers. Lets explore a scenario where SQL Injection attack is most common and how we can avoid that. We generally have a login screen with username and password in almost every web application. Assume that [...]]]></description>
			<content:encoded><![CDATA[<p>Preventing SQL injection attack is becoming a headache now a days for many application developers and especially for web application developers. Lets explore a scenario where SQL Injection attack is most common and how we can avoid that.</p>
<p>We generally have a login screen with username and password in almost every web application.</p>
<p>Assume that attacker passes values like following:</p>
<p>user name = a&#8217; or &#8216;t&#8217;='t<br />
pass =  a&#8217; or &#8216;t&#8217;='t</p>
<p>Generally we have query like following:<br />
<span style="color: #3366ff;"><strong>&#8220;select * from admin where name = &#8216;&#8221;.$_POST['user_name'].&#8221;&#8216; and psw = &#8216;&#8221;.$_POST['pass'].&#8221;&#8216;&#8221;;</strong></span></p>
<p>So after passing the value it will look like:<br />
<span style="color: #3366ff;"><strong>select * from admin where name = &#8216;a&#8217; OR &#8216;t&#8217;='t&#8217; and psw = &#8216;a&#8217; OR &#8216;t&#8217;='t&#8217;;<br />
</strong></span><br />
If you see properly this will go true and return the first record of the database and set that into session for login and user will be in your system!! It&#8217;s so easy, isn&#8217;t  it?</p>
<p>To avoid this embarrassing situation there are many ways:</p>
<p><span style="color: #ff00ff;"><strong>1)</strong></span> You can set ON magic quotes of your server. It is same as addslashes() function. It will be there in your php.ini file.</p>
<p><span style="color: #ff0000;">(NOTE : This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.)</span></p>
<p><span style="color: #ff00ff;"><strong>2)</strong></span> You can manually addslashes like following</p>
<p><span style="color: #3366ff;">$user_name = addslashes($_POST['user_name']);<br />
$pass = addslashes($_POST['pass']);</span></p>
<p>and then pass these parameters into query like this<br />
<strong><span style="color: #3366ff;">&#8220;select * from admin where name = &#8216;&#8221;.$user_name.&#8221;&#8216; and psw = &#8216;&#8221;.$pass.&#8221;&#8216;&#8221;;</span></strong></p>
<p>so now it will look something like this<br />
<span style="color: #3366ff;"><strong>select * from admin where name = &#8216;a&#8217; OR &#8216;t&#8217;='t&#8217; and psw = &#8216;a&#8217; OR &#8216;t&#8217;='t&#8217;;</strong></span></p>
<p>so now it will match whole word (a&#8217; OR &#8216;t&#8217;='t) with database and will return empty result set.</p>
<p><span style="color: #ff00ff;"><strong>3)</strong></span> If you want to do it in one query then use mysql_real_escape_string.<br />
<span style="color: #3366ff;"><strong>&#8220;select * from tbladmin where name = &#8216;&#8221;.mysql_escape_string($_POST['username']).&#8221;&#8216; and psw = &#8216;&#8221;.mysql_escape_string($_POST['pass']).&#8221;&#8216;&#8221;;</strong></span></p>
<p><span style="color: #000000;">mysql_escape_string is more appropriate then addslashes().</span></p>
<p><span style="color: #000000;">you can read that thing here</span></p>
<p><span style="color: #3366ff;"><span style="color: #000000;"><a rel="nofollow" href="http://shiflett.org/blog/2006/jan/addslashes-versus-mysql-real-escape-string" target="_blank">http://shiflett.org/blog/2006/jan/addslashes-versus-mysql-re&#8230;</a></span></span></p>
<p>This will also provide the same result as point 2.</p>
<p><strong><span style="color: #ff00ff;">4) </span></strong><span style="color: #ff00ff;"><span style="color: #000000;">Another and</span></span><strong><span style="color: #ff00ff;"> </span></strong><span style="color: #ff00ff;"><span style="color: #000000;">best solution is</span></span><strong><span style="color: #ff00ff;"> </span><span class="comment"><span style="color: #000000;">Prepared Statements.</span></span></strong></p>
<p>Prepared statements can help increase security by separating SQL logic from the data being supplied. This separation of logic and data can help prevent SQL injection attack.</p>
<pre><span style="color: #00ccff;"><span style="color: #3366ff;"><strong>mysql&gt; PREPARE stmt_name FROM "SELECT name FROM Country WHERE code = ?";
//Statement prepared

mysql&gt; SET @test_parm = "FIN";
// set the parameter

mysql&gt; EXECUTE stmt_name USING @test_parm;
+---------+
| Name    |
+---------+
| Finland |
+---------+

mysql&gt; DEALLOCATE PREPARE stmt_name;

Read more about prepared statement from this
</strong></span></span><a href="http://dev.mysql.com/tech-resources/articles/4.1/prepared-statements.html" target="_blank">http://dev.mysql.com/tech-resources/articles/4.1/prepared-statements.html</a></pre>
<p><span style="color: #ff00ff;"><strong>5)</strong></span> If you don&#8217;t want to use any of the functions then you can break your query in 2 steps like this</p>
<p><span style="color: #3366ff;"><strong>&#8220;select * from admin where name = &#8216;&#8221;.$_POST['user_name'].&#8221;&#8216;&#8221;;</strong></span></p>
<p>So from this you will get first record from the database. Now check $_POST['pass'] with obtain result.</p>
<p>Like you store the query result into $result variable. So in $result[0]['pass'] you will get original password. So now check<br />
<span style="color: #3366ff;"><strong>if($result[0]['pass'] == $_POST['pass'])</strong></span></p>
<p>And then do the remaining process.</p>
<p>So by using any of the above steps you can avoid Sql Injection in your login form.</p>
<p>But the best way is to use point 2 and 3 and 4 because if hacker enters <span style="color: #3366ff;"><strong>a&#8217;;drop table users; select * from data where name like &#8216;%</strong></span><br />
in user name field then it will look something like this</p>
<p><strong><span style="color: #3366ff;">select * from users where name = &#8216;a&#8217;;drop table users; select * from data where name like &#8216;%&#8217;;</span></strong></p>
<p>and it will fire 3 queries at same time and it will drop your users table.</p>
<p>1st, 2nd 3rd and 4th points had good results but as you can see the note in 1st point and 3rd point has more advantage then 2nd point. So the 3rd and 4th points are best solution and for more security purpose you can use 3rd or 4th point together.</p>
<p>Like<br />
<span style="color: #3366ff;"><strong>$format=&#8221;select * from users where `user_password` = &#8216;%s&#8217; and `user_name` = %s<br />
$query=sprintf($format,mysql_real_escape_string($password), mysql_real_escape_string($user_name) );<br />
</strong></span></p>
<p>Good practice is to use use 3rd or 4th point.</p>
<p>Same way you can use this method at any of the user input forms like in user registration or in add product form. Any of the place where you are taking input from user side you have to check the data first and then store that data into database. And same way you can use the htmlentities() function to avoid html code.</p>
<p>Do you know any more methods using which we can prevent it? Let us know.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.digi-corp.com/2009/05/prevention-of-sql-injection-with-php/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>How to integrate Uber uploader in CakePHP</title>
		<link>http://dev.digi-corp.com/2009/05/how-to-integrate-uber-uploader-in-cakephp/</link>
		<comments>http://dev.digi-corp.com/2009/05/how-to-integrate-uber-uploader-in-cakephp/#comments</comments>
		<pubDate>Sun, 03 May 2009 05:54:57 +0000</pubDate>
		<dc:creator>nayan.lodha</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[File Uploading in cakePHP]]></category>
		<category><![CDATA[How to integrate uber uploader in cakePHP]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[programs written in Perl-PHP and Javascript]]></category>
		<category><![CDATA[uber uploader in cakePHP]]></category>
		<category><![CDATA[Uber Uploader steps in cakePHP]]></category>
		<category><![CDATA[Uber-Uploader]]></category>
		<category><![CDATA[upload large files in cakphp]]></category>
		<category><![CDATA[web-development]]></category>

		<guid isPermaLink="false">http://dev.digi-corp.com/?p=143</guid>
		<description><![CDATA[How to integrate uber uploader in cakePHP]]></description>
			<content:encoded><![CDATA[<h3 class="heading"><span>Uber-Uploader</span></h3>
<p>Uber-Uploader is a group of programs written in <a href="http://www.perl.org/" mce_href="http://www.perl.org/" target="_blank"><span class="wikilink">Perl</span></a>, <a title="php" href="http://www.php.net/" mce_href="http://www.php.net/" target="_blank"><span class="wikilink"><span class="caps">PHP</span></span></a> and <a href="http://www.javascript.com/" mce_href="http://www.javascript.com/" target="_blank"><span class="wikilink">Javascript</span></a>. It is intended to present a graphical representation of the status of a web based file upload in the form of a progress bar.</p>
<h4>External Links</h4>
<ul>
<li><a rel="nofollow" href="http://sourceforge.net/project/showfiles.php?group_id=148921&amp;package_id=164322" mce_href="http://sourceforge.net/project/showfiles.php?group_id=148921&amp;package_id=164322">Downloads</a></li>
</ul>
<h3>CakePHP</h3>
<p><a href="http://www.cakephp.org/" mce_href="http://www.cakephp.org/">CakePHP</a> is a <a href="http://en.wikipedia.org/wiki/MIT_License" mce_href="http://en.wikipedia.org/wiki/MIT_License">free</a>, <a title="What is open-source?" href="http://en.wikipedia.org/wiki/Open_source" mce_href="http://en.wikipedia.org/wiki/Open_source">open-source</a>, <a title="What is rapid development?" href="http://en.wikipedia.org/wiki/Rapid_application_development" mce_href="http://en.wikipedia.org/wiki/Rapid_application_development">rapid development</a> <a title="What is a framework?" href="http://en.wikipedia.org/wiki/Application_framework" mce_href="http://en.wikipedia.org/wiki/Application_framework">framework</a> for <a title="Hypertext Preprocessor" href="http://www.php.net/" mce_href="http://www.php.net/">PHP</a>. It’s a foundational structure for programmers to create web applications. Our primary goal is to enable you to work in a structured and rapid manner–without loss of flexibility.</p>
<p>CakePHP takes the monotony out of web development. We provide you with all the tools you need to get started coding what you really need to get done: the logic specific to your application. Instead of reinventing the wheel every time you sit down to a new project, check out a copy of CakePHP and get started with the real guts of your application.</p>
<h4>Why We Need To Integrate CakePHP With Uber-Uploader</h4>
<p>As mention above&nbsp; Uber-Uploader is a group of programs written in <a href="http://www.perl.org/" mce_href="http://www.perl.org/" target="_blank"><span class="wikilink">Perl</span></a>, <a title="php" href="http://www.php.net/" mce_href="http://www.php.net/" target="_blank"><span class="wikilink"><span class="caps">PHP</span></span></a> and <a href="http://www.javascript.com/" mce_href="http://www.javascript.com/" target="_blank"><span class="wikilink">Javascript</span></a>.It is used to upload large volume video files.It also provide a very good GUI as progress bar and show some&nbsp; informaton like Elapsed Time ,Est Time Left ,Percent Complete etc that helps user to keep patience while upload a large volum files.</p>
<p>Here is the some steps How to integrate uber uploader in cakePHP</p>
<p>1.Create a folder in Webroot/files and put all files in that folder<br />
eg. i created &#8216;uploder&#8217; in webroot/files than i created &#8216;html&#8217; folder in &#8216;uploder&#8217; folder</p>
<p>2.Set the $TEMP_DIR value in &#8216;ubr_upload.pl&#8217; AND &#8216;ubr_ini.php&#8217;.<br />
eg. $TEMP_DIR = &#8216;/xyz.com/html/tmp/ubr_temp/&#8217;;<br />
eg. $TEMP_DIR = &#8216;/var/tmp/ubr_temp/&#8217;;<br />
eg. $TEMP_DIR = &#8216;/usr/home/roger/ubr_temp/&#8217;;</p>
<p>3.Set the $_CONFIG['upload_dir'] value in &#8216;ubr_default_config.php&#8217;. It should be physical path<br />
eg. $_CONFIG['upload_dir'] = &#8216;/XYZ.com/app/webroot/files/uploader/html/tmp/ubr_uploads&#8217;;<br />
eg. $_CONFIG['upload_dir'] = &#8216;/var/www/html/ubr_uploads/&#8217;;<br />
eg. $_CONFIG['upload_dir'] = &#8216;/usr/local/www/htdocs/ubr_uploads/&#8217;;<br />
eg. $_CONFIG['upload_dir'] = $ENV{&#8216;DOCUMENT_ROOT&#8217;} . &#8216;/ubr_uploads/&#8217;;</p>
<p>4.Set the correct path values for the scripts in &#8216;ubr_ini.php&#8217;.<br />
eg. PATH_TO_UPLOAD_SCRIPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = &#8216;../app/webroot/files/uploader/html/cgi-bin/ubr_upload.pl&#8217;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Path info<br />
PATH_TO_LINK_SCRIPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = &#8216;../app/webroot/files/uploader/html/ubr_link_upload.php&#8217;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Path info<br />
PATH_TO_SET_PROGRESS_SCRIPT = &#8216;../app/webroot/files/uploader/html/ubr_set_progress.php&#8217;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Path info<br />
PATH_TO_GET_PROGRESS_SCRIPT = &#8216;../app/webroot/files/uploader/html/ubr_get_progress.php&#8217;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Path info<br />
PATH_TO_JS_SCRIPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = &#8216;../app/webroot/files/uploader/html/ubr_file_upload.js&#8217;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Path info<br />
PATH_TO_JQUERY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = &#8216;../app/webroot/files/uploader/html/jquery-1.3.1.min.js&#8217;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Path Info<br />
PATH_TO_CSS_FILE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = &#8216;../app/webroot/files/uploader/html/ubr.css&#8217;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Path info<br />
DEFAULT_CONFIG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = &#8216;/XYZ.com/app/webroot/files/uploader/html/ubr_default_config.php&#8217;;&nbsp;&nbsp;&nbsp;&nbsp; // Path info</p>
<p>5.Make ubr_pload.pl executable with the command chmod 755 ubr_pload.pl</p>
<p>6.Set the correct path for $_CONFIG['redirect_url']&nbsp; in &#8216;ubr_default_config.php&#8217;</p>
<p>7.Set the correct path for $_CONFIG['path_to_upload'] and $_CONFIG['upload_dir'] in &#8216;ubr_default_config.php&#8217;.It is the Directory where the video get uplaod<br />
eg. /home/xyz.com/app/webroot/files/uploader/html/tmp/ubr_uploads/</p>
<p>8.Make sure that both path ($_CONFIG['path_to_upload'] and $_CONFIG['upload_dir']) should be same.</p>
<p>9 Make sure that path for $TEMP_DIR in ubr_upload.pl should be same to $TEMP_DIR value in &#8216;ubr_ini.php</p>
<p>10.Now Create a action in controller and include the following code<br />
eg&nbsp; action &#8220;uploadvideo&#8221; in videos_controller</p>
<p>$this-&gt;set(&#8220;DEBUG_AJAX&#8221;,$DEBUG_AJAX);<br />
$this-&gt;set(&#8220;PATH_TO_UPLOAD_SCRIPT&#8221;,$PATH_TO_UPLOAD_SCRIPT);</p>
<p>$this-&gt;set(&#8220;PATH_TO_JQUERY&#8221;,$PATH_TO_JQUERY);<br />
$this-&gt;set(&#8220;PATH_TO_GET_PROGRESS_SCRIPT&#8221;,$PATH_TO_GET_PROGRESS_SCRIPT);<br />
$this-&gt;set(&#8220;PATH_TO_SET_PROGRESS_SCRIPT&#8221;,$PATH_TO_SET_PROGRESS_SCRIPT);<br />
$this-&gt;set(&#8220;PATH_TO_CSS_FILE&#8221;,$PATH_TO_CSS_FILE);<br />
$this-&gt;set(&#8220;DEFAULT_CONFIG&#8221;,$DEFAULT_CONFIG);<br />
$this-&gt;set(&#8220;MULTI_CONFIGS_ENABLED&#8221;,$MULTI_CONFIGS_ENABLED);<br />
$this-&gt;set(&#8220;PATH_TO_LINK_SCRIPT&#8221;,$PATH_TO_LINK_SCRIPT);<br />
$this-&gt;set(&#8220;PATH_TO_JS_SCRIPT&#8221;,$PATH_TO_JS_SCRIPT);<br />
$this-&gt;set(&#8220;_CONFIG&#8221;,$_CONFIG);</p>
<p>$this-&gt;set(&#8220;CGI_UPLOAD_HOOK&#8221;,$CGI_UPLOAD_HOOK);<br />
$this-&gt;set(&#8220;GET_PROGRESS_SPEED&#8221;,$GET_PROGRESS_SPEED);</p>
<p>$this-&gt;set(&#8220;DELETE_LINK_FILE&#8221;,$DELETE_LINK_FILE);<br />
if($PHP_ERROR_REPORTING){ error_reporting(E_ALL); }</p>
<p>header(&#8216;Content-type: text/html; charset=UTF-8&#8242;);<br />
header(&#8216;Expires: Mon, 26 Jul 1997 05:00:00 GMT&#8217;);<br />
header(&#8216;Last-Modified: &#8216; . date(&#8216;r&#8217;));<br />
header(&#8216;Cache-Control: no-store, no-cache, must-revalidate&#8217;);<br />
header(&#8216;Cache-Control: post-check=0, pre-check=0&#8242;, FALSE);<br />
header(&#8216;Pragma: no-cache&#8217;);</p>
<p>//Set config file<br />
if($MULTI_CONFIGS_ENABLED){<br />
// Put your multi config file code here<br />
$config_file = &#8216;ubr_default_config.php&#8217;;<br />
}<br />
else{ $config_file = $DEFAULT_CONFIG; }</p>
<p>// Load config file<br />
require $config_file;<br />
//***************************************************************************************************************<br />
// The following possible query string formats are assumed<br />
//<br />
// 1. No query string<br />
// 2. ?about=1<br />
//***************************************************************************************************************<br />
if($DEBUG_PHP){ phpinfo(); exit(); }<br />
elseif($DEBUG_CONFIG){ debug1($_CONFIG['config_file_name'], $_CONFIG); exit(); }<br />
elseif(isset($_GET['about']) &amp;&amp; $_GET['about'] == 1){<br />
kak(&#8220;&lt;u&gt;&lt;b&gt;UBER UPLOADER FILE UPLOAD&lt;/b&gt;&lt;/u&gt;&lt;br&gt;UBER UPLOADER VERSION =&nbsp; &lt;b&gt;&#8221; . $UBER_VERSION . &#8220;&lt;/b&gt;&lt;br&gt;UBR_FILE_UPLOAD = &lt;b&gt;&#8221; . $THIS_VERSION . &#8220;&lt;/b&gt;&lt;br&gt;\n&#8221;, 1, __LINE__);<br />
}</p>
<p>11. Now put the following code in CTP file(&#8220;uploadvideo.ctp&#8221; )</p>
<p>&lt;style&gt;<br />
.debug {font:16px Arial; background-color:#FFFFFF; border:1px solid #898989; width:700px; height:100px; overflow:auto;}<br />
.alert {font:18px Arial;}<br />
.data {background-color:#b3b3b3; border:1px solid #898989; width:350px;}<br />
.data tr td {background-color:#dddddd; font:13px Arial; width:35%;}<br />
.bar1 {background-color:#b3b3b3; position:relative; text-align:left; height:20px; width:&lt;?php print $_CONFIG['progress_bar_width']; ?&gt;px; border:1px solid #505050;}<br />
.bar2 {background-color:#000099; position:relative; text-align:left; height:20px; width:0%;}<br />
&lt;/style&gt;<br />
&lt;script language=&#8221;JavaScript&#8221; type=&#8221;text/JavaScript&#8221; src=&#8221;../app/webroot/files/uploader/html/jquery-1.3.1.min.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script language=&#8221;javascript&#8221; type=&#8221;text/javascript&#8221; src=&#8221;../app/webroot/files/uploader/html/ubr_file_upload.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script language=&#8221;javascript&#8221; type=&#8221;text/javascript&#8221;&gt;<br />
var upload_range = 1;<br />
var path_to_link_script = &#8220;&lt;?php print $PATH_TO_LINK_SCRIPT; ?&gt;&#8221;;<br />
var path_to_set_progress_script = &#8220;&lt;?php print $PATH_TO_SET_PROGRESS_SCRIPT; ?&gt;&#8221;;<br />
var path_to_get_progress_script = &#8220;&lt;?php print $PATH_TO_GET_PROGRESS_SCRIPT; ?&gt;&#8221;;<br />
var path_to_upload_script = &#8220;&lt;?php print $PATH_TO_UPLOAD_SCRIPT; ?&gt;&#8221;;<br />
var multi_configs_enabled = &lt;?php print $MULTI_CONFIGS_ENABLED; ?&gt;;<br />
var check_allow_extensions_on_client = &lt;?php print $_CONFIG['check_allow_extensions_on_client']; ?&gt;;<br />
var check_disallow_extensions_on_client = &lt;?php print $_CONFIG['check_disallow_extensions_on_client']; ?&gt;;<br />
&lt;?php if($_CONFIG['check_allow_extensions_on_client']){ print &#8220;var allow_extensions = /&#8221; . $_CONFIG['allow_extensions'] . &#8220;$/i;\n&#8221;; } ?&gt;<br />
&lt;?php if($_CONFIG['check_disallow_extensions_on_client']){ print &#8220;var disallow_extensions = /&#8221; . $_CONFIG['disallow_extensions'] . &#8220;$/i;\n&#8221;; } ?&gt;<br />
var check_file_name_format = &lt;?php print $_CONFIG['check_file_name_format']; ?&gt;;<br />
&lt;?php if($_CONFIG['check_file_name_format']){ print &#8220;var check_file_name_regex = /&#8221; . $_CONFIG['check_file_name_regex'] . &#8220;/;\n&#8221;; } ?&gt;<br />
&lt;?php if($_CONFIG['check_file_name_format']){ print &#8220;var check_file_name_error_message = &#8216;&#8221; . $_CONFIG['check_file_name_error_message'] . &#8220;&#8216;;\n&#8221;; } ?&gt;<br />
&lt;?php if($_CONFIG['check_file_name_format']){ print &#8220;var max_file_name_chars = &#8221; . $_CONFIG['max_file_name_chars'] . &#8220;;\n&#8221;; } ?&gt;<br />
&lt;?php if($_CONFIG['check_file_name_format']){ print &#8220;var min_file_name_chars = &#8221; . $_CONFIG['min_file_name_chars'] . &#8220;;\n&#8221;; } ?&gt;<br />
var check_null_file_count = &lt;?php print $_CONFIG['check_null_file_count']; ?&gt;;<br />
var check_duplicate_file_count = &lt;?php print $_CONFIG['check_duplicate_file_count']; ?&gt;;<br />
var max_upload_slots = &lt;?php print $_CONFIG['max_upload_slots']; ?&gt;;<br />
var cedric_progress_bar = &lt;?php print $_CONFIG['cedric_progress_bar']; ?&gt;;<br />
var cedric_hold_to_sync = &lt;?php print $_CONFIG['cedric_hold_to_sync']; ?&gt;;<br />
var bucket_progress_bar = &lt;?php print $_CONFIG['bucket_progress_bar']; ?&gt;;<br />
var progress_bar_width = &lt;?php print $_CONFIG['progress_bar_width']; ?&gt;;<br />
var show_percent_complete = &lt;?php print $_CONFIG['show_percent_complete']; ?&gt;;<br />
var show_files_uploaded = &lt;?php print $_CONFIG['show_files_uploaded']; ?&gt;;<br />
var show_current_position = &lt;?php print $_CONFIG['show_current_position']; ?&gt;;<br />
var show_current_file = &lt;?php if($CGI_UPLOAD_HOOK &amp;&amp; $_CONFIG['show_current_file']){ print &#8220;1&#8243;; }else{ print &#8220;0&#8243;; } ?&gt;;<br />
var show_elapsed_time = &lt;?php print $_CONFIG['show_elapsed_time']; ?&gt;;<br />
var show_est_time_left = &lt;?php print $_CONFIG['show_est_time_left']; ?&gt;;<br />
var show_est_speed = &lt;?php print $_CONFIG['show_est_speed']; ?&gt;;<br />
var JQ = jQuery.noConflict();</p>
<p>JQ(document).ready(function(){<br />
iniFilePage();<br />
JQ(&#8220;#upfile_0&#8243;).bind(&#8220;keypress&#8221;, function(e){ if(e == 13){ return false; } });<br />
//JQ(&#8220;#upfile_0&#8243;).bind(&#8220;change&#8221;, function(e){ addUploadSlot(1); });<br />
JQ(&#8220;#upload_button&#8221;).bind(&#8220;click&#8221;, function(e){ //alert(valid.validate());<br />
if(valid.validate())<br />
linkUpload();<br />
});<br />
JQ(&#8220;#reset_button&#8221;).bind(&#8220;click&#8221;, function(e){ resetForm(); });<br />
});<br />
&lt;/script&gt;</p>
<p>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;http://www.xyz.com/app/webroot/files/uploader/html/ubr_file_upload.js&#8221; &gt;&lt;/script&gt;<br />
&lt;link href=&#8221;http://www.xyz.com/app/webroot/files/uploader/html/ubr.css&#8221; type=&#8221;text/css&#8221; rel=&#8221;stylesheet&#8221; /&gt;</p>
<p>&lt;!&#8211; Start Progress Bar &#8211;&gt;<br />
&lt;div align=&#8221;center&#8221; id=&#8221;progress_bar&#8221; style=&#8221;display:none;&#8221;&gt;<br />
&lt;div id=&#8221;upload_status_wrap&#8221; class=&#8221;ubrBar1&#8243;&nbsp; style=&#8221;width:400px&#8221;&gt;<br />
&lt;div id=&#8221;upload_status&#8221; class=&#8221;ubrBar2&#8243;&gt;&lt;/div&gt;<br />
&lt;/div&gt;<br />
&lt;?php if($_CONFIG['show_percent_complete'] || $_CONFIG['show_files_uploaded'] || $_CONFIG['show_current_position'] || $_CONFIG['show_elapsed_time'] || $_CONFIG['show_est_time_left'] || $_CONFIG['show_est_speed']){ ?&gt;<br />
&lt;br&gt;<br />
&lt;table class=&#8221;ubrUploadData&#8221;&gt;<br />
&lt;?php if($_CONFIG['show_percent_complete']){ ?&gt;<br />
&lt;tr&gt;<br />
&lt;td class=&#8217;ubrUploadDataLabel&#8217;&gt;Percent Complete:&lt;/td&gt;<br />
&lt;td class=&#8217;ubrUploadDataInfo&#8217;&gt;&lt;span id=&#8221;percent_complete&#8221;&gt;0%&lt;/span&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;?php } ?&gt;<br />
&lt;?php if($_CONFIG['show_files_uploaded']){ ?&gt;<br />
&lt;tr&gt;<br />
&lt;td class=&#8217;ubrUploadDataLabel&#8217;&gt;Files Uploaded:&lt;/td&gt;<br />
&lt;td class=&#8217;ubrUploadDataInfo&#8217;&gt;&lt;span id=&#8221;files_uploaded&#8221;&gt;0&lt;/span&gt; of &lt;span id=&#8221;total_uploads&#8221;&gt;&lt;/span&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;?php } ?&gt;<br />
&lt;?php if($_CONFIG['show_current_position']){ ?&gt;<br />
&lt;tr&gt;<br />
&lt;td class=&#8217;ubrUploadDataLabel&#8217;&gt;Current Position:&lt;/td&gt;<br />
&lt;td class=&#8217;ubrUploadDataInfo&#8217;&gt;&lt;span id=&#8221;current_position&#8221;&gt;0&lt;/span&gt; / &lt;span id=&#8221;total_kbytes&#8221;&gt;&lt;/span&gt; KBytes&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;?php } ?&gt;<br />
&lt;?php if($CGI_UPLOAD_HOOK &amp;&amp; $_CONFIG['show_current_file']){ ?&gt;<br />
&lt;tr&gt;<br />
&lt;td class=&#8217;ubrUploadDataLabel&#8217;&gt;Current File Uploading:&lt;/td&gt;<br />
&lt;td class=&#8217;ubrUploadDataInfo&#8217;&gt;&lt;span id=&#8221;current_file&#8221;&gt;&lt;/span&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;?php } ?&gt;<br />
&lt;?php if($_CONFIG['show_elapsed_time']){ ?&gt;<br />
&lt;tr&gt;<br />
&lt;td class=&#8217;ubrUploadDataLabel&#8217;&gt;Elapsed Time:&lt;/td&gt;<br />
&lt;td class=&#8217;ubrUploadDataInfo&#8217;&gt;&lt;span id=&#8221;elapsed_time&#8221;&gt;0&lt;/span&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;?php } ?&gt;<br />
&lt;?php if($_CONFIG['show_est_time_left']){ ?&gt;<br />
&lt;tr&gt;<br />
&lt;td class=&#8217;ubrUploadDataLabel&#8217;&gt;Est Time Left:&lt;/td&gt;<br />
&lt;td class=&#8217;ubrUploadDataInfo&#8217;&gt;&lt;span id=&#8221;est_time_left&#8221;&gt;0&lt;/span&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;?php } ?&gt;<br />
&lt;?php if($_CONFIG['show_est_speed']){ ?&gt;<br />
&lt;tr&gt;<br />
&lt;td class=&#8217;ubrUploadDataLabel&#8217;&gt;Est Speed:&lt;/td&gt;<br />
&lt;td class=&#8217;ubrUploadDataInfo&#8217;&gt;&lt;span id=&#8221;est_speed&#8221;&gt;0&lt;/span&gt; KB/s.&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;?php } ?&gt;<br />
&lt;/table&gt;<br />
&lt;?php } ?&gt;<br />
&lt;/div&gt;<br />
&lt;!&#8211; End Progress Bar &#8211;&gt;</p>
<p>&lt;!&#8211; Start Upload Form &#8211;&gt;<br />
&lt;form name=&#8221;form_upload&#8221; id=&#8221;form_upload&#8221; &lt;?php if($_CONFIG['embedded_upload_results'] || $_CONFIG['opera_browser'] || $_CONFIG['safari_browser']){ print &#8220;target=\&#8221;upload_iframe\&#8221;"; } ?&gt; method=&#8221;post&#8221; enctype=&#8221;multipart/form-data&#8221;&nbsp; action=&#8221;#&#8221; style=&#8221;margin: 0px; padding: 0px;&#8221;&gt;<br />
&lt;noscript&gt;&lt;font color=&#8217;red&#8217;&gt;Warning: &lt;/font&gt;Javascript must be enabled to use this uploader.&lt;br&gt;&lt;br&gt;&lt;/noscript&gt;<br />
&lt;!&#8211; Include extra values you want passed to the upload script here. &#8211;&gt;<br />
&lt;!&#8211; eg. &lt;input type=&#8221;text&#8221; name=&#8221;employee_num&#8221; value=&#8221;5&#8243;&gt; &#8211;&gt;<br />
&lt;!&#8211; Access the value in the CGI with $query-&gt;param(&#8216;employee_num&#8217;); &#8211;&gt;<br />
&lt;!&#8211; Access the value in the PHP finished page with $_POST_DATA['employee_num']; &#8211;&gt;<br />
&lt;!&#8211; DO NOT USE &#8220;upfile_&#8221; for any of your values. &#8211;&gt;<br />
&lt;div id=&#8221;upload_slots&#8221;&gt;&lt;input type=&#8221;file&#8221; name=&#8221;upfile_0&#8243; size=&#8221;90&#8243; &lt;?php if($_CONFIG['multi_upload_slots']){ ?&gt;onChange=&#8221;addUploadSlot(1)&#8221;&lt;?php } ?&gt;&nbsp; onkeypress=&#8221;return handleKey(event)&#8221; value=&#8221;"&gt;&lt;/div&gt;<br />
&lt;br&gt;<br />
&lt;input type=&#8221;button&#8221; id=&#8221;reset_button&#8221; name=&#8221;reset_button&#8221; value=&#8221;Reset&#8221; onClick=&#8221;resetForm();&#8221;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input type=&#8221;button&#8221; id=&#8221;upload_button&#8221; name=&#8221;upload_button&#8221; value=&#8221;Upload&#8221; onClick=&#8221;linkUpload();&#8221;&gt;<br />
&lt;/form&gt;<br />
&lt;!&#8211; End Upload Form &#8211;&gt;<br />
&lt;/div&gt;<br />
&lt;div id=&#8217;ajax_div&#8217;&gt;&lt;!&#8211; Used to store AJAX &#8211;&gt;&lt;/div&gt;</p>
<p>12 Now you can run the code www.xyz.com/videos/uploadvideo</p>
<p>I hope this helps people looking for solution integrating Uber Uploader in Cake PHP. Leave comment in case of any issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.digi-corp.com/2009/05/how-to-integrate-uber-uploader-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Working with Arabic Language</title>
		<link>http://dev.digi-corp.com/2009/04/working-with-arabic-language/</link>
		<comments>http://dev.digi-corp.com/2009/04/working-with-arabic-language/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 12:59:22 +0000</pubDate>
		<dc:creator>vishal.parmar</dc:creator>
				<category><![CDATA[Arabic]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Arabic email]]></category>
		<category><![CDATA[email in arabic]]></category>
		<category><![CDATA[html in arabic]]></category>
		<category><![CDATA[UTF-8]]></category>
		<category><![CDATA[work with Arabic]]></category>

		<guid isPermaLink="false">http://dev.digi-corp.com/?p=121</guid>
		<description><![CDATA[We have lot of clients in Middle East and thus we have to develop almost all the projects in English and Arabic. Developing in Arabic can be quite challanging sometimes not just because it is a different language but it is also read and written from right to left. So it is a very vast [...]]]></description>
			<content:encoded><![CDATA[<p>We have lot of clients in Middle East and thus we have to develop almost all the projects in English and Arabic.</p>
<p>Developing in Arabic can be quite challanging sometimes not just because it is a different language but it is also read and written from right to left. So it is a very vast subject but right now let us focus on few things.</p>
<p>Following are couple of issues you may come across working with Arabic but there are also simple solutions to them as explained below.</p>
<p><strong>(1) Sending email in Arabic </strong></p>
<p>Sometimes we find that Arabic mail is displayed properly in gmail,yahoo etc but they dont look ok in Outlook, Zimbra.</p>
<p>Instead of Arabic junk data like following comes in email:</p>
<p>áã íÊã ÝÊÍ ãáÝ ÇáÞÇáÈáã íÊã ÝÊÍ ãáÝ ÇáÞÇáÈ<br />
áã íÊã ÝÊÍ ãáÝ ÇáÞÇáÈáã íÊã ÝÊÍ ãáÝ ÇáÞÇáÈ</p>
<p>Solution to this problem is very simple</p>
<p><em>You just need to set mail header charset as UTF-8 intead of iso-8859-1.</em></p>
<p>PHP example:</p>
<p>$headers  = &#8216;MIME-Version: 1.0&#8242; . &#8220;\r\n&#8221;;<br />
$headers .= &#8216;Content-type: text/html;<strong> charset=UTF-8</strong>&#8216; . &#8220;\r\n&#8221;;</p>
<p><strong>(2) To display HTML page in Arabic Language</strong></p>
<p>&lt;html xmlns=&#8221;<span class="Object"><a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a></span>&#8220;&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv=&#8221;content-type&#8221; content=&#8221;text/html;<strong> charset=UTF-8</strong>&#8220;&gt;</p>
<p>I hope this may help you someday when you are stuck.</p>
<p>Would you like to share some of your tips about working with Arabic language here? please write them in comments.</p>
<p>Thanks.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.digi-corp.com/2009/04/working-with-arabic-language/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

