<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2116456529380549639</id><updated>2024-11-06T08:16:27.940+05:30</updated><category term="php"/><category term="accordion"/><category term="cookies basics"/><category term="curl"/><category term="database"/><category term="file uploads"/><category term="internationalisation i18n"/><category term="jquery"/><category term="localisation l10n"/><category term="mysql"/><category term="queries"/><category term="sessions"/><category term="singleton design pattern"/><title type='text'>My Daily Coding updates</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://pravinsreedharan.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://pravinsreedharan.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Pravin Sreedharan</name><uri>http://www.blogger.com/profile/05981079611678404183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2116456529380549639.post-3635956114740141763</id><published>2012-10-09T16:24:00.000+05:30</published><updated>2012-10-09T16:28:05.387+05:30</updated><title type='text'>Displaying css dropdown menu over flash object in IE8</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
To display a css dropdown menu over an embedded flash video in IE8, do the following:&lt;br /&gt;
&lt;br /&gt;
add :&lt;br /&gt;
1. &amp;lt;param name=&quot;wmode&quot; value=&quot;opaque&quot;/&amp;gt; in &amp;lt;object&amp;gt; tag and&lt;br /&gt;
2. wmode=&quot;opaque&quot; in &amp;lt;embed&amp;gt; tag.&lt;br /&gt;
&lt;br /&gt;
This should take care of it.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.5/in/&quot; rel=&quot;license&quot;&gt;&lt;img alt=&quot;Creative Commons License&quot; src=&quot;http://i.creativecommons.org/l/by-nc-sa/2.5/in/80x15.png&quot; style=&quot;border-width: 0;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://pravinsreedharan.blogspot.com/feeds/3635956114740141763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pravinsreedharan.blogspot.com/2012/10/displaying-css-menu-over-flash-object.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/3635956114740141763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/3635956114740141763'/><link rel='alternate' type='text/html' href='http://pravinsreedharan.blogspot.com/2012/10/displaying-css-menu-over-flash-object.html' title='Displaying css dropdown menu over flash object in IE8'/><author><name>Pravin Sreedharan</name><uri>http://www.blogger.com/profile/05981079611678404183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2116456529380549639.post-5960702680232571853</id><published>2012-06-28T10:37:00.001+05:30</published><updated>2012-10-10T13:46:09.232+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="accordion"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><title type='text'>Accordion menu - making a top level menu item work as a link</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
I was working on five-six level JQuery accordion menu to build a side navigation menu. However, i wanted to make labels with a single level menu to behave as normal links rather than the default behaviour of opening up a sub-menu on clicking the top level label.&lt;br /&gt;
&lt;br /&gt;
For this, you need to capture the click event of the top level label to make it work as a normal link. Following is the solution:&lt;br /&gt;
&lt;br /&gt;
The HTML code looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&quot;accordion&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h3 class=&quot;home&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;a href=&quot;/home&quot; class=&quot;heading&quot; &amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h3&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;a href=&quot;#custom&quot; class=&quot;heading&quot;&amp;gt;Custom&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/home/mydata1&quot;&amp;gt;My Bio1&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/home/mydata2&quot;&amp;gt;My Bio2&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h3&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;a href=&quot;/home/Account&quot; class=&quot;heading&quot;&amp;gt;Account&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/home/avatar&quot;&amp;gt;Avatar&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/home/Account&quot;&amp;gt;Account&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h3&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;a href=&quot;#custom2&quot; class=&quot;heading&quot;&amp;gt;Custom2&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h3&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;a href=&quot;#custom3&quot; class=&quot;heading&quot;&amp;gt;Custom3&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h3&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;a href=&quot;#custom4&quot; class=&quot;heading&quot;&amp;gt;Custom4&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h3&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;a href=&quot;#custom5&quot; class=&quot;heading&quot;&amp;gt;Custom5&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/h3&amp;gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The js code to set up Accordion with JQuery looks like:&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(&#39;#accordion&#39;).accordion({&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; header: &quot;h3.home&quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; navigation: true,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; autoHeight: false,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; clearStyle: true,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; collapsible: true,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alwaysOpen: true,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; animated: &#39;slide&#39;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $(&#39;#accordion h3.home a&#39;).click(function(){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $(&#39;#accordion a.heading&#39;).accordion(&quot;activate&quot;, -1);&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; window.location = $(this).attr(&#39;href&#39;); &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return false;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The line: $(&#39;#accordion a.heading&#39;).accordion(&quot;activate&quot;, -1);&amp;nbsp; closes every label/header that is open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The line: window.location = $(this).attr(&#39;href&#39;); sets the url to navigate to, to the href value. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.5/in/&quot; rel=&quot;license&quot;&gt;&lt;img alt=&quot;Creative Commons License&quot; src=&quot;http://i.creativecommons.org/l/by-nc-sa/2.5/in/80x15.png&quot; style=&quot;border-width: 0pt;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://pravinsreedharan.blogspot.com/feeds/5960702680232571853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pravinsreedharan.blogspot.com/2012/06/enabling-link-in-jquery-accordion.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/5960702680232571853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/5960702680232571853'/><link rel='alternate' type='text/html' href='http://pravinsreedharan.blogspot.com/2012/06/enabling-link-in-jquery-accordion.html' title='Accordion menu - making a top level menu item work as a link'/><author><name>Pravin Sreedharan</name><uri>http://www.blogger.com/profile/05981079611678404183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2116456529380549639.post-4872333633246773910</id><published>2012-04-26T13:45:00.000+05:30</published><updated>2012-10-23T18:38:07.840+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="cookies basics"/><category scheme="http://www.blogger.com/atom/ns#" term="sessions"/><title type='text'></title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;b&gt;Sessions and Cookies:&lt;/b&gt; &lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Cookies Vs Sessions&lt;/span&gt;&lt;/b&gt;: &lt;span style=&quot;font-size: small;&quot;&gt;The main difference between cookies and sessions is that cookies are stored on the client side while sessions are stored on the server side&lt;/span&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;Cookies&lt;/i&gt;&lt;/b&gt;: &lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;A cookie is a file that is stored on the client computer when visiting a website. They are typically used to store user preferences e.g. Cookies store the order, in which users want their news to be printed etc. More often than not, they are used to store any non-sensitive data on client computer. When you create a cookie, you need to specify how long you want it to be valid, and once done, it will reside on the client computer till that date until it ‘expires.’ Once a cookie has been created, the visitor’s browser will automatically send it to the web server each time the visitor visits our site. PHP then reads this value into the superglobal array: $_COOKIE, which a developer can then use to read the concerned cookie’s value as $value = $_COOKIE[‘name’];&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;i&gt;Usage&lt;/i&gt;:&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
Following is the syntax to create a cookie:&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
setcookie(name,value,expire,path,domain,secure,httponly);&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
where: &lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
name =&amp;gt; name of the cookie to be stored on the client’s computer.&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
value =&amp;gt; value the cookie will hold.&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
expire =&amp;gt; the expiry period of the cookie&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
path =&amp;gt; the path on the server in which the cookie will be available on. Default value is the current directory that the cookie is being set in.&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
domain =&amp;gt; the domain on which the cookie will be available.&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
secure =&amp;gt; indicates that the cookie will be transmitted only over a secure http connection i.e. only over an https:// request.&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
httponly =&amp;gt; This parameter was added in PHP 5.2 and above. When set to TRUE, the cookie will be accessible only via an http protocol. It cannot be accessed by Javascript anymore.&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
e.g. Let us set a cookie that will expire 2 days from now. It’s typical syntax will be:&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;i&gt;$cookieValue = “test data”;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;i&gt;setcookie(‘testcookie’, $cookieValue,time()+172800,’/foo’,’example.com’,1);&lt;/i&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
The above declaration will create a cookie named “testcookie” with the given value and will expire after 2 days. 2 days = 24*60*60*2 = 172800 seconds. In addition, it will available within the directory /foo and all sub-directories such as /foo/test of the domain : example.com.&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;i&gt;Please note&lt;/i&gt;: The secure parameter being set to 1, indicates that the cookie will be available only on a secured HTTP connection i.e. over an https:// request only. &lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;b&gt;&lt;i&gt;Sessions&lt;/i&gt;&lt;/b&gt;: A session is nothing but a combination of a client-side cookie and server-side cookie. The client-side cookie contains a reference to the server side cookie which is stored on the web server. So, when a user visits a website, the client’s browser sends the reference code to the web server which in turn loads the corresponding data. &lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;b&gt;&lt;i&gt;Advantages of such a combination of a client side and server side cookie representing a session are&lt;/i&gt;&lt;/b&gt;:&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
1. The server-side cookie can contain very large amounts of data with no hassle - client-side cookies are limited in size. &lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
2. The client-side cookie contains nothing other than a small reference code - as this cookie is passed each time someone visits a page on your site, you are saving a lot of bandwidth by not transferring large client-side cookies around.&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
3. Session data is much more secure - only you are able to manipulate it, as opposed to client-side cookies which are editable by all.&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;i&gt;Usage&lt;/i&gt;:&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
session_start(); &lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
$_SESSION[‘firstName’] = “Jim”;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
print $_SESSION[‘firstName’];&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
unset($_SESSION[‘firstName’]);&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
session_destroy();&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
As shown above, when you call session_start(), PHP will check to see if the client computer’s browser has sent a session cookie, if it did, then PHP will load the session data. Otherwise, PHP will create a new session file on the server and send an ID back to the client computer to associate it with the new file. To remove a specific value from a session, use unset() function. It is important that you should unset only specific elements of the $_SESSION array, not the $_SESSION array itself, because doing so would leave you without any way to manipulate the session data at all. &lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;a href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.5/in/&quot; rel=&quot;license&quot;&gt;&lt;img alt=&quot;Creative Commons License&quot; src=&quot;http://i.creativecommons.org/l/by-nc-sa/2.5/in/80x15.png&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://pravinsreedharan.blogspot.com/feeds/4872333633246773910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pravinsreedharan.blogspot.com/2012/04/sessions-cookies-cookies-vs-sessions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/4872333633246773910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/4872333633246773910'/><link rel='alternate' type='text/html' href='http://pravinsreedharan.blogspot.com/2012/04/sessions-cookies-cookies-vs-sessions.html' title=''/><author><name>Pravin Sreedharan</name><uri>http://www.blogger.com/profile/05981079611678404183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2116456529380549639.post-2309099140936139543</id><published>2011-12-27T18:29:00.003+05:30</published><updated>2012-06-28T10:51:12.916+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="curl"/><title type='text'>Making a curl request behind a proxy</title><content type='html'>Set following additional curl options in order to make a curl request behind an http proxy:&lt;br /&gt;&lt;br /&gt;curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL,TRUE);&lt;br /&gt;curl_setopt($ch, CURLOPT_PROXYAUTH,CURLAUTH_BASIC);&lt;br /&gt;curl_setopt($ch, CURLOPT_PROXY,&#39;proxyname or proxyIP:portnumber&#39;);&lt;br /&gt;&lt;br /&gt;&lt;a rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.5/in/&quot;&gt;&lt;img alt=&quot;Creative Commons License&quot; style=&quot;border-width:0&quot; src=&quot;http://i.creativecommons.org/l/by-nc-sa/2.5/in/80x15.png&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://pravinsreedharan.blogspot.com/feeds/2309099140936139543/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pravinsreedharan.blogspot.com/2011/12/making-curl-request-behind-proxy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/2309099140936139543'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/2309099140936139543'/><link rel='alternate' type='text/html' href='http://pravinsreedharan.blogspot.com/2011/12/making-curl-request-behind-proxy.html' title='Making a curl request behind a proxy'/><author><name>Pravin Sreedharan</name><uri>http://www.blogger.com/profile/05981079611678404183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2116456529380549639.post-3474819467518744798</id><published>2010-08-28T15:44:00.003+05:30</published><updated>2012-10-23T18:37:29.521+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><title type='text'>PHP coding standards</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
While we create applications in any language, we tend to follow certain coding conventions. So does this apply to creating applications in PHP as well.&lt;br /&gt;
&lt;br /&gt;
Here is a list of few coding standards that i follow:&lt;br /&gt;
1. Use camelCaps for Variable Names&lt;br /&gt;
2. Use lowercase for method / function names. For functions with multiple words, an underscore is used as a separator. For e.g. function get_display_text();&lt;br /&gt;
3. Use class constants instead of global constants wherever possible, by using the &lt;i&gt;&lt;b&gt;const&lt;/b&gt;&lt;/i&gt; modifier.&lt;br /&gt;
4. Use descriptive variable names in for loops as well. &lt;br /&gt;
For e.g. $count instead of $j&lt;br /&gt;
for($count=0;$count &amp;lt; 10;$count++){&lt;br /&gt;
your code here&lt;br /&gt;
}  &lt;br /&gt;
&lt;br /&gt;
and many more....&lt;br /&gt;
&lt;br /&gt;
It would also be great if you could also pour in your thoughts on the coding conventions you follow while writing applications in php.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.5/in/&quot; rel=&quot;license&quot;&gt;&lt;img alt=&quot;Creative Commons License&quot; src=&quot;http://i.creativecommons.org/l/by-nc-sa/2.5/in/80x15.png&quot; style=&quot;border-width: 0;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://pravinsreedharan.blogspot.com/feeds/3474819467518744798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pravinsreedharan.blogspot.com/2010/08/share-your-thoughts-on-php-coding.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/3474819467518744798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/3474819467518744798'/><link rel='alternate' type='text/html' href='http://pravinsreedharan.blogspot.com/2010/08/share-your-thoughts-on-php-coding.html' title='PHP coding standards'/><author><name>Pravin Sreedharan</name><uri>http://www.blogger.com/profile/05981079611678404183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2116456529380549639.post-4250819079399205773</id><published>2009-09-18T11:28:00.004+05:30</published><updated>2012-06-28T10:51:31.501+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><title type='text'>Executing PHP code from a .html file</title><content type='html'>You can execute PHP on a .html page by adding following line in your .htaccess file : &lt;br /&gt;&lt;br /&gt;AddType application/x-httpd-php .html&lt;br /&gt;&lt;br /&gt;for executing PHP on a .htm page add this line instead :&lt;br /&gt;&lt;br /&gt;AddType application/x-httpd-php .htm&lt;br /&gt;&lt;br /&gt;The above code will make php executable on all your .html or .htm pages&lt;br /&gt;&lt;br /&gt;If you want to make PHP executable only on one page, you may add following line in your .htaccess file:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt; &amp;lt;Files myhtmlpage.html&amp;gt; AddType application/x-httpd-php .html&lt;br /&gt;&amp;lt;/Files&amp;gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;The above code would make PHP executable only on myhtmlpage.html and not on all html pages.&lt;br /&gt;&lt;br /&gt;&lt;a rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.5/in/&quot;&gt;&lt;img alt=&quot;Creative Commons License&quot; style=&quot;border-width:0&quot; src=&quot;http://i.creativecommons.org/l/by-nc-sa/2.5/in/80x15.png&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://pravinsreedharan.blogspot.com/feeds/4250819079399205773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pravinsreedharan.blogspot.com/2009/09/executing-php-code-from-html-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/4250819079399205773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/4250819079399205773'/><link rel='alternate' type='text/html' href='http://pravinsreedharan.blogspot.com/2009/09/executing-php-code-from-html-file.html' title='Executing PHP code from a .html file'/><author><name>Pravin Sreedharan</name><uri>http://www.blogger.com/profile/05981079611678404183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2116456529380549639.post-1467956968888261387</id><published>2009-04-22T12:22:00.003+05:30</published><updated>2012-06-28T10:52:05.536+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><title type='text'>Workaround for Maximum Script Execution time limit</title><content type='html'>We all know that the default execution time of a php script is set to 30 seconds, defined by the parameter &lt;span style=&quot;font-weight:bold;&quot;&gt;max_execution_time&lt;/span&gt; in php.ini file.&lt;br /&gt;&lt;br /&gt;A simple workaround to overcome the time limitation is a call to ini_set() as :&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;ini_set(&#39;max_execution_time&#39;,&#39;0&#39;)   //0 = no limit&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This causes the current script to be executed without any maximum time limit. I found this workaround helpful in case of sending newsletters where bulk mailing is required. Hope it is helpful to you.  &lt;br /&gt;&lt;br /&gt;&lt;a rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.5/in/&quot;&gt;&lt;img alt=&quot;Creative Commons License&quot; style=&quot;border-width:0&quot; src=&quot;http://i.creativecommons.org/l/by-nc-sa/2.5/in/80x15.png&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://pravinsreedharan.blogspot.com/feeds/1467956968888261387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pravinsreedharan.blogspot.com/2009/04/workaround-for-maximum-script-execution.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/1467956968888261387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/1467956968888261387'/><link rel='alternate' type='text/html' href='http://pravinsreedharan.blogspot.com/2009/04/workaround-for-maximum-script-execution.html' title='Workaround for Maximum Script Execution time limit'/><author><name>Pravin Sreedharan</name><uri>http://www.blogger.com/profile/05981079611678404183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2116456529380549639.post-8222333123955468491</id><published>2009-04-21T14:21:00.007+05:30</published><updated>2009-04-23T12:44:47.551+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="singleton design pattern"/><title type='text'>Singleton Design Pattern Example in PHP</title><content type='html'>Here is a sample example class that implements Singleton Design Pattern in PHP:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;require_once(&quot;properties.php&quot;);&lt;br /&gt;class DbConnection&lt;br /&gt;{&lt;br /&gt; private $connectionId;&lt;br /&gt; &lt;br /&gt; private function __construct($dbHost,$dbUser,$dbPassword,$dbName)&lt;br /&gt; {&lt;br /&gt;  $this-&gt;connectionId = &lt;br /&gt;  mysql_connect($dbHost,$dbUser,$dbPassword,true);&lt;br /&gt;  if($this-&gt;connectionId)&lt;br /&gt;  {&lt;br /&gt;   $this-&gt;selectDatabase($dbName);&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   throw new Exception(mysql_error());&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; private function selectDatabase($db)&lt;br /&gt; {&lt;br /&gt;  $dbSelected = mysql_select_db($db,$this-&gt;connectionId);&lt;br /&gt;  if(!$dbSelected)&lt;br /&gt;  {&lt;br /&gt;   throw new Exception(mysql_error());&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; function __destruct()&lt;br /&gt; {&lt;br /&gt;  if(is_resource($this-&gt;connectionId))&lt;br /&gt;  {&lt;br /&gt;   $this-&gt;closeConnection();&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public function closeConnection()&lt;br /&gt; {&lt;br /&gt;  mysql_close($this-&gt;connectionId);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public function getResourceId()&lt;br /&gt; {&lt;br /&gt;  return $this-&gt;connectionId;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public static function getInstance()&lt;br /&gt; {&lt;br /&gt;  static $dbConnObj;&lt;br /&gt;  if(!isset($dbConnObj))&lt;br /&gt;  {&lt;br /&gt;   $dbConnObj = new DbConnection(HOSTNAME,DB_USER,DB_PWD,DB_NAME);&lt;br /&gt;  }&lt;br /&gt;  return $dbConnObj;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public function prepareQuery($args=null)&lt;br /&gt; {&lt;br /&gt;  $resourceId = $this-&gt;getResourceId();&lt;br /&gt;  $args = func_get_args();&lt;br /&gt;  $query = array_shift($args);&lt;br /&gt;  foreach($args as $argIndex=&gt;$param)&lt;br /&gt;  {&lt;br /&gt;   $args[$argIndex] = mysql_real_escape_string($param,$resourceId);&lt;br /&gt;  }&lt;br /&gt;  return vsprintf($query,$args);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public function fetchRow($query)&lt;br /&gt; {&lt;br /&gt;  $recordDetails = $this-&gt;executeQuery($query);&lt;br /&gt;  return $recordDetails[0]? get_object_vars($recordDetails[0]) : null;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public function fetchVar($query)&lt;br /&gt; {&lt;br /&gt;  $recordDetails = $this-&gt;fetchRow($query);&lt;br /&gt;  if(count($recordDetails)&gt;0)&lt;br /&gt;  {&lt;br /&gt;   $values = array_values($recordDetails);&lt;br /&gt;  }&lt;br /&gt;   &lt;br /&gt;  if(isset($values[0]) &amp;&amp; $values[0]!==&#39;&#39;)&lt;br /&gt;  {&lt;br /&gt;   return $values[0];&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public function executeQuery($query)&lt;br /&gt; {&lt;br /&gt;  $resourceId = $this-&gt;getResourceId();&lt;br /&gt;  $result = @mysql_query($query,$resourceId);&lt;br /&gt;  if( preg_match(&quot;/^\\s*(insert|update|delete|replace|alter)/i&quot;,$query) ){&lt;br /&gt;   $returnVal = mysql_affected_rows($resourceId); &lt;br /&gt;  }&lt;br /&gt;  else{&lt;br /&gt;   $resultSet = array();&lt;br /&gt;   while($row = @mysql_fetch_object($result))&lt;br /&gt;   {&lt;br /&gt;    $resultSet[] = $row; &lt;br /&gt;   }&lt;br /&gt;   $returnVal = $resultSet;&lt;br /&gt;  }&lt;br /&gt;  return $returnVal;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;try{&lt;br /&gt; $dbConn = DbConnection::getInstance(); &lt;br /&gt;}catch(Exception $e){&lt;br /&gt; die(&quot;&lt;br&gt;Error:&quot;.$e-&gt;getMessage());&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Note:&lt;br /&gt;1. HOSTNAME&lt;br /&gt;2. DB_USER&lt;br /&gt;3. DB_PWD&lt;br /&gt;4. DB_NAME are constants defined in &lt;blockquote&gt;properties.php&lt;/blockquote&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.5/in/&quot;&gt;&lt;img alt=&quot;Creative Commons License&quot; style=&quot;border-width:0&quot; src=&quot;http://i.creativecommons.org/l/by-nc-sa/2.5/in/80x15.png&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://pravinsreedharan.blogspot.com/feeds/8222333123955468491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pravinsreedharan.blogspot.com/2009/04/singleton-design-pattern-example-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/8222333123955468491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/8222333123955468491'/><link rel='alternate' type='text/html' href='http://pravinsreedharan.blogspot.com/2009/04/singleton-design-pattern-example-in-php.html' title='Singleton Design Pattern Example in PHP'/><author><name>Pravin Sreedharan</name><uri>http://www.blogger.com/profile/05981079611678404183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2116456529380549639.post-8531056924799443826</id><published>2009-02-03T19:15:00.010+05:30</published><updated>2012-06-28T10:52:26.094+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="file uploads"/><title type='text'>File uploading issue</title><content type='html'>Recently, I was writing a php script for uploading files.Strangely enough, I was able to upload all common types of files i.e.*.mpeg,*.avi,*.swf files but i was unable to upload flash files.&lt;br /&gt;&lt;br /&gt;As i was aware that the default file upload size,controlled by &lt;span style=&quot;font-weight:bold;&quot;&gt;upload_max_filesize&lt;/span&gt; php.ini directive is 2MB and the default maximum size of post Data that PHP accepts, controlled by &lt;span style=&quot;font-weight:bold;&quot;&gt;post_max_size&lt;/span&gt; php.ini directive is 8MB, i tried changing value of &lt;span style=&quot;font-weight:bold;&quot;&gt;upload_max_filesize&lt;/span&gt; using ini_set() function to 8MB. But there was no effect of this as i found that ini_set() doesn&#39;t necessarily change all the directives.&lt;br /&gt;&lt;br /&gt;Then as a test, i made following changes directly in php.ini file:&lt;br /&gt;1. set &lt;span style=&quot;font-weight:bold;&quot;&gt;upload_max_filesize&lt;/span&gt; to 8MB&lt;br /&gt;2. set &lt;span style=&quot;font-weight:bold;&quot;&gt;post_max_size&lt;/span&gt; to 9MB&lt;br /&gt;And voila, it worked. I was able to upload flash files(.flv) as well alongwith other video file types.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Note:&lt;/span&gt; Files are usually POSTed to the webserver using &#39;multipart/form-data&#39; encoding format.What post_max_size does is,to set the upper limit on the amount of data that a script can accept.&lt;br /&gt;&lt;br /&gt;Hence,&lt;span style=&quot;font-style:italic;&quot;&gt;post_max_size&lt;/span&gt; is the upload_max_filesize plus the sum of the lengths of all the other fields in the form.&lt;br /&gt;&lt;br /&gt;Finally, after checking php manual and &lt;a href=&quot;http://www.php.net/manual/en/ini.php&quot; target=&quot;_new&quot;&gt;php.net link&lt;/a&gt;, i figured out following rules to follow before using ini_set() function&lt;br /&gt;&lt;br /&gt;1. Make sure that the &quot;CHANGEABLE&quot; attribute of the php.ini directive whose value you would like to alter, is either PHP_INI_USER OR PHP_INI_ALL. Only those directives with these &quot;CHANGEABLE&quot; values can be modified with ini_set() function.&lt;br /&gt;&lt;br /&gt;2. In the above case, make changes in php.ini as mentioned above.&lt;br /&gt;&lt;br /&gt;&lt;a rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.5/in/&quot;&gt;&lt;img alt=&quot;Creative Commons License&quot; style=&quot;border-width:0&quot; src=&quot;http://i.creativecommons.org/l/by-nc-sa/2.5/in/80x15.png&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://pravinsreedharan.blogspot.com/feeds/8531056924799443826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pravinsreedharan.blogspot.com/2009/02/rules-for-flv-file-upload-using-php.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/8531056924799443826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/8531056924799443826'/><link rel='alternate' type='text/html' href='http://pravinsreedharan.blogspot.com/2009/02/rules-for-flv-file-upload-using-php.html' title='File uploading issue'/><author><name>Pravin Sreedharan</name><uri>http://www.blogger.com/profile/05981079611678404183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2116456529380549639.post-5407175530393981765</id><published>2009-01-28T15:55:00.004+05:30</published><updated>2012-06-28T10:52:58.026+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="internationalisation i18n"/><category scheme="http://www.blogger.com/atom/ns#" term="localisation l10n"/><title type='text'>Internationalization using PHP - phpfreaks link</title><content type='html'>Forum Link on www.phpfreaks.com about Internationalization using PHP&lt;br /&gt; &lt;br /&gt;&lt;a href=&quot;http://www.phpfreaks.com/forums/index.php/topic,167810.msg739648.html#msg739648&quot; target=&quot;_new&quot;&gt;Internationalization using PHP&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.5/in/&quot;&gt;&lt;img alt=&quot;Creative Commons License&quot; style=&quot;border-width:0&quot; src=&quot;http://i.creativecommons.org/l/by-nc-sa/2.5/in/80x15.png&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://pravinsreedharan.blogspot.com/feeds/5407175530393981765/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pravinsreedharan.blogspot.com/2009/01/internationalization-using-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/5407175530393981765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/5407175530393981765'/><link rel='alternate' type='text/html' href='http://pravinsreedharan.blogspot.com/2009/01/internationalization-using-php.html' title='Internationalization using PHP - phpfreaks link'/><author><name>Pravin Sreedharan</name><uri>http://www.blogger.com/profile/05981079611678404183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2116456529380549639.post-2599810437985242113</id><published>2009-01-27T20:38:00.003+05:30</published><updated>2012-06-28T10:53:14.177+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="database"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="queries"/><title type='text'>MYSQL - query to find top 10 favourite locations in each city</title><content type='html'>Here&#39;s a short example of using &lt;span style=&quot;font-style:italic;&quot;&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;MYSQL CASE WHEN Control flow function&lt;/span&gt;&lt;/span&gt; alongwith &lt;span style=&quot;font-style:italic;&quot;&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;User defined variables&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT CITY,Location,Most_Popular&lt;br /&gt;FROM&lt;br /&gt;(&lt;br /&gt;  SELECT @CITY,&lt;br /&gt;  CASE&lt;br /&gt;  WHEN (@CITY=&lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;CITYNAME FIELD&lt;/span&gt;&lt;/span&gt; AND @ROWNUM &lt; 10) THEN (@ROWNUM:=@ROWNUM+1)&lt;br /&gt;  WHEN (@CITY != &lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;CITYNAME FIELD&lt;/span&gt;&lt;/span&gt;) THEN @ROWNUM:=1&lt;br /&gt;  ELSE @ROWNUM:=10&lt;br /&gt;  END AS CHANGED_CITY, @CITY:=&lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;CITYNAME FIELD&lt;/span&gt;&lt;/span&gt;, D.*&lt;br /&gt;  FROM (SELECT @ROWNUM:=0) R, (SELECT @CITY:=&#39;0&#39;) M,&lt;br /&gt;    (&lt;br /&gt;        SELECT CITY, Location, count(&lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;UserId Field&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;) as Most_Popular&lt;br /&gt;        FROM &lt;span style=&quot;font-weight:bold;&quot;&gt;Table Names&lt;/span&gt;&lt;br /&gt;        WHERE&lt;br /&gt;            &lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;Field Constraints&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;        group by CITY,Location&lt;br /&gt;        order by CITY,Most_Popular Desc&lt;br /&gt;    )D&lt;br /&gt;  )D1&lt;br /&gt; GROUP BY CITY,CHANGED_CITY&lt;br /&gt; order by CITY,Most_Popular Desc;&lt;br /&gt;&lt;br /&gt;Thanks to Ankit for helping me out on this...&lt;br /&gt;&lt;br /&gt;&lt;a rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.5/in/&quot;&gt;&lt;img alt=&quot;Creative Commons License&quot; style=&quot;border-width:0&quot; src=&quot;http://i.creativecommons.org/l/by-nc-sa/2.5/in/80x15.png&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://pravinsreedharan.blogspot.com/feeds/2599810437985242113/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pravinsreedharan.blogspot.com/2009/01/mysql-query-to-find-top-10-favourite.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/2599810437985242113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/2599810437985242113'/><link rel='alternate' type='text/html' href='http://pravinsreedharan.blogspot.com/2009/01/mysql-query-to-find-top-10-favourite.html' title='MYSQL - query to find top 10 favourite locations in each city'/><author><name>Pravin Sreedharan</name><uri>http://www.blogger.com/profile/05981079611678404183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2116456529380549639.post-2608781958928460080</id><published>2009-01-23T19:52:00.001+05:30</published><updated>2009-01-23T19:55:42.924+05:30</updated><title type='text'>MYSQL CASE WHEN EXAMPLE</title><content type='html'>Here&#39;s a short example of using CASE WHEN control flow statement for grouping users who write reviews by age group:&lt;br /&gt;&lt;br /&gt;select CASE &lt;br /&gt;       WHEN ( FLOOR(datediff(CURRENT_DATE,&lt;span style=&quot;font-weight:bold;&quot;&gt;DOB&lt;/span&gt;)/365) &gt; 15 AND FLOOR(datediff(CURRENT_DATE,&lt;span style=&quot;font-weight:bold;&quot;&gt;DOB&lt;/span&gt;)/365) &lt; 25) THEN &#39;15-25&#39;&lt;br /&gt;       WHEN ( FLOOR(datediff(CURRENT_DATE,&lt;span style=&quot;font-weight:bold;&quot;&gt;DOB&lt;/span&gt;)/365) &gt; 25 AND FLOOR(datediff(CURRENT_DATE,&lt;span style=&quot;font-weight:bold;&quot;&gt;DOB&lt;/span&gt;)/365) &lt; 35) THEN &#39;25-35&#39;&lt;br /&gt;       WHEN ( FLOOR(datediff(CURRENT_DATE,&lt;span style=&quot;font-weight:bold;&quot;&gt;DOB&lt;/span&gt;)/365) &gt; 35 AND FLOOR(datediff(CURRENT_DATE,&lt;span style=&quot;font-weight:bold;&quot;&gt;DOB&lt;/span&gt;)/365) &lt; 50) THEN &#39;35-50&#39;&lt;br /&gt;       ELSE &#39;Above 50&#39;&lt;br /&gt;       END as Age_Group,&lt;br /&gt;       count(*) as Reviews&lt;br /&gt;FROM&lt;br /&gt;    &lt;span style=&quot;font-style:italic;&quot;&gt;Table names&lt;/span&gt;&lt;br /&gt;WHERE&lt;br /&gt;    &lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;Field Constraints&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;group by Age_Group;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;NOTE:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;DOB:&lt;/span&gt;Date of Birth field&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.5/in/&quot;&gt;&lt;img alt=&quot;Creative Commons License&quot; style=&quot;border-width: 0pt;&quot; src=&quot;http://i.creativecommons.org/l/by-nc-sa/2.5/in/80x15.png&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://pravinsreedharan.blogspot.com/feeds/2608781958928460080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pravinsreedharan.blogspot.com/2009/01/mysql-case-when-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/2608781958928460080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/2608781958928460080'/><link rel='alternate' type='text/html' href='http://pravinsreedharan.blogspot.com/2009/01/mysql-case-when-example.html' title='MYSQL CASE WHEN EXAMPLE'/><author><name>Pravin Sreedharan</name><uri>http://www.blogger.com/profile/05981079611678404183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2116456529380549639.post-1788989246142574929</id><published>2009-01-23T11:47:00.001+05:30</published><updated>2009-01-23T17:09:25.311+05:30</updated><title type='text'>Dear Readers</title><content type='html'>Finally a blog to pen down my daily coding work...!! I have been thinking of setting up a blog for quite a long time where in i could write just about anything new that i keep learning about LAMP Stack and of course!! to keep a track of my coding tricks.....Keep watching this space for more posts...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.5/in/&quot;&gt;&lt;img alt=&quot;Creative Commons License&quot; style=&quot;border-width: 0pt;&quot; src=&quot;http://i.creativecommons.org/l/by-nc-sa/2.5/in/80x15.png&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://pravinsreedharan.blogspot.com/feeds/1788989246142574929/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pravinsreedharan.blogspot.com/2009/01/dear-readers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/1788989246142574929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2116456529380549639/posts/default/1788989246142574929'/><link rel='alternate' type='text/html' href='http://pravinsreedharan.blogspot.com/2009/01/dear-readers.html' title='Dear Readers'/><author><name>Pravin Sreedharan</name><uri>http://www.blogger.com/profile/05981079611678404183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>