<?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: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-3554313364149478671</id><updated>2011-12-13T01:16:21.431-08:00</updated><title type='text'>PHP For Freshers..</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default?start-index=101&amp;max-results=100'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>111</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3142237399378860583</id><published>2011-12-13T01:16:00.000-08:00</published><updated>2011-12-13T01:16:21.441-08:00</updated><title type='text'>Add user in joomla from outside</title><content type='html'>#############Created By Rahul Dev Sharma ###################&lt;br /&gt; #### Insert user into joomla data base from out side #######&lt;br /&gt; ############################################################&lt;br /&gt; &lt;br /&gt; include('affut_org_connect.php');&lt;br /&gt; $name = $first_name. " ".$middle_name. " " .$last_name;&lt;br /&gt; $queryForInsertInMicrosite = "insert into `jos_users` set `name` = '".$name. "',&lt;br /&gt;  `username`  = '".$email_address."',&lt;br /&gt;  `email`  = '".$email_address."',&lt;br /&gt;  `password`  = '".md5($password)."',&lt;br /&gt;  `usertype`  = 'Registered',&lt;br /&gt;  `block`  = '0',&lt;br /&gt;  `sendEmail` = '1',&lt;br /&gt;  `gid`  = '18',&lt;br /&gt;  `registerDate` = '".date('Y-m-d h:i:s')."',&lt;br /&gt;  `lastvisitDate` = '".date('Y-m-d h:i:s')."',&lt;br /&gt;  `activation` = ''";&lt;br /&gt; &lt;br /&gt; if(mysql_query($queryForInsertInMicrosite))&lt;br /&gt; {&lt;br /&gt;  // insert into jos_core_acl_aro&lt;br /&gt;  $insert_user_id = mysql_insert_id();&lt;br /&gt;  $queryForInsertInto2Table = "INSERT INTO `jos_core_acl_aro` SET `section_value` = 'user' , `value` = '".$insert_user_id."', `name` = '".$name."', `hidden` ='0'"; &lt;br /&gt;  if(mysql_query($queryForInsertInto2Table))&lt;br /&gt;  {&lt;br /&gt;   $aro_id = mysql_insert_id();&lt;br /&gt;   // insert into `jos_core_acl_groups_aro_map` table&lt;br /&gt;   $queryForInsertInto3Table = "INSERT INTO `jos_core_acl_groups_aro_map` SET `group_id` = '18' , `aro_id` = '".$aro_id."'"; &lt;br /&gt;   if(!mysql_query($queryForInsertInto3Table))&lt;br /&gt;   {&lt;br /&gt;    mysql_query("DELETE FROM `jos_core_acl_aro` WHERE `id` = '".$aro_id."'");&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   mysql_query("DELETE FROM `jos_users` WHERE `id` = '".$insert_user_id."'");&lt;br /&gt;  }&lt;br /&gt; }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3142237399378860583?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3142237399378860583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3142237399378860583' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3142237399378860583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3142237399378860583'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/12/add-user-in-joomla-from-outside.html' title='Add user in joomla from outside'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2017679004062678138</id><published>2011-08-07T01:30:00.000-07:00</published><updated>2011-08-07T01:30:07.130-07:00</updated><title type='text'>Warning: file_get_contents(lang.tmp) [function.file-get-contents]: failed to open stream: No such file or directory in E:\xampp\htdocs\xampp\index.php on line 2</title><content type='html'>Use the link "http://localhost/xampp/lang.php?en" to recreate this file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2017679004062678138?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2017679004062678138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2017679004062678138' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2017679004062678138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2017679004062678138'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/08/warning-filegetcontentslangtmp.html' title='Warning: file_get_contents(lang.tmp) [function.file-get-contents]: failed to open stream: No such file or directory in E:\xampp\htdocs\xampp\index.php on line 2'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3650628951221566448</id><published>2011-07-17T20:57:00.001-07:00</published><updated>2011-07-17T20:57:15.677-07:00</updated><title type='text'>How many ways we can we find the current date using MySQL?</title><content type='html'>ANSWER:SELECT CURDATE();&lt;br /&gt;SELECT CURRENT_DATE();&lt;br /&gt;SELECT CURTIME();&lt;br /&gt;SELECT CURRENT_TIME();&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3650628951221566448?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3650628951221566448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3650628951221566448' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3650628951221566448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3650628951221566448'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/how-many-ways-we-can-we-find-current.html' title='How many ways we can we find the current date using MySQL?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-1955045411897362136</id><published>2011-07-17T20:56:00.003-07:00</published><updated>2011-07-17T20:56:47.290-07:00</updated><title type='text'>Q.9 What are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()?</title><content type='html'>mysql_fetch_array() -&gt; Fetch a result row as a combination of associative array and regular array.&lt;br /&gt;mysql_fetch_object() -&gt; Fetch a result row as an object.&lt;br /&gt;mysql_fetch_row() -&gt; Fetch a result set as a regular array().&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-1955045411897362136?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/1955045411897362136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=1955045411897362136' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1955045411897362136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1955045411897362136'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/q9-what-are-differences-between.html' title='Q.9 What are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2634111945930025067</id><published>2011-07-17T20:56:00.001-07:00</published><updated>2011-07-17T20:56:22.609-07:00</updated><title type='text'>difference of move(), and copy() function in php?</title><content type='html'>copy() function copy images for temp folder on server to&lt;br /&gt;move other location. move() function cut images for temp&lt;br /&gt;folder on server to move other location.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2634111945930025067?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2634111945930025067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2634111945930025067' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2634111945930025067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2634111945930025067'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/difference-of-move-and-copy-function-in.html' title='difference of move(), and copy() function in php?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-6960477398848991007</id><published>2011-07-17T20:55:00.003-07:00</published><updated>2011-07-17T20:55:59.910-07:00</updated><title type='text'>How many error types in php?</title><content type='html'>1:fatal&lt;br /&gt;2:notice&lt;br /&gt;3:warning&lt;br /&gt;4:parse&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-6960477398848991007?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/6960477398848991007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=6960477398848991007' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6960477398848991007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6960477398848991007'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/how-many-error-types-in-php.html' title='How many error types in php?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-6169828135119791051</id><published>2011-07-17T20:55:00.001-07:00</published><updated>2011-07-17T20:55:30.854-07:00</updated><title type='text'>How can we register the variables into a session?</title><content type='html'>session_register($session_var);&lt;br /&gt;&lt;br /&gt;$_SESSION['var'] = 'value';&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-6169828135119791051?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/6169828135119791051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=6169828135119791051' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6169828135119791051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6169828135119791051'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/how-can-we-register-variables-into.html' title='How can we register the variables into a session?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-1002350027772653953</id><published>2011-07-17T20:54:00.001-07:00</published><updated>2011-07-17T20:54:51.041-07:00</updated><title type='text'>What are the differences between require and include, include_once?</title><content type='html'>require_once() and include_once() are both the functions to include and evaluate the specified file only once. If the specified file is included previous to the present call occurrence, it will not be done again.&lt;br /&gt;&lt;br /&gt;But require() and include() will do it as many times they are asked to do.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-1002350027772653953?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/1002350027772653953/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=1002350027772653953' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1002350027772653953'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1002350027772653953'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/what-are-differences-between-require.html' title='What are the differences between require and include, include_once?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-1385500149663142557</id><published>2011-07-17T20:53:00.004-07:00</published><updated>2011-07-17T20:53:48.896-07:00</updated><title type='text'>How can we repair a MySQL table?</title><content type='html'>REPAIR TABLE tablename&lt;br /&gt;REPAIR TABLE tablename QUICK&lt;br /&gt;REPAIR TABLE tablename EXTENDED&lt;br /&gt;&lt;br /&gt;This command will repair the table specified.&lt;br /&gt;If QUICK is given, MySQL will do a repair of only the index tree.&lt;br /&gt;If EXTENDED is given, it will create index row by row.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-1385500149663142557?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/1385500149663142557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=1385500149663142557' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1385500149663142557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1385500149663142557'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/how-can-we-repair-mysql-table.html' title='How can we repair a MySQL table?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3895585059732964747</id><published>2011-07-17T20:53:00.002-07:00</published><updated>2011-07-17T20:53:26.625-07:00</updated><title type='text'>What is meant by PEAR in php?</title><content type='html'>PEAR is the next revolution in PHP. This repository is bringing higher level programming to PHP. PEAR is a framework and distribution system for reusable PHP components. It eases installation by bringing an automated wizard, and packing the strength and experience of PHP users into a nicely organised OOP library. PEAR also provides a command-line interface that can be used to automatically install&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3895585059732964747?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3895585059732964747/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3895585059732964747' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3895585059732964747'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3895585059732964747'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/what-is-meant-by-pear-in-php.html' title='What is meant by PEAR in php?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-5259285481341335102</id><published>2011-07-17T20:53:00.000-07:00</published><updated>2011-07-17T20:53:01.375-07:00</updated><title type='text'>What's PHP</title><content type='html'>The PHP Hypertext Preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-5259285481341335102?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/5259285481341335102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=5259285481341335102' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5259285481341335102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5259285481341335102'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/whats-php.html' title='What&apos;s PHP'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-4424447173671358482</id><published>2011-07-17T20:51:00.001-07:00</published><updated>2011-07-17T20:51:57.474-07:00</updated><title type='text'>What is C++?</title><content type='html'>Released in 1985, C++ is an object-oriented programming language created by Bjarne Stroustrup. C++ maintains almost all aspects of the C language, while simplifying memory management and adding several features - including a new datatype known as a class (you will learn more about these later) - to allow object-oriented programming. C++ maintains the features of C which allowed for low-level memory access but also gives the programmer new tools to simplify memory management.&lt;br /&gt;&lt;br /&gt;C++ used for:&lt;br /&gt;&lt;br /&gt;C++ is a powerful general-purpose programming language. It can be used to create small programs or large applications. It can be used to make CGI scripts or console-only DOS programs. C++ allows you to create programs to do almost anything you need to do. The creator of C++, Bjarne Stroustrup, has put together a partial list of applications written in C++.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-4424447173671358482?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/4424447173671358482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=4424447173671358482' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4424447173671358482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4424447173671358482'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/what-is-c.html' title='What is C++?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-927994782061112437</id><published>2011-07-17T20:50:00.003-07:00</published><updated>2011-07-17T20:50:41.805-07:00</updated><title type='text'>.what is the name of Cake's database configuration file?</title><content type='html'>by default it is database.php.default, you can find it in /app/config/database.php.default&lt;br /&gt;for connecting to database, it should be renamed to database.php&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-927994782061112437?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/927994782061112437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=927994782061112437' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/927994782061112437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/927994782061112437'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/what-is-name-of-cakes-database_17.html' title='.what is the name of Cake&apos;s database configuration file?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-5009393685271307271</id><published>2011-07-17T20:50:00.001-07:00</published><updated>2011-07-17T20:50:19.797-07:00</updated><title type='text'>What is features in cake php?</title><content type='html'>list some of the features in Cake php&lt;br /&gt;&lt;br /&gt;1. Compatible with versions 4 and 5 of PHP&lt;br /&gt;2. MVC architecture&lt;br /&gt;3. Built-in validations&lt;br /&gt;4. Caching&lt;br /&gt;5. scaffolding&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-5009393685271307271?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/5009393685271307271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=5009393685271307271' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5009393685271307271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5009393685271307271'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/what-is-features-in-cake-php.html' title='What is features in cake php?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3588292640073356318</id><published>2011-07-17T20:49:00.003-07:00</published><updated>2011-07-17T20:49:51.309-07:00</updated><title type='text'>Q2. What are 3 important parts of MVC (MODEL-VIEW-CONTROLLER)?</title><content type='html'>ANSWER:&lt;br /&gt;1. The Model represents the application data&lt;br /&gt;2. The View renders a presentation of model data&lt;br /&gt;3. The Controller handles and routes requests made by the client&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3588292640073356318?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3588292640073356318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3588292640073356318' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3588292640073356318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3588292640073356318'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/q2-what-are-3-important-parts-of-mvc.html' title='Q2. What are 3 important parts of MVC (MODEL-VIEW-CONTROLLER)?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3645452574010328575</id><published>2011-07-17T20:49:00.001-07:00</published><updated>2011-07-17T20:49:18.406-07:00</updated><title type='text'>Q1. What is meant by MVC (MODEL-VIEW-CONTROLLER)?</title><content type='html'>model view controller, it is a software architecture, used to isolates business logic from presentation logic. cakephp is&lt;br /&gt;&lt;br /&gt;based on mvc pattern.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3645452574010328575?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3645452574010328575/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3645452574010328575' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3645452574010328575'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3645452574010328575'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/q1-what-is-meant-by-mvc-model-view.html' title='Q1. What is meant by MVC (MODEL-VIEW-CONTROLLER)?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-6098868295592069406</id><published>2011-07-17T20:48:00.004-07:00</published><updated>2011-07-17T20:48:40.479-07:00</updated><title type='text'>What are commonly used components of cakephp?</title><content type='html'>* Security&lt;br /&gt;* Sessions&lt;br /&gt;* Access control lists&lt;br /&gt;* Emails&lt;br /&gt;* Cookies&lt;br /&gt;* Authentication&lt;br /&gt;* Request handling&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-6098868295592069406?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/6098868295592069406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=6098868295592069406' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6098868295592069406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6098868295592069406'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/what-are-commonly-used-components-of.html' title='What are commonly used components of cakephp?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-6021171069570220693</id><published>2011-07-17T20:48:00.002-07:00</published><updated>2011-07-17T20:48:23.202-07:00</updated><title type='text'>What is a Component in cakephp?</title><content type='html'>Components are packages of logic that are shared between controllers. They are useful when a common logic or code is required between different controllers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-6021171069570220693?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/6021171069570220693/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=6021171069570220693' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6021171069570220693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6021171069570220693'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/what-is-component-in-cakephp.html' title='What is a Component in cakephp?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2803699793013613336</id><published>2011-07-17T20:48:00.000-07:00</published><updated>2011-07-17T20:48:00.215-07:00</updated><title type='text'>What is default function for a controller?</title><content type='html'>index() function&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2803699793013613336?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2803699793013613336/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2803699793013613336' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2803699793013613336'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2803699793013613336'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/what-is-default-function-for-controller.html' title='What is default function for a controller?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-158765393488036001</id><published>2011-07-17T20:47:00.003-07:00</published><updated>2011-07-17T20:47:31.543-07:00</updated><title type='text'>What are controllers?</title><content type='html'>A controller is used to manage the logic for a part of your application. Most commonly, controllers are used to manage the logic for a single model. Controllers can include any number of methods which are usually referred to as actions. Actions are controller methods used to display views. An action is a single method of a controller.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-158765393488036001?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/158765393488036001/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=158765393488036001' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/158765393488036001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/158765393488036001'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/what-are-controllers.html' title='What are controllers?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2545584827112641810</id><published>2011-07-17T20:47:00.001-07:00</published><updated>2011-07-17T20:47:11.368-07:00</updated><title type='text'>what is the name of Cake's database configuration file?</title><content type='html'>by default it is database.php.default, you can find it in /app/config/database.php.default&lt;br /&gt;for connecting to database, it should be renamed to database.php&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2545584827112641810?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2545584827112641810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2545584827112641810' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2545584827112641810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2545584827112641810'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/what-is-name-of-cakes-database.html' title='what is the name of Cake&apos;s database configuration file?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-7246796335169547817</id><published>2011-07-17T20:46:00.003-07:00</published><updated>2011-07-17T20:46:51.303-07:00</updated><title type='text'>list some of the features in Cake php</title><content type='html'>Compatible with versions 4 and 5 of PHP&lt;br /&gt;    MVC architecture&lt;br /&gt;    Built-in validations&lt;br /&gt;    Caching&lt;br /&gt;    scaffolding&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-7246796335169547817?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/7246796335169547817/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=7246796335169547817' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/7246796335169547817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/7246796335169547817'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/list-some-of-features-in-cake-php.html' title='list some of the features in Cake php'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-5967183431660142099</id><published>2011-07-17T20:46:00.001-07:00</published><updated>2011-07-17T20:46:28.483-07:00</updated><title type='text'>What are 3 important parts of MVC?</title><content type='html'>1   The Model represents the application data&lt;br /&gt; 2   The View renders a presentation of model data&lt;br /&gt; 3   The Controller handles and routes requests made by the client&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-5967183431660142099?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/5967183431660142099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=5967183431660142099' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5967183431660142099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5967183431660142099'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/what-are-3-important-parts-of-mvc.html' title='What are 3 important parts of MVC?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-4405528308882163677</id><published>2011-07-17T20:45:00.001-07:00</published><updated>2011-07-17T20:45:39.392-07:00</updated><title type='text'>what is a component,helper and why are they used, is there other way we can do same thing, what is better.</title><content type='html'>A component is an independent piece of code written for specific task that can be used by calling in controllers (example : email component), helper is used for helping cakephp in rendering the data to be shown to user with views, these only adds to modularity in code otherwise same coding can be implemented in conrollers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-4405528308882163677?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/4405528308882163677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=4405528308882163677' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4405528308882163677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4405528308882163677'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2011/07/what-is-componenthelper-and-why-are.html' title='what is a component,helper and why are they used, is there other way we can do same thing, what is better.'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-827675180128205671</id><published>2010-09-04T04:46:00.000-07:00</published><updated>2010-09-04T04:46:22.884-07:00</updated><title type='text'>What is the use of friend function? What is friend function?</title><content type='html'>What is the use of friend function?&lt;br /&gt;&lt;br /&gt;Friend functions&lt;br /&gt;Sometimes a function is best shared among a number of different classes. Such functions can be declared either as member functions of one class or as global functions. In either case they can be set to be friends of other classes, by using a friend specifier in the class that is admitting them. Such functions can use all attributes of the class which names them as a friend, as if they were themselves members of that class.&lt;br /&gt;A friend declaration is essentially a prototype for a member function, but instead of requiring an implementation with the name of that class attached by the double colon syntax, a global function or member function of another class provides the match.&lt;br /&gt;class mylinkage&lt;br /&gt;{&lt;br /&gt;private:&lt;br /&gt;mylinkage * prev;&lt;br /&gt;mylinkage * next;&lt;br /&gt;&lt;br /&gt;protected:&lt;br /&gt;friend void set_prev(mylinkage* L, mylinkage* N);&lt;br /&gt;void set_next(mylinkage* L);&lt;br /&gt;&lt;br /&gt;public:&lt;br /&gt;mylinkage * succ();&lt;br /&gt;mylinkage * pred();&lt;br /&gt;mylinkage();&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;void mylinkage::set_next(mylinkage* L) { next = L; }&lt;br /&gt;&lt;br /&gt;void set_prev(mylinkage * L, mylinkage * N ) { N-&gt;prev = L; }&lt;br /&gt;&lt;br /&gt;Friends in other classes&lt;br /&gt;It is possible to specify a member function of another class as a friend as follows:&lt;br /&gt;class C&lt;br /&gt;{&lt;br /&gt;friend int B::f1();&lt;br /&gt;};&lt;br /&gt;class B&lt;br /&gt;{&lt;br /&gt;int f1();&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;It is also possible to specify all the functions in another class as friends, by specifying the entire class as a friend.&lt;br /&gt;class A&lt;br /&gt;{&lt;br /&gt;friend class B;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;Friend functions allow binary operators to be defined which combine private data in a pair of objects. This is particularly powerful when using the operator overloading features of C++. We will return to it when we look at overloading.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-827675180128205671?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/827675180128205671/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=827675180128205671' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/827675180128205671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/827675180128205671'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/09/what-is-use-of-friend-function-what-is.html' title='What is the use of friend function? What is friend function?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-7001568988652087380</id><published>2010-07-19T00:32:00.000-07:00</published><updated>2010-07-19T00:33:13.791-07:00</updated><title type='text'>Developing Desktop Applications in PHP for Beginners.</title><content type='html'>Introduction:&lt;br /&gt;&lt;br /&gt;We have been creating web-applications using PHP since it came into existence, now we can also develop Desktop or Stand alone Applications with PHP-GTK. Desktop Applications are one which does not need either a Web Server like IIS, Apache, PWS etc. or a web browser for their execution. One of the reasons why Java is so popular is because it can be used to build applications, web pages, applets and beans that can run on several platforms including Windows, Linux and Solaris. Java runs a virtual machine called JVM, and code is compiled into an intermediate format known as Java byte code, which is platform independent. When that particular piece of code is executed within the JVM, the JVM optimizes the code for the particular platform on which it is running as it is being compiled.&lt;br /&gt;&lt;br /&gt;Microsoft's latest technology, .NET follows the same principles. Code is compiled into Microsoft Intermediate Language (MSIL) and is then executed within the .NET framework as an application domain. Microsoft is hoping to standardize C# and MSIL so that .NET code can run cross platform.&lt;br /&gt;&lt;br /&gt;So what has all of this got to do with PHP-GTK? Well, both Java and .NET can be used to build windowed applications and web pages. Thanks to PHP-GTK, we can now build cross platform windowed applications with PHP as well.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-7001568988652087380?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://devzone.zend.com/article/2654' title='Developing Desktop Applications in PHP for Beginners.'/><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/7001568988652087380/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=7001568988652087380' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/7001568988652087380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/7001568988652087380'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/07/developing-desktop-applications-in-php.html' title='Developing Desktop Applications in PHP for Beginners.'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-729651267237981246</id><published>2010-07-13T03:48:00.000-07:00</published><updated>2010-07-13T03:50:12.186-07:00</updated><title type='text'>Condition in HABTM , CAKE , Pagination in data from a HABTM relationship</title><content type='html'>// app/controllers/categories_controller.php&lt;br /&gt;class CategoriesController extends AppController {&lt;br /&gt;public $paginate = array('Product' =&gt; array('limit' =&gt; 2, 'joins' =&gt; array( &lt;br /&gt;array( &lt;br /&gt;'table' =&gt; 'categories_products', &lt;br /&gt;'alias' =&gt; 'CategoriesProduct', &lt;br /&gt;'type' =&gt; 'inner',  &lt;br /&gt;'conditions'=&gt; array('CategoriesProduct.product_id = Product.id') &lt;br /&gt;), &lt;br /&gt;array( &lt;br /&gt;'table' =&gt; 'categories', &lt;br /&gt;'alias' =&gt; 'Category', &lt;br /&gt;'type' =&gt; 'inner',  &lt;br /&gt;'conditions'=&gt; array( &lt;br /&gt;'Category.id = CategoriesProduct.category_id', &lt;br /&gt;'Category.id' =&gt; 1 &lt;br /&gt;) &lt;br /&gt;))));&lt;br /&gt;&lt;br /&gt;public function index() {&lt;br /&gt;$data = $this-&gt;paginate('Product');&lt;br /&gt;debug($data);&lt;br /&gt;exit;&lt;br /&gt;} &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Output : &lt;br /&gt;Array&lt;br /&gt;(&lt;br /&gt;    [0] =&gt; Array&lt;br /&gt;        (&lt;br /&gt;            [Category] =&gt; Array&lt;br /&gt;                (&lt;br /&gt;                    [id] =&gt; 1&lt;br /&gt;                    [name] =&gt; PHP&lt;br /&gt;                )&lt;br /&gt;            [Product] =&gt; Array&lt;br /&gt;                (&lt;br /&gt;                    [0] =&gt; Array&lt;br /&gt;                        (&lt;br /&gt;                            [id] =&gt; 1&lt;br /&gt;                            [name] =&gt; CakePHP&lt;br /&gt;                        )&lt;br /&gt;                    [1] =&gt; Array&lt;br /&gt;                        (&lt;br /&gt;                            [id] =&gt; 2&lt;br /&gt;                            [name] =&gt; Zend&lt;br /&gt;                        )&lt;br /&gt;                    [2] =&gt; Array&lt;br /&gt;                        (&lt;br /&gt;                            [id] =&gt; 3&lt;br /&gt;                            [name] =&gt; Symfony&lt;br /&gt;                        )&lt;br /&gt;                )&lt;br /&gt;        )&lt;br /&gt;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-729651267237981246?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://cakebaker.42dh.com/2007/10/17/pagination-of-data-from-a-habtm-relationship/' title='Condition in HABTM , CAKE , Pagination in data from a HABTM relationship'/><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/729651267237981246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=729651267237981246' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/729651267237981246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/729651267237981246'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/07/condition-in-habtm-cake-pagination-in.html' title='Condition in HABTM , CAKE , Pagination in data from a HABTM relationship'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2239694857183840419</id><published>2010-07-09T01:29:00.001-07:00</published><updated>2010-07-09T01:29:58.697-07:00</updated><title type='text'>send user mail from mail table</title><content type='html'>$message = $this-&gt;EmailManager-&gt;get('register_mail_to_user');&lt;br /&gt;    if(!empty($message))&lt;br /&gt;    {&lt;br /&gt;     $this-&gt;User-&gt;id = $this-&gt;data['User']['id'];&lt;br /&gt;     $from = Configure::read('Site.email');&lt;br /&gt;     $to = $this-&gt;data['User']['email'];&lt;br /&gt;     &lt;br /&gt;     $subject = $message['EmailManager']['subject'];&lt;br /&gt;&lt;br /&gt;     /*$url = Router::url(array(&lt;br /&gt;      'controller' =&gt; 'users',&lt;br /&gt;      'action' =&gt; 'activate',&lt;br /&gt;      $this-&gt;User-&gt;field('username'),&lt;br /&gt;      $this-&gt;User-&gt;field('activation_key'),&lt;br /&gt;     ), true);*/&lt;br /&gt;     &lt;br /&gt;     $url  = SITE_URL."users/activate/".$this-&gt;User-&gt;field('username')."/".$this-&gt;User-&gt;field('activation_key');&lt;br /&gt;     &lt;br /&gt;     //pr($url);&lt;br /&gt;     //$url = "&lt;a href='".$url."'&gt;Click&lt;/a&gt;";&lt;br /&gt;     //pr($url);&lt;br /&gt;     &lt;br /&gt;     $massage_tag = array(&lt;br /&gt;          "[USERNAME]",&lt;br /&gt;          "[ACTIVATIONLINK]",&lt;br /&gt;          "[SITENAME]"&lt;br /&gt;          );&lt;br /&gt;     $massage_tag_value = array(&lt;br /&gt;          $this-&gt;data['User']['username'],&lt;br /&gt;          $url,&lt;br /&gt;          Configure::read('Site.title')&lt;br /&gt;          );&lt;br /&gt;     &lt;br /&gt;     $body = str_replace($massage_tag,$massage_tag_value,$message['EmailManager']['message']);&lt;br /&gt;     &lt;br /&gt;     //pr($body);&lt;br /&gt;     $this-&gt;Email-&gt;lineLength = 255;&lt;br /&gt;     $this-&gt;Email-&gt;sendAs = 'both';&lt;br /&gt;     $send_mail = parent::sendMail($to, $subject, $body , $from,1); &lt;br /&gt;     //pr($this-&gt;Email);&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2239694857183840419?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2239694857183840419/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2239694857183840419' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2239694857183840419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2239694857183840419'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/07/send-user-mail-from-mail-table.html' title='send user mail from mail table'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-1623326764800108043</id><published>2010-07-09T01:28:00.000-07:00</published><updated>2010-07-09T01:28:20.559-07:00</updated><title type='text'>Send Mail Function :Cake</title><content type='html'>function sendMail($To, $Subject, $msg, $From, $smtp="1")&lt;br /&gt; {&lt;br /&gt;  $this-&gt;Email-&gt;to      = $To;&lt;br /&gt;  $this-&gt;Email-&gt;from    = $From;&lt;br /&gt;  $this-&gt;Set("message", $msg);&lt;br /&gt;  $this-&gt;Email-&gt;subject = $Subject;&lt;br /&gt;  $this-&gt;Email-&gt;template = "default";&lt;br /&gt;  $this-&gt;Email-&gt;sendAs = 'both';&lt;br /&gt;  &lt;br /&gt;  if($smtp == 1)&lt;br /&gt;  {&lt;br /&gt;   $this-&gt;Email-&gt;smtpOptions = array(&lt;br /&gt;   'port'=&gt;'25', &lt;br /&gt;   'timeout'=&gt;'30',&lt;br /&gt;   'host' =&gt; 'relay.airtelbroadband.in',&lt;br /&gt;   'username'=&gt;$From,&lt;br /&gt;   'password'=&gt;'octal123'&lt;br /&gt;   );&lt;br /&gt;   $this-&gt;Email-&gt;delivery = 'smtp';&lt;br /&gt;  }&lt;br /&gt;  $this-&gt;Email-&gt;delivery = 'smtp';&lt;br /&gt;  &lt;br /&gt;  if($this-&gt;Email-&gt;send($msg))&lt;br /&gt;  {&lt;br /&gt;   return true;&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   return false;&lt;br /&gt;  }&lt;br /&gt; }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-1623326764800108043?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/1623326764800108043/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=1623326764800108043' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1623326764800108043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1623326764800108043'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/07/send-mail-function-cake.html' title='Send Mail Function :Cake'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-8324971874715508862</id><published>2010-04-02T02:32:00.002-07:00</published><updated>2010-04-22T23:51:26.732-07:00</updated><title type='text'>htaccess : Stop browser prefetching &amp; information</title><content type='html'>RewriteEngine On&lt;br /&gt;SetEnvIfNoCase X-Forwarded-For .+ proxy=yes&lt;br /&gt;SetEnvIfNoCase X-moz prefetch no_access=yes&lt;br /&gt;&lt;br /&gt;# block pre-fetch requests with X-moz headers&lt;br /&gt;RewriteCond %{ENV:no_access} yes&lt;br /&gt;RewriteRule .* - [F,L]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-8324971874715508862?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/8324971874715508862/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=8324971874715508862' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/8324971874715508862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/8324971874715508862'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-stop-browser-prefetching.html' title='htaccess : Stop browser prefetching &amp; information'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-5256760643083157672</id><published>2010-04-02T02:32:00.000-07:00</published><updated>2010-04-02T02:32:00.331-07:00</updated><title type='text'>.htaccess : Prevent Files image/file hotlinking and bandwidth stealing</title><content type='html'>RewriteEngine On&lt;br /&gt;RewriteBase /&lt;br /&gt;RewriteCond %{HTTP_REFERER} !^$&lt;br /&gt;RewriteCond %{HTTP_REFERER} !^http://(www\.)?askapache.com/.*$ [NC]&lt;br /&gt;RewriteRule \.(gif|jpg|swf|flv|png)$ /feed/ [R=302,L]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-5256760643083157672?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/5256760643083157672/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=5256760643083157672' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5256760643083157672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5256760643083157672'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-prevent-files-imagefile.html' title='.htaccess : Prevent Files image/file hotlinking and bandwidth stealing'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-4730725964623902280</id><published>2010-04-02T02:31:00.003-07:00</published><updated>2010-04-02T02:31:37.621-07:00</updated><title type='text'>.htaccess : Only allow GET and PUT Request Methods</title><content type='html'>Article: Request Methods&lt;br /&gt;&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteBase /&lt;br /&gt;RewriteCond %{REQUEST_METHOD} !^(GET|PUT)&lt;br /&gt;RewriteRule .* - [F]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-4730725964623902280?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/4730725964623902280/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=4730725964623902280' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4730725964623902280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4730725964623902280'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-only-allow-get-and-put-request.html' title='.htaccess : Only allow GET and PUT Request Methods'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3460383867666910997</id><published>2010-04-02T02:31:00.001-07:00</published><updated>2010-04-02T02:31:04.042-07:00</updated><title type='text'>.htaccess : Redirecting Wordpress Feeds to Feedburner</title><content type='html'>Full article:Redirecting Wordpress Feeds to Feedburner&lt;br /&gt;&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteBase /&lt;br /&gt;RewriteCond %{REQUEST_URI} ^/feed\.gif$&lt;br /&gt;RewriteRule .* - [L]&lt;br /&gt; &lt;br /&gt;RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC]&lt;br /&gt;RewriteRule ^feed/?.*$ http://feeds.feedburner.com/apache/htaccess [L,R=302]&lt;br /&gt; &lt;br /&gt;RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;RewriteRule . /index.php [L]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3460383867666910997?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3460383867666910997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3460383867666910997' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3460383867666910997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3460383867666910997'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-redirecting-wordpress-feeds-to.html' title='.htaccess : Redirecting Wordpress Feeds to Feedburner'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2877887929093511672</id><published>2010-04-02T02:30:00.002-07:00</published><updated>2010-04-02T02:30:35.812-07:00</updated><title type='text'>htaccess : Require no subdomain</title><content type='html'>RewriteEngine On&lt;br /&gt;RewriteBase /&lt;br /&gt;RewriteCond %{HTTP_HOST} \.([^\.]+\.[^\.0-9]+)$&lt;br /&gt;RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2877887929093511672?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2877887929093511672/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2877887929093511672' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2877887929093511672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2877887929093511672'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-require-no-subdomain_02.html' title='htaccess : Require no subdomain'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-9134332878310731963</id><published>2010-04-02T02:30:00.000-07:00</published><updated>2010-04-02T02:30:06.814-07:00</updated><title type='text'>htaccess : Require no subdomain</title><content type='html'>RewriteEngine On&lt;br /&gt;RewriteBase /&lt;br /&gt;RewriteCond %{HTTP_HOST} \.([a-z-]+\.[a-z]{2,6})$ [NC]&lt;br /&gt;RewriteRule ^/(.*)$ http://%1/$1 [R=301,L]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-9134332878310731963?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/9134332878310731963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=9134332878310731963' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/9134332878310731963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/9134332878310731963'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-require-no-subdomain.html' title='htaccess : Require no subdomain'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3750096858304723785</id><published>2010-04-02T02:29:00.003-07:00</published><updated>2010-04-02T02:29:35.571-07:00</updated><title type='text'>Require the www without hardcoding</title><content type='html'>Options +FollowSymLinks&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteBase /&lt;br /&gt;RewriteCond %{HTTP_HOST} !^www\.[a-z-]+\.[a-z]{2,6} [NC]&lt;br /&gt;RewriteCond %{HTTP_HOST} ([a-z-]+\.[a-z]{2,6})$     [NC]&lt;br /&gt;RewriteRule ^/(.*)$ http://%1/$1 [R=301,L]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3750096858304723785?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3750096858304723785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3750096858304723785' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3750096858304723785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3750096858304723785'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/require-www-without-hardcoding.html' title='Require the www without hardcoding'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3732268126667162932</id><published>2010-04-02T02:29:00.001-07:00</published><updated>2010-04-02T02:29:13.736-07:00</updated><title type='text'>.htaccess : Rewrite underscores to hyphens for SEO URL</title><content type='html'>Converts all underscores “_” in urls to hyphens “-” for SEO benefits… See the full article for more info.&lt;br /&gt;&lt;br /&gt;Options +FollowSymLinks&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteBase /&lt;br /&gt; &lt;br /&gt;RewriteRule !\.(html|php)$ - [S=4]&lt;br /&gt;RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5 [E=uscor:Yes]&lt;br /&gt;RewriteRule ^([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4 [E=uscor:Yes]&lt;br /&gt;RewriteRule ^([^_]*)_([^_]*)_(.*)$ $1-$2-$3 [E=uscor:Yes]&lt;br /&gt;RewriteRule ^([^_]*)_(.*)$ $1-$2 [E=uscor:Yes]&lt;br /&gt; &lt;br /&gt;RewriteCond %{ENV:uscor} ^Yes$&lt;br /&gt;RewriteRule (.*) http://d.com/$1 [R=30&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3732268126667162932?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3732268126667162932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3732268126667162932' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3732268126667162932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3732268126667162932'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-rewrite-underscores-to-hyphens.html' title='.htaccess : Rewrite underscores to hyphens for SEO URL'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-4234316084540956879</id><published>2010-04-02T02:28:00.001-07:00</published><updated>2010-04-02T02:28:48.893-07:00</updated><title type='text'>.htaccess : block access to files during certain hours of the day</title><content type='html'>Options +FollowSymLinks&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteBase /&lt;br /&gt;# If the hour is 16 (4 PM) Then deny all access&lt;br /&gt;RewriteCond %{TIME_HOUR} ^16$&lt;br /&gt;RewriteRule ^.*$ - [F,L]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-4234316084540956879?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/4234316084540956879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=4234316084540956879' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4234316084540956879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4234316084540956879'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-block-access-to-files-during.html' title='.htaccess : block access to files during certain hours of the day'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2613244430569893373</id><published>2010-04-02T02:27:00.003-07:00</published><updated>2010-04-02T02:27:35.024-07:00</updated><title type='text'>.htaccess : Internal Redirect .php files to .html files (SEO friendly)</title><content type='html'>Redirects all files that end in .html to be served from filename.php so it looks like all your pages are .html but really they are .php&lt;br /&gt;&lt;br /&gt;RewriteRule ^(.*)\.html$ $1.php [R=301,L]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2613244430569893373?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2613244430569893373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2613244430569893373' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2613244430569893373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2613244430569893373'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-internal-redirect-php-files-to.html' title='.htaccess : Internal Redirect .php files to .html files (SEO friendly)'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2134507597650873647</id><published>2010-04-02T02:27:00.001-07:00</published><updated>2010-04-02T02:27:12.901-07:00</updated><title type='text'>htaccess : External Redirect .php files to .html files (SEO friendly)</title><content type='html'>RewriteRule ^(.*)\.php$ /$1.html [R=301,L]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2134507597650873647?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2134507597650873647/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2134507597650873647' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2134507597650873647'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2134507597650873647'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-external-redirect-php-files-to.html' title='htaccess : External Redirect .php files to .html files (SEO friendly)'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-116182467586374234</id><published>2010-04-02T02:26:00.003-07:00</published><updated>2010-04-02T02:26:45.087-07:00</updated><title type='text'>.htaccess : Fix for infinite loops</title><content type='html'>An error message related to this isRequest exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.or you may seeRequest exceeded the limit,probable configuration error,Use 'LogLevel debug' to get a backtrace, orUse 'LimitInternalRecursion' to increase the limit if necessary&lt;br /&gt;&lt;br /&gt;RewriteCond %{ENV:REDIRECT_STATUS} 200&lt;br /&gt;RewriteRule .* - [L]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-116182467586374234?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/116182467586374234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=116182467586374234' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/116182467586374234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/116182467586374234'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-fix-for-infinite-loops.html' title='.htaccess : Fix for infinite loops'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-6657001551442589165</id><published>2010-04-02T02:26:00.001-07:00</published><updated>2010-04-02T02:26:12.205-07:00</updated><title type='text'>.htaccess : Removes the QUERY_STRING from the URL</title><content type='html'>If the QUERY_STRING has any value at all besides blank than the?at the end of /login.php? tells mod_rewrite to remove the QUERY_STRING from login.php and redirect.&lt;br /&gt;&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteBase /&lt;br /&gt;RewriteCond %{QUERY_STRING} .&lt;br /&gt;Rew&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-6657001551442589165?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/6657001551442589165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=6657001551442589165' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6657001551442589165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6657001551442589165'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-removes-querystring-from-url.html' title='.htaccess : Removes the QUERY_STRING from the URL'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2198825166326049483</id><published>2010-04-02T02:25:00.004-07:00</published><updated>2010-04-02T02:25:48.877-07:00</updated><title type='text'>htaccess : Check for a key in QUERY_STRING</title><content type='html'>Uses a RewriteCond Directive to check QUERY_STRING for passkey, if it doesn’t find it it redirects all requests for anything in the /logged-in/ directory to the /login.php script.&lt;br /&gt;&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteBase /&lt;br /&gt;RewriteCond %{QUERY_STRING} !passkey&lt;br /&gt;Rewrite&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2198825166326049483?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2198825166326049483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2198825166326049483' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2198825166326049483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2198825166326049483'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-check-for-key-in-querystring.html' title='htaccess : Check for a key in QUERY_STRING'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-6799037266104077207</id><published>2010-04-02T02:25:00.002-07:00</published><updated>2010-04-02T02:25:24.161-07:00</updated><title type='text'>htaccess : Require no www</title><content type='html'>Options +FollowSymLinks&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteBase /&lt;br /&gt;RewriteCond %{HTTP_HOST} !^askapache\.com$ [NC]&lt;br /&gt;RewriteRule ^(.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-6799037266104077207?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/6799037266104077207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=6799037266104077207' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6799037266104077207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6799037266104077207'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-require-no-www.html' title='htaccess : Require no www'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-8392861085626353849</id><published>2010-04-02T02:25:00.000-07:00</published><updated>2010-04-02T02:25:00.320-07:00</updated><title type='text'>.htaccess : Deny access to anything in a subfolder except php fopen</title><content type='html'>This can be very handy if you want to serve media files or special dowmloeds but only through a php proxy script.&lt;br /&gt;&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteBase /&lt;br /&gt;RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+)/.*\ HTTP [NC]&lt;br /&gt;RewriteRule .* - [F,L&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-8392861085626353849?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/8392861085626353849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=8392861085626353849' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/8392861085626353849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/8392861085626353849'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-deny-access-to-anything-in.html' title='.htaccess : Deny access to anything in a subfolder except php fopen'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3075907521159554044</id><published>2010-04-02T02:22:00.005-07:00</published><updated>2010-04-02T02:22:58.862-07:00</updated><title type='text'>.htaccess : Deny Access To Everyone Except PHP fopen</title><content type='html'>This allows access to all files by php fopen, but denies anyone else.&lt;br /&gt;&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteBase /&lt;br /&gt;RewriteCond %{THE_REQUEST} ^.+$ [NC]&lt;br /&gt;RewriteRule .* - [F,L]&lt;br /&gt;&lt;br /&gt;If you are looking for ways to block or deny specific requests/visitors, then you should definately read Blacklist with mod_rewrite. I give it a 10/10&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3075907521159554044?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3075907521159554044/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3075907521159554044' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3075907521159554044'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3075907521159554044'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-deny-access-to-everyone-except.html' title='.htaccess : Deny Access To Everyone Except PHP fopen'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-1833898899694521742</id><published>2010-04-02T02:22:00.003-07:00</published><updated>2010-04-02T02:22:32.290-07:00</updated><title type='text'>htaccess : Setting the language variable based on Client</title><content type='html'>For sites using multiviews or with multiple language capabilities, it is nice to be able to send the correct language automatically based on the clients preferred language.&lt;br /&gt;&lt;br /&gt;RewriteCond %{HTTP:Accept-Language} ^.*(de|es|fr|it|ja|ru|en).*$ [NC]&lt;br /&gt;RewriteRule ^(.*)$ - [env=prefer-language:%1]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-1833898899694521742?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/1833898899694521742/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=1833898899694521742' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1833898899694521742'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1833898899694521742'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-setting-language-variable.html' title='htaccess : Setting the language variable based on Client'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2463500876193828570</id><published>2010-04-02T02:22:00.001-07:00</published><updated>2010-04-02T02:22:09.056-07:00</updated><title type='text'>.htaccess : Sending requests to a php script</title><content type='html'>This .htaccess rewrite example invisibly rewrites requests for all Adobe pdf files to be handled by /cgi-bin/pdf-script.php&lt;br /&gt;&lt;br /&gt;RewriteRule ^(.+)\.pdf$  /cgi-bin/pdf-script.php?file=$1.pdf [L,NC,QSA]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2463500876193828570?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2463500876193828570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2463500876193828570' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2463500876193828570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2463500876193828570'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-sending-requests-to-php-script.html' title='.htaccess : Sending requests to a php script'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-572000781427478459</id><published>2010-04-02T02:21:00.001-07:00</published><updated>2010-04-02T02:21:13.190-07:00</updated><title type='text'>.htaccess : Removing the Query_String</title><content type='html'>On many sites, the page will be displayed for both page.html and page.html?anything=anything, which hurts your SEO with duplicate content. An easy way to fix this issue is to redirect external requests containing a query string to the same uri without the query_string.&lt;br /&gt;&lt;br /&gt;RewriteCond %{THE_REQUEST} ^GET\ /.*\;.*\ HTTP/&lt;br /&gt;RewriteCond %{QUERY_STRING} !^$&lt;br /&gt;RewriteRule .* http://www.askapache.com%{REQUEST_URI}? [R=301,L]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-572000781427478459?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/572000781427478459/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=572000781427478459' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/572000781427478459'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/572000781427478459'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-removing-querystring.html' title='.htaccess : Removing the Query_String'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-7421834733235254581</id><published>2010-04-02T02:19:00.003-07:00</published><updated>2010-04-02T02:19:36.367-07:00</updated><title type='text'>.htaccess : Cache-Friendly File Names</title><content type='html'>This is probably my favorite, and I use it on every site I work on. It allows me to update my javascript and css files in my visitors cache’s simply by naming them differently in the html, on the server they stay the same name. This rewrites all files for /zap/j/anything-anynumber.js to /zap/j/anything.js and /zap/c/anything-anynumber.css to /zap/c/anything.css&lt;br /&gt;&lt;br /&gt;RewriteRule ^zap/(j|c)/([a-z]+)-([0-9]+)\.(js|css)$ /zap/$1/$2.$4 [L]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-7421834733235254581?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/7421834733235254581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=7421834733235254581' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/7421834733235254581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/7421834733235254581'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-cache-friendly-file-names.html' title='.htaccess : Cache-Friendly File Names'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2118604365480261691</id><published>2010-04-02T02:19:00.001-07:00</published><updated>2010-04-02T02:19:08.562-07:00</updated><title type='text'>.htaccess : Loop Stopping Code</title><content type='html'>RewriteCond %{REQUEST_URI} ^/(stats/|missing\.html|failed_auth\.html|error/).* [NC]&lt;br /&gt;RewriteRule .* - [L]&lt;br /&gt; &lt;br /&gt;RewriteCond %{ENV:REDIRECT_STATUS} 200&lt;br /&gt;RewriteRule .* - [L]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2118604365480261691?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2118604365480261691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2118604365480261691' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2118604365480261691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2118604365480261691'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-loop-stopping-code.html' title='.htaccess : Loop Stopping Code'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2543087555540690174</id><published>2010-04-02T02:18:00.002-07:00</published><updated>2010-04-02T02:18:35.689-07:00</updated><title type='text'>.htaccess : Require the www</title><content type='html'>Options +FollowSymLinks&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteBase /&lt;br /&gt;RewriteCond %{HTTP_HOST} !^www\.askapache\.com$ [NC]&lt;br /&gt;RewriteRule ^(.*)$ http://www.askapache.com/$1 [R=301,L]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2543087555540690174?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2543087555540690174/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2543087555540690174' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2543087555540690174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2543087555540690174'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-require-www.html' title='.htaccess : Require the www'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-8221191933988377867</id><published>2010-04-02T02:18:00.000-07:00</published><updated>2010-04-02T02:18:12.774-07:00</updated><title type='text'>.htaccess rewrite examples should begin with:</title><content type='html'>Options +FollowSymLinks&lt;br /&gt; &lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteBase /&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-8221191933988377867?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/8221191933988377867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=8221191933988377867' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/8221191933988377867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/8221191933988377867'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-rewrite-examples-should-begin.html' title='.htaccess rewrite examples should begin with:'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-7446737050638463391</id><published>2010-04-02T02:14:00.001-07:00</published><updated>2010-04-02T02:14:18.501-07:00</updated><title type='text'>htaccess : URL Rewriting</title><content type='html'>URL rewriting takes the url submitted by the browser and adjusts it to be interpretted by the web server in a different way.  In othewords, rewriting allows you to send people to yourdomain.com/a/1/b/2/c/3 and the server will serve up the page for yourdomain.com/index.php?a=1&amp;b=2$c=3.  What this does is allow you to take dynamic urls and rewrite them to look and act like static urls.  The benefit to this is that it enables some search engines to index your page using parameters they would not previously have been able to.&lt;br /&gt;&lt;br /&gt;URL rewriting can be helpful in a few ways. The most common URL rewriting is done on Apache servers.  To set up URL rewriting on an Apache server, you need to be able to access the .htaccess file.  In the directory where you want to perform URL rewriting, you need to open the .htaccess file.  If it does not have one, create a new one.  If you do not know how to do this, click on the .htaccess "home" link to the left.&lt;br /&gt;&lt;br /&gt;URL rewriting at its best uses regular expression.  HowGuru.com addresses regular expression elsewhere on the site, but a brief statement will suffice here.  Here is the structure of a rewrite statement:&lt;br /&gt;&lt;br /&gt;&lt;IfModule mod_rewrite.c&gt;&lt;br /&gt;  RewriteEngine on&lt;br /&gt;  RewriteCond %{REQUEST_FILENAME} -d&lt;br /&gt;  RewriteRule ^(.*)$ page.php?variable_1=$1 [QSA,L]&lt;br /&gt; &lt;/IfModule&gt; &lt;br /&gt;&lt;br /&gt;The "&lt;IfModule mod_rewrite.c&gt;" tells the server to look for the rewrite module, if the server can rewrite urls, then follow the code until "&lt;/IfModule&gt;."  Othewise, if the server does not have a rewrite module, it will ignore the information between the "if" brackets.&lt;br /&gt;&lt;br /&gt;The next line ("RewriteEngine on") activates this function on the server.&lt;br /&gt;&lt;br /&gt;The next line ("RewriteCond %{REQUEST_FILENAME} –d")states a condition for the rule to apply.  In this case, a file name is being requested.&lt;br /&gt;&lt;br /&gt;Finally comes the rule with is proceeded by "RewriteRule".  This is followed by the regular expression statement defining what pattern to look for, which is followed by the destination file and/or query string combination to search for on the server.&lt;br /&gt;&lt;br /&gt;The regular expression is pretty easy to understand.  Regular expression is all about finding patterns, the “^” indicates the beginning of the input.  The “$” at the end indicates the end of the input.  Numbered variables are assigned to each pattern that meets the criteria in each set of parenthesis.  So if I wrote:&lt;br /&gt;&lt;br /&gt;RewriteRule ^(.*)$ page.php?var_1=$1 [QSA,L]&lt;br /&gt;&lt;br /&gt;The “(.*)” refers to any set of numbers and letters and length long, this is then referred to in the destination page portion of the rule as “$1”.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-7446737050638463391?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/7446737050638463391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=7446737050638463391' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/7446737050638463391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/7446737050638463391'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-url-rewriting.html' title='htaccess : URL Rewriting'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-6886903153492491972</id><published>2010-04-02T02:13:00.001-07:00</published><updated>2010-04-02T02:13:15.341-07:00</updated><title type='text'>htaccess : Control access</title><content type='html'>.htaccess is most often used to restrict or deny access to individual files and folders. A typical example would be an "includes" folder. Your site's pages can call these included scripts all they like, but you don't want users accessing these files directly, over the web. In that case you would drop an .htaccess file in the includes folder with content something like this..&lt;br /&gt;&lt;br /&gt;    NO ENTRY!&lt;br /&gt;    # no one gets in here!&lt;br /&gt;    deny from all&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;which would deny ALL direct access to ANY files in that folder. You can be more specific with your conditions, for instance limiting access to a particular IP range, here's a handy top-level rule for a local test server..&lt;br /&gt;&lt;br /&gt;    NO ENTRY outside of the LAN!&lt;br /&gt;    # no nasty crackers in here!&lt;br /&gt;    order deny,allow&lt;br /&gt;    deny from all&lt;br /&gt;    allow from 192.168.0.0/24&lt;br /&gt;    # this would do the same thing..&lt;br /&gt;    #allow from 192.168.0&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Generally these sorts of requests would bounce off your firewall anyway, but on a live server (like my dev mirror sometimes is) they become useful for filtering out undesirable IP blocks, known risks, lots of things. By the way, in case you hadn't spotted; lines beginning with "#" are ignored by Apache; handy for comments.&lt;br /&gt;&lt;br /&gt;Sometimes, you will only want to ban one IP, perhaps some persistent robot that doesn't play by the rules..&lt;br /&gt;&lt;br /&gt;    post user agent every fifth request only. hmmm. ban IP..&lt;br /&gt;    # someone else giving the ruskies a bad name..&lt;br /&gt;    order allow,deny&lt;br /&gt;    deny from 83.222.23.219&lt;br /&gt;    allow from all&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The usual rules for IP addresses apply, so you can use partial matches, ranges, and so on. Whatever, the user gets a 403 "access denied" error page in their client software (browser, usually), which certainly gets the message across. This is probably fine for most situations, but in part two I'll demonstrate some cooler ways to deny access, as well as how to deny those nasty web suckers, bad referrers, script kiddies and more.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-6886903153492491972?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/6886903153492491972/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=6886903153492491972' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6886903153492491972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6886903153492491972'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-control-access.html' title='htaccess : Control access'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2862276849982197582</id><published>2010-04-02T02:11:00.000-07:00</published><updated>2010-04-02T02:11:08.626-07:00</updated><title type='text'>.htaccess : Password protected directories..</title><content type='html'>The next most obvious use for our .htaccess files is to allow access to only specific users, or user groups, in other words; password protected folders. a simple authorisation mechanism might look something like this..&lt;br /&gt;&lt;br /&gt;    a simple sample .htaccess file for password protection:&lt;br /&gt;    AuthType Basic&lt;br /&gt;    AuthName "restricted area"&lt;br /&gt;    AuthUserFile /usr/local/var/www/html/.htpasses&lt;br /&gt;    require valid-user&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can use this same mechanism to limit only certain kinds of requests, too..&lt;br /&gt;&lt;br /&gt;    only valid users can POST in here, anyone can GET, PUT, etc:&lt;br /&gt;    AuthType Basic&lt;br /&gt;    AuthName "restricted area"&lt;br /&gt;    AuthUserFile /usr/local/var/www/html/.htpasses&lt;br /&gt;    &lt;Limit POST&gt;&lt;br /&gt;     require valid-user&lt;br /&gt;    &lt;/Limit&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can find loads of online examples of how to setup authorization using .htaccess, and so long as you have a real  user (or create one, in this case, 'jimmy') with a real  password (you will be prompted for this, twice) in a real  password file (the -c switch will create it)..&lt;br /&gt;&lt;br /&gt;htpasswd -c /usr/local/var/www/html/.htpasses jimmy&lt;br /&gt;&lt;br /&gt;..the above will work just fine. htpasswd is a tool that comes free with Apache, specifically for making and updating password files, check it out. The windows version is the same; only the file path needs to be changed; to wherever you want to put the password file.&lt;br /&gt;&lt;br /&gt;Note: if the Apache bin/ folder isn't in your PATH, you will need to cd into that directory before performing the command. Also note: You can use forward and back-slashes interchangeably with Apache/php on Windows, so this would work just fine..&lt;br /&gt;&lt;br /&gt;htpasswd -c c:/unix/usr/local/Apache2/conf/.htpasses jimmy&lt;br /&gt;&lt;br /&gt;Relative paths are fine too; assuming you were inside the bin/ directory of our fictional Apache install, the following would do exactly the same as the above..&lt;br /&gt;&lt;br /&gt;htpasswd -c ../conf/.htpasses jimmy&lt;br /&gt;&lt;br /&gt;Naming the password file .htpasses is a habit from when I had to keep that file inside the web site itself, and as web servers are configured to ignore files beginning with .ht, they too, remain hidden. If you keep your password file outside the web root (a better idea), then you can call it whatever you like, but the .ht_something habit is a good one to keep, even inside the web tree, it is secure enough for our basic  purpose..&lt;br /&gt;&lt;br /&gt;Once they are logged in, you can access the remote_user environmental variable, and do stuff with it..&lt;br /&gt;&lt;br /&gt;    the remote_user variable is now available..&lt;br /&gt;    RewriteEngine on&lt;br /&gt;    RewriteCond %{remote_user} !^$ [nc]&lt;br /&gt;    RewriteRule ^(.*)$ /users/%{remote_user}/$1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2862276849982197582?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2862276849982197582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2862276849982197582' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2862276849982197582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2862276849982197582'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-password-protected-directories.html' title='.htaccess : Password protected directories..'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-649825308786504855</id><published>2010-04-02T02:10:00.001-07:00</published><updated>2010-04-02T02:10:27.274-07:00</updated><title type='text'>.htaccess : 500 error</title><content type='html'>If you add something that the server doesn't understand or support, you will get a 500 error page, aka.. "the server did a boo-boo". Even directives that work perfectly on your test server at home may fail dramatically at your real site. In fact this is a great way to find out if .htaccess files are enabled on your site; create one, put some gibberish in it, and load a page in that folder, wait for the 500 error. if there isn't one, probably they are not enabled.&lt;br /&gt;&lt;br /&gt;If they are, we need a way to safely do live-testing without bringing the whole site to a 500 standstill.&lt;br /&gt;&lt;br /&gt;Fortunately, in much the same way as we used the &lt;Limit&gt; tag above, we can create conditional directives, things which will only come into effect if certain conditions are true. The most useful of these is the "ifModule" condition, which goes something like this..&lt;br /&gt;&lt;br /&gt;    only if PHP is loaded, will this directive have any effect (switch the 4 for a 5 if using php5)&lt;br /&gt;    &lt;ifModule mod_php4.c&gt;&lt;br /&gt;     php_value default_charset utf-8&lt;br /&gt;    &lt;/ifModule&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;..which placed in your master .htaccess file, that would set the default character encoding of your entire site to utf-8 (a good idea!), at least, anything output by PHP. If the PHP4** module isn't running on the server, the above .htaccess directive will do exactly nothing; Apache just ignores it. As well as proofing us against knocking the server into 500 mode, this also makes our .htaccess directives that wee bit more portable. Of course, if your syntax is messed-up, no amount of if-module-ing is going to prevent a error of some kind, all the more reason to practice this stuff on a local test server.&lt;br /&gt;&lt;br /&gt;    ** note: if you are using php5, you would obviously instead use &lt;ifModule mod_php5.c&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-649825308786504855?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/649825308786504855/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=649825308786504855' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/649825308786504855'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/649825308786504855'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-500-error.html' title='.htaccess : 500 error'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-7175152536657789364</id><published>2010-04-02T02:09:00.003-07:00</published><updated>2010-04-02T02:09:51.541-07:00</updated><title type='text'>.htaccess : Groovy things to do with .htaccess..</title><content type='html'>So far we've only scratched the surface. Aside from authorisation, the humble .htaccess file can be put to all kinds of uses. If you've ever had a look in my public archives you will have noticed that that the directories are fully browsable, just like in the old days before adult web hosts realized how to turn that feature off! A line like this..&lt;br /&gt;&lt;br /&gt;    bring back the directories!&lt;br /&gt;    Options +Indexes +MultiViews +FollowSymlinks&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;..will almost certainly turn it back on again. And if you have mod_autoindex.c installed on your server (probably, yes), you can get nice fancy indexing, too..&lt;br /&gt;&lt;br /&gt;    show me those files!&lt;br /&gt;    &lt;IfModule mod_autoindex.c&gt;&lt;br /&gt;     IndexOptions FancyIndexing&lt;br /&gt;    &lt;/ifModule&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;..which, as well as being neater, allows users to click the titles and, for instance, order the listing by date, or file size, or whatever. It's all for free too, built-in to the server, we're just switching it on. You can control certain parameters too..&lt;br /&gt;&lt;br /&gt;    let's go all the way!&lt;br /&gt;    &lt;IfModule mod_autoindex.c&gt;&lt;br /&gt;     IndexOptions FancyIndexing IconHeight=16 IconWidth=16&lt;br /&gt;    &lt;/ifModule&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Other parameters you could add include..&lt;br /&gt;&lt;br /&gt;    NameWidth=30&lt;br /&gt;    DescriptionWidth=30&lt;br /&gt;    IconsAreLinks SuppressHTMLPreamble (handy!)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I'm not mentioning the "XHTML" parameter in Apache2, because it still isn't! Anyways, I've chucked one of my old fancy indexing .htaccess file onsite for you to have some fun with. Just add readme.html and away you go! note: these days I use a single header files for all  the indexes..&lt;br /&gt;&lt;br /&gt;    HeaderName /inc/header.html&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.. and only drop in local "readme" files. Check out the example, and my public archives for more details.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-7175152536657789364?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/7175152536657789364/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=7175152536657789364' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/7175152536657789364'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/7175152536657789364'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-groovy-things-to-do-with.html' title='.htaccess : Groovy things to do with .htaccess..'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2184251682412556789</id><published>2010-04-02T02:09:00.001-07:00</published><updated>2010-04-02T02:09:10.597-07:00</updated><title type='text'>custom directory index files</title><content type='html'>While I'm here, it's worth mentioning that .htaccess is where you can specify which files you want to use as your indexes, that is, if a user requests /foo/, Apache will serve up /foo/index.html, or whatever file you specify.&lt;br /&gt;&lt;br /&gt;You can also specify multiple files, and Apache will look for each in order, and present the first one it finds. It's generally setup something like..&lt;br /&gt;&lt;br /&gt;    DirectoryIndex index.html index.php index.htm&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;It really is worth scouting around the Apache documentation, often you will find controls for things you imagined were uncontrollable, thereby creating new possibilities, better options for your website. My experience of the magic "LAMP" (Linux-Apache-MySQL-PHP) has been.. "If you can imagine that it can be done, it can be done". Swap "Linux" for any decent operating system, the "AMP" part runs on most of them.&lt;br /&gt;&lt;br /&gt;Okay, so now we have nice fancy directories, and some of them password protected, if you don't watch out, you're site will get popular, and that means bandwidth..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2184251682412556789?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2184251682412556789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2184251682412556789' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2184251682412556789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2184251682412556789'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/custom-directory-index-files.html' title='custom directory index files'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-8668388005800948014</id><published>2010-04-02T02:07:00.001-07:00</published><updated>2010-04-02T02:07:29.905-07:00</updated><title type='text'>.htaccess : </title><content type='html'>These days, using &lt;FilesMatch&gt; is preferred over &lt;Files&gt;, mainly because you can use regular expression in the conditions (very handy), produce clean, more readable code. Here's an example. which I use for my php-generated style sheets..&lt;br /&gt;&lt;br /&gt;    parse file.css and file.style with the php machine..&lt;br /&gt;    # handler for phpsuexec..&lt;br /&gt;    &lt;FilesMatch "\.(css|style)$"&gt;&lt;br /&gt;     SetHandler application/x-httpd-php&lt;br /&gt;    &lt;/FilesMatch&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Any files with a *.css or *.style extension will now be handled by php, rather than simply served up by Apache. And because you can use regexp, you could do stuff like &lt;FilesMatch "\.s?html$"&gt;, which is handy. Any &lt;Files&gt; statements you come across can be advantageously replaced by &lt;FilesMatch&gt; statements. Good to know.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-8668388005800948014?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/8668388005800948014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=8668388005800948014' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/8668388005800948014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/8668388005800948014'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess.html' title='.htaccess : &lt;FilesMatch&gt;'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-1774731934110716652</id><published>2010-04-02T02:06:00.001-07:00</published><updated>2010-04-02T02:06:48.607-07:00</updated><title type='text'>Hide and deny files..</title><content type='html'>Do you remember I mentioned that any file beginning with .ht is invisible? .."almost every web server in the world is configured to ignore them, by default" and that is, of course, because .ht_anything files generally have server directives and passwords and stuff in them, most  servers will have something like this in their main configuration..&lt;br /&gt;&lt;br /&gt;    Standard setting..&lt;br /&gt;    &lt;Files ~ "^\.ht"&gt;&lt;br /&gt;     Order allow,deny&lt;br /&gt;     Deny from all&lt;br /&gt;     Satisfy All&lt;br /&gt;    &lt;/Files&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;which instructs the server to deny access to any file beginning with .ht, effectively protecting our .htaccess and other files. The "." at the start prevents them being displayed in an index, and the .ht prevents them being accessed. This version..&lt;br /&gt;&lt;br /&gt;    ignore what you want&lt;br /&gt;    &lt;Files ~ "^.*\.([Ll][Oo][Gg])"&gt;&lt;br /&gt;     Order allow,deny&lt;br /&gt;     Deny from all&lt;br /&gt;     Satisfy All&lt;br /&gt;    &lt;/Files&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;tells the server to deny access to *.log files. You can insert multiple file types into each rule, separating them with a pipe "|", and you can insert multiple blocks into your .htaccess file, too. I find it convenient to put all the files starting with a dot into one, and the files with denied extensions into another, something like this..&lt;br /&gt;&lt;br /&gt;    the whole lot&lt;br /&gt;    # deny all .htaccess, .DS_Store $hî†é and ._* (resource fork) files&lt;br /&gt;    &lt;Files ~ "^\.([Hh][Tt]|[Dd][Ss]_[Ss]|[_])"&gt;&lt;br /&gt;     Order allow,deny&lt;br /&gt;     Deny from all&lt;br /&gt;     Satisfy All&lt;br /&gt;    &lt;/Files&gt;&lt;br /&gt;&lt;br /&gt;    # deny access to all .log and .comment files&lt;br /&gt;    &lt;Files ~ "^.*\.([Ll][Oo][Gg]|[cC][oO][mM][mM][eE][nN][tT])"&gt;&lt;br /&gt;     Order allow,deny&lt;br /&gt;     Deny from all&lt;br /&gt;     Satisfy All&lt;br /&gt;    &lt;/Files&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;would cover all ._* resource fork files, .DS_Store files (which the Mac Finder creates all over the place) *.log files, *.comment files and of course, our .ht* files. You can add whatever file types you need to protect from direct access. I think it's clear now why the file is called ".htaccess".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-1774731934110716652?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/1774731934110716652/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=1774731934110716652' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1774731934110716652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1774731934110716652'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/hide-and-deny-files.html' title='Hide and deny files..'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3826611755506433002</id><published>2010-04-02T02:05:00.001-07:00</published><updated>2010-04-02T02:05:59.762-07:00</updated><title type='text'>htaccess : save bandwidth</title><content type='html'>If you pay for your bandwidth, this wee line could save you hard cash..&lt;br /&gt;&lt;br /&gt;    save me hard cash! and help the internet!&lt;br /&gt;    &lt;ifModule mod_php4.c&gt;&lt;br /&gt;     php_value zlib.output_compression 16386&lt;br /&gt;    &lt;/ifModule&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;All it does is enables PHP's built-in transparent zlib compression. This will half your bandwidth usage in one stroke, more than that, in fact. Of course it only works with data being output by the PHP module, but if you design your pages with this in mind, you can use php echo statements, or better yet, php "includes" for your plain html output and just compress everything! Remember, if you run phpsuexec, you'll need to put php directives in a local php.ini file, not .htaccess. See here for more details.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3826611755506433002?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3826611755506433002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3826611755506433002' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3826611755506433002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3826611755506433002'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-save-bandwidth.html' title='htaccess : save bandwidth'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-5763065263439353655</id><published>2010-04-02T02:04:00.000-07:00</published><updated>2010-04-02T02:04:31.773-07:00</updated><title type='text'>htaccess rules</title><content type='html'>If you are looking for the examples of URL rewriting then this post might be useful for you. In this post, I’ve given five useful examples of URL rewriting using .htacess. If you don’t know something about url rewriting then please check my older post about url rewriting using .htaccess.&lt;br /&gt;&lt;br /&gt;Now let’s look at the examples&lt;br /&gt;&lt;br /&gt;1)Rewriting product.php?id=12 to product-12.html&lt;br /&gt;&lt;br /&gt;It is a simple redirection in which .php extension is hidden from the browser’s address bar and dynamic url (containing “?” character) is converted into a static URL.&lt;br /&gt;&lt;br /&gt;RewriteEngine on&lt;br /&gt;RewriteRule ^product-([0-9]+)\.html$ product.php?id=$1&lt;br /&gt;&lt;br /&gt;2) Rewriting product.php?id=12 to product/ipod-nano/12.html&lt;br /&gt;&lt;br /&gt;SEO expert always suggest to display the main keyword in the URL. In the following URL rewriting technique you can display the name of the product in URL.&lt;br /&gt;&lt;br /&gt;RewriteEngine on&lt;br /&gt;RewriteRule ^product/([a-zA-Z0-9_-]+)/([0-9]+)\.html$ product.php?id=$2&lt;br /&gt;&lt;br /&gt;3) Redirecting non www URL to www URL&lt;br /&gt;&lt;br /&gt;If you type yahoo.com in browser it will be redirected to www.yahoo.com. If you want to do same with your website then put the following code to .htaccess file. What is benefit of this kind of redirection?? Please check the post about SEO friendly redirect (301) redirect in php and .htaccess.&lt;br /&gt;&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteCond %{HTTP_HOST} ^optimaxwebsolutions\.com$&lt;br /&gt;RewriteRule (.*) http://www.optimaxwebsolutions.com/$1 [R=301,L]&lt;br /&gt;&lt;br /&gt;4) Rewriting yoursite.com/user.php?username=xyz to yoursite.com/xyz&lt;br /&gt;&lt;br /&gt;Have you checked zorpia.com.If you type http://zorpia.com/roshanbh233 in browser you can see my profile over there. If you want to do the same kind of redirection i.e http://yoursite.com/xyz to http://yoursite.com/user.php?username=xyz then you can add the following code to the .htaccess file.&lt;br /&gt;&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1&lt;br /&gt;RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1&lt;br /&gt;&lt;br /&gt;5) Redirecting the domain to a new subfolder of inside public_html.&lt;br /&gt;&lt;br /&gt;Suppose the you’ve redeveloped your site and all the new development reside inside the “new” folder of inside root folder.Then the new development of the website can be accessed like “test.com/new”. Now moving these files to the root folder can be a hectic process so you can create the following code inside the .htaccess file and place it under the root folder of the website. In result, www.test.com point out to the files inside “new” folder.&lt;br /&gt;&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteCond %{HTTP_HOST} ^test\.com$ [OR]&lt;br /&gt;RewriteCond %{HTTP_HOST} ^www\.test\.com$&lt;br /&gt;RewriteCond %{REQUEST_URI} !^/new/&lt;br /&gt;RewriteRule (.*) /new/$1&lt;br /&gt;&lt;br /&gt;Popularity: 85% [?]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-5763065263439353655?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html' title='htaccess rules'/><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/5763065263439353655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=5763065263439353655' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5763065263439353655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5763065263439353655'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-rules.html' title='htaccess rules'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-5463941401283272899</id><published>2010-04-02T01:58:00.001-07:00</published><updated>2010-04-02T01:58:47.694-07:00</updated><title type='text'>htaccess Control access,Control access by htaccess</title><content type='html'>.htaccess is most often used to restrict or deny access to individual files and folders. A typical example would be an "includes" folder. Your site's pages can call these included scripts all they like, but you don't want users accessing these files directly, over the web. In that case you would drop an .htaccess file in the includes folder with content something like this..&lt;br /&gt;&lt;br /&gt;    NO ENTRY!&lt;br /&gt;    # no one gets in here!&lt;br /&gt;    deny from all&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;which would deny ALL direct access to ANY files in that folder. You can be more specific with your conditions, for instance limiting access to a particular IP range, here's a handy top-level rule for a local test server..&lt;br /&gt;&lt;br /&gt;    NO ENTRY outside of the LAN!&lt;br /&gt;    # no nasty crackers in here!&lt;br /&gt;    order deny,allow&lt;br /&gt;    deny from all&lt;br /&gt;    allow from 192.168.0.0/24&lt;br /&gt;    # this would do the same thing..&lt;br /&gt;    #allow from 192.168.0&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Generally these sorts of requests would bounce off your firewall anyway, but on a live server (like my dev mirror sometimes is) they become useful for filtering out undesirable IP blocks, known risks, lots of things. By the way, in case you hadn't spotted; lines beginning with "#" are ignored by Apache; handy for comments.&lt;br /&gt;&lt;br /&gt;Sometimes, you will only want to ban one IP, perhaps some persistent robot that doesn't play by the rules..&lt;br /&gt;&lt;br /&gt;    post user agent every fifth request only. hmmm. ban IP..&lt;br /&gt;    # someone else giving the ruskies a bad name..&lt;br /&gt;    order allow,deny&lt;br /&gt;    deny from 83.222.23.219&lt;br /&gt;    allow from all&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The usual rules for IP addresses apply, so you can use partial matches, ranges, and so on. Whatever, the user gets a 403 "access denied" error page in their client software (browser, usually), which certainly gets the message across. This is probably fine for most situations, but in part two I'll demonstrate some cooler ways to deny access, as well as how to deny those nasty web suckers, bad referrers, script kiddies and more.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-5463941401283272899?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/5463941401283272899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=5463941401283272899' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5463941401283272899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5463941401283272899'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/04/htaccess-control-accesscontrol-access.html' title='htaccess Control access,Control access by htaccess'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-145901281087742656</id><published>2010-03-30T00:16:00.000-07:00</published><updated>2010-03-30T00:24:44.429-07:00</updated><title type='text'>Cake Controller Extensions ("Components"), Components in Cake</title><content type='html'>A Component is a class that aids in controller logic. If you have some logic you want to share between controllers (or applications), a component is usually a good fit. As an example, the core EmailComponent class makes creating and sending emails a snap. Rather than writing a controller method in a single controller that performs this logic, you can package the logic so it can be shared.&lt;br /&gt;&lt;br /&gt;Controllers are also fitted with callbacks. These callbacks are available for your use, just in case you need to insert some logic between CakePHP’s core operations. Callbacks available include:&lt;br /&gt;&lt;br /&gt;* beforeFilter(), executed before any controller action logic&lt;br /&gt;* beforeRender(), executed after controller logic, but before the view is rendered&lt;br /&gt;* afterFilter(), executed after all controller logic, including the view render. There may be no difference between afterRender() and afterFilter() unless you’ve manually made a call to render() in your controller action and have included some logic after that call.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-145901281087742656?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/145901281087742656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=145901281087742656' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/145901281087742656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/145901281087742656'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/03/controller-extensions-components.html' title='Cake Controller Extensions (&quot;Components&quot;), Components in Cake'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-8241740834539933171</id><published>2010-03-30T00:10:00.001-07:00</published><updated>2010-03-30T00:10:20.630-07:00</updated><title type='text'>Basic Principles of CakePHP</title><content type='html'>The CakePHP framework provides a robust base for your application. It can handle every aspect, from the user’s initial request all the way to the final rendering of a web page. And since the framework follows the principles of MVC, it allows you to easily customize and extend most aspects of your application.&lt;br /&gt;&lt;br /&gt;The framework also provides a basic organizational structure, from filenames to database table names, keeping your entire application consistent and logical. This concept is simple but powerful. Follow the conventions and you’ll always know exactly where things are and how they’re organized.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-8241740834539933171?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/8241740834539933171/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=8241740834539933171' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/8241740834539933171'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/8241740834539933171'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/03/basic-principles-of-cakephp.html' title='Basic Principles of CakePHP'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-8150712755149767487</id><published>2010-03-29T23:55:00.001-07:00</published><updated>2010-03-29T23:55:15.570-07:00</updated><title type='text'>CakePHP? Why Use it?</title><content type='html'>CakePHP is a free, open-source, rapid development framework for PHP. 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.&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;CakePHP has an active developer team and community, bringing great value to the project. In addition to keeping you from wheel-reinventing, using CakePHP means your application’s core is well tested and is being constantly improved.&lt;br /&gt;&lt;br /&gt;Here’s a quick list of features you’ll enjoy when using CakePHP:&lt;br /&gt;&lt;br /&gt;    * Active, friendly community&lt;br /&gt;    * Flexible licensing&lt;br /&gt;    * Compatible with versions 4 and 5 of PHP&lt;br /&gt;    * Integrated CRUD for database interaction&lt;br /&gt;    * Application scaffolding&lt;br /&gt;    * Code generation&lt;br /&gt;    * MVC architecture&lt;br /&gt;    * Request dispatcher with clean, custom URLs and routes&lt;br /&gt;    * Built-in validation&lt;br /&gt;    * Fast and flexible templating (PHP syntax, with helpers)&lt;br /&gt;    * View Helpers for AJAX, JavaScript, HTML Forms and more&lt;br /&gt;    * Email, Cookie, Security, Session, and Request Handling Components&lt;br /&gt;    * Flexible ACL&lt;br /&gt;    * Data Sanitization&lt;br /&gt;    * Flexible Caching&lt;br /&gt;    * Localization&lt;br /&gt;    * Works from any web site directory, with little to no Apache configuration involved&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-8150712755149767487?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/8150712755149767487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=8150712755149767487' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/8150712755149767487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/8150712755149767487'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/03/cakephp-why-use-it.html' title='CakePHP? Why Use it?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3256574344148238135</id><published>2010-03-29T23:53:00.001-07:00</published><updated>2010-03-29T23:53:57.812-07:00</updated><title type='text'>what is Model, View, Controller, MVC</title><content type='html'>Model–View–Controller (MVC) is a software architecture[1], currently considered an architectural pattern used in software engineering. The pattern isolates "domain logic" (the application logic for the user) from input and presentation (GUI), permitting independent development, testing and maintenance of each.&lt;br /&gt;&lt;br /&gt;The model is the domain-specific representation of the data upon which the application operates. Domain logic adds meaning to raw data (for example, calculating whether today is the user's birthday, or the totals, taxes, and shipping charges for shopping cart items). When a model changes its state, it notifies its associated views so they can refresh.&lt;br /&gt;&lt;br /&gt;Many applications use a persistent storage mechanism such as a database to store data. MVC does not specifically mention the data access layer because it is understood to be underneath or encapsulated by the model. Models are not data access objects; however, in very simple apps that have little domain logic there is no real distinction to be made. Also, the ActiveRecord is an accepted design pattern which merges domain logic and data access code - a model which knows how to persist itself.&lt;br /&gt;&lt;br /&gt;The view renders the model into a form suitable for interaction, typically a user interface element. Multiple views can exist for a single model for different purposes.&lt;br /&gt;&lt;br /&gt;The controller receives input and initiates a response by making calls on model objects.&lt;br /&gt;&lt;br /&gt;An MVC application may be a collection of model/view/controller triplets, each responsible for a different UI element.&lt;br /&gt;&lt;br /&gt;MVC is often seen in web applications where the view is the HTML or XHTML generated by the app. The controller receives GET or POST input and decides what to do with it, handing over to domain objects (i.e. the model) that contain the business rules and know how to carry out specific tasks such as processing a new subscription.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3256574344148238135?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3256574344148238135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3256574344148238135' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3256574344148238135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3256574344148238135'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/03/what-is-model-view-controller-mvc.html' title='what is Model, View, Controller, MVC'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2040545424682850613</id><published>2010-03-29T23:52:00.000-07:00</published><updated>2010-03-29T23:52:06.562-07:00</updated><title type='text'>Scaffolding</title><content type='html'>Scaffolding is a temporary structure used to support people and material in the construction or repair of buildings and other large structures. It is usually a modular system of metal pipes (termed tubes in Britain), although it can be made out of other materials. Bamboo is still used in some Asian&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2040545424682850613?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2040545424682850613/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2040545424682850613' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2040545424682850613'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2040545424682850613'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/03/scaffolding.html' title='Scaffolding'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-4740157934795717310</id><published>2010-03-25T05:16:00.001-07:00</published><updated>2010-03-25T05:16:25.327-07:00</updated><title type='text'>What is Payment Gateway integration?</title><content type='html'>A payment gateway can be defined as a third party service, which is a combination of hardware and software that provides an interface to the bank credit card processing network. The credit card information is collected and is transferred over the Internet to the credit card processors in the encrypted format for transaction purpose. Some well-known payment gateways are AuthorizeNet, Google Checkout, USAePay, Verisign and Paypal.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-4740157934795717310?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/4740157934795717310/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=4740157934795717310' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4740157934795717310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4740157934795717310'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/03/what-is-payment-gateway-integration.html' title='What is Payment Gateway integration?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-5660153228993068045</id><published>2010-03-25T05:09:00.000-07:00</published><updated>2010-03-25T05:15:41.459-07:00</updated><title type='text'>Integrations with php, PHP INTEGRATION , PAYMENT INTEGRATION.</title><content type='html'>&lt;b&gt;Payment Gateway integration&lt;/b&gt;&lt;br /&gt;1. Google Checkout Integration&lt;br /&gt;2. paypal standard integration (https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&amp;content_ID=developer/howto_html_landing)&lt;br /&gt;3. paypal pro integration php (https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&amp;content_ID=developer/howto_api_paymentspro)&lt;br /&gt;4. Payflow Link () (https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&amp;content_ID=developer/howto_gateway_payflow_link)&lt;br /&gt;5. Payflow Pro (https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&amp;content_ID=developer/howto_gateway_payflowpro)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-5660153228993068045?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/5660153228993068045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=5660153228993068045' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5660153228993068045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5660153228993068045'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/03/integrations-with-php-php-integration.html' title='Integrations with php, PHP INTEGRATION , PAYMENT INTEGRATION.'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-5727724518583504253</id><published>2010-03-25T02:30:00.000-07:00</published><updated>2010-03-25T02:36:03.945-07:00</updated><title type='text'>PHP source in browser, show php code , show_source();</title><content type='html'>Show the source of the current file:&lt;br /&gt;/* some code here */&lt;br /&gt;show_source(__FILE__);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-5727724518583504253?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/5727724518583504253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=5727724518583504253' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5727724518583504253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5727724518583504253'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/03/php-source-in-browser-show-php-code.html' title='PHP source in browser, show php code , show_source();'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-936364764092406413</id><published>2010-03-24T23:29:00.000-07:00</published><updated>2010-03-25T01:50:47.190-07:00</updated><title type='text'>Special MySQL Query : Control Statement in Query , CASE CONDITION, IF CONDITION</title><content type='html'>SELECT CASE `parent_id` WHEN '0' THEN `name` ELSE `id` END AS `resumt` FROM `categories` LIMIT 0 , 30&lt;br /&gt;==============================================================================&lt;br /&gt;&lt;br /&gt;SELECT * FROM categories WHERE id =40 ORDER BY CASE WHEN image IS NULL THEN id ELSE parent_id END LIMIT 0 , 30 &lt;br /&gt;==============================================================================&lt;br /&gt;&lt;br /&gt;SELECT * FROM categories order by CASE WHEN (select `image` from `categories` where `id` = '40') IS NULL THEN id ELSE parent_id END &lt;br /&gt;==============================================================================&lt;br /&gt;&lt;br /&gt;http://dev.mysql.com/doc/refman/5.1/en/control-flow-functions.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-936364764092406413?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://dev.mysql.com/doc/refman/5.1/en/control-flow-functions.html' title='Special MySQL Query : Control Statement in Query , CASE CONDITION, IF CONDITION'/><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/936364764092406413/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=936364764092406413' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/936364764092406413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/936364764092406413'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/03/special-my-sql-query-case-condition.html' title='Special MySQL Query : Control Statement in Query , CASE CONDITION, IF CONDITION'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2959801034524017500</id><published>2010-02-26T01:38:00.000-08:00</published><updated>2010-02-26T01:38:17.310-08:00</updated><title type='text'>Javascript Check Numeric , Get Numeric , Enter Only Numeric function</title><content type='html'>function isNumberKey(t)&lt;br /&gt; {&lt;br /&gt;  if(t.value == 0 || t.value == '0')&lt;br /&gt;  t.value = 'a';&lt;br /&gt;  &lt;br /&gt;  var patt1 = /(\d{3}).*(\d{3}).*(\d{4})/;&lt;br /&gt;  var patt2 = /^\((\d{3})\).(\d{3})-(\d{4})$/;&lt;br /&gt;  var str = t.value;&lt;br /&gt;  var result;&lt;br /&gt;  if (!str.match(patt2))&lt;br /&gt;  {result = str.match(patt1);&lt;br /&gt;  if (result!= null)&lt;br /&gt;  {t.value = t.value.replace(/[^\d]/gi,'');&lt;br /&gt;  //str = '(' + result[1] + ') ' + result[2] + '-' + result[3];&lt;br /&gt;  t.value = str;&lt;br /&gt;  }else{&lt;br /&gt;  if (t.value.match(/[^\d]/gi))&lt;br /&gt;  t.value = t.value.replace(/[^\d]/gi,'');&lt;br /&gt;  }}&lt;br /&gt; }&lt;br /&gt;ex:  onkeyup="isNumberKey(this);"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2959801034524017500?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2959801034524017500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2959801034524017500' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2959801034524017500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2959801034524017500'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/02/javascript-check-numeric-get-numeric.html' title='Javascript Check Numeric , Get Numeric , Enter Only Numeric function'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2282249089868740681</id><published>2010-02-05T23:52:00.000-08:00</published><updated>2010-02-05T23:52:32.719-08:00</updated><title type='text'>Cake Html Link ,  Ajax Links , $html-&gt;link , $this-&gt;ajax</title><content type='html'>echo $html-&gt;image("add_btn.jpg" , array(&lt;br /&gt;           "alt" =&gt;"Make Favourite",&lt;br /&gt;           "id"=&gt;"addImg".$products['Product']['id'], &lt;br /&gt;           "title" =&gt; "Choose this product to purchase",&lt;br /&gt;           "alt" =&gt; "Choose this product to purchase",&lt;br /&gt;           "onclick"=&gt;"checkEmpty('".'product_quantity'.$products['Product']['id']."')"&lt;br /&gt;           )&lt;br /&gt;       );&lt;br /&gt;---------------------------------------------------------------&lt;br /&gt;echo $ajax-&gt;link( &lt;br /&gt;  $html-&gt;image("add_btn.jpg" , &lt;br /&gt;     array(&lt;br /&gt;      "alt" =&gt;"Select Product",&lt;br /&gt;      "id"=&gt;"addImg".$products['Product']['id'], &lt;br /&gt;      "title" =&gt; "Choose this product to purchase",&lt;br /&gt;      "alt" =&gt; "Choose this product to purchase",&lt;br /&gt;      "onclick"=&gt;"checkEmpty('".'product_quantity'.$products['Product']['id']."');  makedisable('distributorInnerDiv');  "&lt;br /&gt;      )&lt;br /&gt;     ),&lt;br /&gt;     array( 'controller' =&gt; 'products',&lt;br /&gt;      'action' =&gt; 'product_distributer',&lt;br /&gt;      $products['Product']['id'],&lt;br /&gt;      $qtyValue&lt;br /&gt;      ), &lt;br /&gt;    array( 'update' =&gt; 'distributorDiv')&lt;br /&gt;    , &lt;br /&gt;    NULL, &lt;br /&gt;    false&lt;br /&gt;    );&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2282249089868740681?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2282249089868740681/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2282249089868740681' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2282249089868740681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2282249089868740681'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/02/cake-html-link-ajax-links-html-link.html' title='Cake Html Link ,  Ajax Links , $html-&gt;link , $this-&gt;ajax'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2359215229347242038</id><published>2010-02-05T23:49:00.000-08:00</published><updated>2010-02-05T23:49:04.102-08:00</updated><title type='text'>Best For Interview , PHP4 , PHP5, PHP6 , PHP 4 vs 5 vs 6</title><content type='html'>PHP 4 and OOP ?&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;    * Poor Object model&lt;br /&gt;    * Methods&lt;br /&gt;          o No visibility&lt;br /&gt;          o No abstracts, No final&lt;br /&gt;          o Static without declaration&lt;br /&gt;    * Properties&lt;br /&gt;          o No static properties&lt;br /&gt;          o No constants&lt;br /&gt;    * Inheritance&lt;br /&gt;          o No abstract, final inheritance, no interfaces&lt;br /&gt;          o No prototype checking, no types&lt;br /&gt;    * Object handling&lt;br /&gt;          o Copied by value&lt;br /&gt;          o No destructors&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;13 Jul 2004: PHP 5.0&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;    * ��Completely rewritten ZendEngine 2.0&lt;br /&gt;    * ��First version with the new object model&lt;br /&gt;    * ��Libxml2 based XML replaces Sablotron&lt;br /&gt;    * ��New extensions&lt;br /&gt;          o ��DOM, MySQLi, PDO, SimpleXML, SPL&lt;br /&gt;    * ��Unbundled mysqlclient library&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;From engine overloading . . .&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;    * ��Zend engine 2.0+ allows to overload the following&lt;br /&gt;          o ��by implementing interfaces&lt;br /&gt;                + ��Foreachby implementing Iterator, IteratorAggregate&lt;br /&gt;                + ��Array access by implementing ArrayAccess&lt;br /&gt;                + ��Serializing by implementing Serializable&lt;br /&gt;          o ��by providing magic functions&lt;br /&gt;                + ��Function invocation by method __call()&lt;br /&gt;                + ��Property access by methods __get()and __set()&lt;br /&gt;                + ��Automatic loading of classes by function __autoload()&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;    * PHP4 safety modes for classes (public, private) are not accepted.&lt;br /&gt;    * The Zend Engine II with a new object model and dozens of new features.&lt;br /&gt;    * XML support has been completely redone in PHP 5, all extensions are now focused around the excellent libxml2 library (http://www.xmlsoft.org/).&lt;br /&gt;    * In PHP5 it is firstly checked if there is a function (method) __construct (). If it does not exist, check if there is a function (method) which has the same name as the class.&lt;br /&gt;    * The extension called dom_xml does not belong any more to PHP 5.&lt;br /&gt;    * New reserved names which appeared in PHP 5. (Exception, interface, try, abstract, catch, public, protected, private).&lt;br /&gt;    * A new MySQL extension named MySQLi for developers using MySQL 4.1 and later. This new extension includes an object-oriented interface in addition to a traditional interface; as well as support for many of MySQL's new features, such as prepared statements.&lt;br /&gt;    *  SQLite has been bundled with PHP. For more information on SQLite, please visit their website.&lt;br /&gt;    * A brand new built-in SOAP extension for interoperability with Web Services.&lt;br /&gt;    * A new SimpleXML extension for easily accessing and manipulating XML as PHP objects. It can also interface with the DOM extension and vice-versa.&lt;br /&gt;    * Streams have been greatly improved, including the ability to access low-level socket operations on streams.&lt;br /&gt;    * PHP 5 comes  with the introduction of exception handling, the Standard PHP Library (SPL), enhanced support for XML, reflection, and quite a few enhancements to the object oriented features of the language.&lt;br /&gt;    * PHP 5 comes  with Much improved OOP system, including method/property visibility, destructors, autoloading, interfaces &amp; abstraction&lt;br /&gt;    * PHP 5 comes with SPL - Standard PHP Library including iterators (object traversal) with support for arrays, XML data &amp; directories.&lt;br /&gt;    * PHP 5 comes  with Exception handling&lt;br /&gt;    * PHP5 Data Objects (PDO)&lt;br /&gt;&lt;br /&gt;Here are some differences I've run into during a recent php4 to php5 conversion:&lt;br /&gt;&lt;br /&gt;Constructors (+1 for php5)&lt;br /&gt;php4: Constructors are named after their class. If you change the name of a class, you have to find all callers of the constructors. Ew!&lt;br /&gt;php5: Constructors are named __construct. If no __construct method is found, falls back to php4 behavior.&lt;br /&gt;&lt;br /&gt;Destructors (+1 for php5)&lt;br /&gt;php4: No such concept.&lt;br /&gt;php5: Destructors are named __destruct.&lt;br /&gt;&lt;br /&gt;$this = new Class(...); (+2 for php4)&lt;br /&gt;php4: $this can be reassigned, allowing one to change the class implementing an object. A very useful feature and one I used quite a lot.&lt;br /&gt;php5: Assignment to $this is explicitly forbidden. Factory methods are the recommended substitute, but they're ugly.&lt;br /&gt;&lt;br /&gt;array_shift($args = func_get_args()); (+1 for php4)&lt;br /&gt;php4: If func_get_args() returns [a, b, c], $args is [b, c]--as expected.&lt;br /&gt;php5: If func_get_args() returns [a, b, c], $args is [a, b, c]. Good luck hunting down that bug.&lt;br /&gt;&lt;br /&gt;Copying through Assignment (+1 for php4)&lt;br /&gt;$o1 = new Object(...); $o2 = $o1;&lt;br /&gt;$o1-&gt;setThing('x'); $o2-&gt;setThing('y');&lt;br /&gt;php4: $o1 and $o2 are different objects, with Thing set to 'x' and 'y', respectively. This behavior matches that of strings, numbers, and other non-object types, which are also copied on assignment.&lt;br /&gt;php5: $o1 and $o2 are the same object, with Thing set to 'y'. This behavior contradicts that of strings, numbers, and other non-object types which do produce copies. A clone operator was introduced to work around this (provided your objects also implement __clone methods); however, the clone operator only works on objects, not strings or numbers, so ensuring you've produced a copy is now along the lines of $o2 = is_object($o1) ? clone $o1 : $o1;. Ick.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;And some differences which might get used now that I've transitioned to php5:&lt;br /&gt;&lt;br /&gt;Public, Protected, Private Class Variables (no point)&lt;br /&gt;php4: All class variables are public.&lt;br /&gt;php5: Class variables can have differing access levels. This annoys me, but some people like it.&lt;br /&gt;&lt;br /&gt;Class Constants (+0.5 for php5)&lt;br /&gt;php4: No such thing. I work around this, and the lack of namespacing in general, by using Class__CONSTANT.&lt;br /&gt;php5: Has them as Class::CONSTANT. It isn't namespace support, and has quite a few caveats, but it's sort of an improvement if you squint just right.&lt;br /&gt;&lt;br /&gt;Autoloading (+1 for php5)&lt;br /&gt;php4: No such thing. If you want to load classes, you'd better make sure there are require_once statements all over the place. Or write an object-creation function (make_instance) which automatically loads any class that doesn't exist. make_instance('Class', ...) isn't nearly as pretty as new Class(...), though.&lt;br /&gt;php5: Autoloading exists, provided you write an __autoload function. No more does require_once need to be littered around one's code. A marginal savings overall, but still an improvement.&lt;br /&gt;&lt;br /&gt;PHP developers, like all developers, want their scripts to be as compatible as possible. Often, this involves looking into the past, to see if scripts are backwards-compatible. But, we sometimes have to look into the future - to see what is changing, and to understand what we need to do to become compatible.&lt;br /&gt;&lt;br /&gt;PHP6 is the latest, yet unreleased version of PHP. It is still under development and won't be released for some time yet. Nonetheless, it is still important that we consider the changes we know about at the moment, and write scripts which are compatible.&lt;br /&gt;&lt;br /&gt;If you want to make use of PHP6 when it comes, you're going to have to write your new scripts so they are compatible, and possibly change some of your existing scripts. To start making your scripts PHP6 compatible, I've compiled a list of tips to follow when scripting:&lt;br /&gt;&lt;br /&gt;Don't use register_globals&lt;br /&gt;In PHP6, support for register_globals will be no more. There will be no option to turn it on or off - it will not exist. This change should not affect you, as you shouldn't really use register_globals anyway. If you don't already know, register_globals puts $_REQUEST into the global scope, so you can access the variables just like any other variable. Instead, you should access inputted data like this:&lt;br /&gt;&lt;br /&gt;$_GET['input'];&lt;br /&gt;$_POST['input'];&lt;br /&gt;$_REQUEST['input'];&lt;br /&gt;&lt;br /&gt;Stop using magic_quotes&lt;br /&gt;In my opinion, this tip should be applied whether you are using PHP 3, 4 or 5. Thankfully, in PHP6, the magic_quotes feature is going to disappear with register_globals. For those who don't know, magic_quotes automatically escapes single quotes, double quotes, backslashes, and NULL characters.&lt;br /&gt;&lt;br /&gt;Don't Register Long Arrays&lt;br /&gt;If you access user inputted data using $HTTP_POST_VARS or $HTTP_GET_VARS, you better stop now. Instead, you should use the superglobals - $_SERVER, $_COOKIE, $_GET, $_POST, $_FILES…&lt;br /&gt;&lt;br /&gt;preg instead or ereg&lt;br /&gt;If you're using ereg functions for regular expression tasks, then you should start using the preg functions instead. ereg will not be available in the PHP core as of version 6.&lt;br /&gt;&lt;br /&gt;Don't initiate objects with the reference operator&lt;br /&gt;If you're initiating objects using the reference operator, you should stop now. It will generate an E_STRICT error in PHP6.&lt;br /&gt;&lt;br /&gt;$a = &amp; new object(); // Do not do this;&lt;br /&gt;$a = new object(); // Do this as of PHP6&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Unofficial PHP6 Changelog&lt;br /&gt;&lt;br /&gt;    * FILE_BINARY and FILE_TEXT constants available for use with filesystem functions.&lt;br /&gt;    * register_globals will be gone.&lt;br /&gt;    * magic_quotes will also disappear.&lt;br /&gt;    * $HTTP_*_VARS has been removed, in favour for $_GET, $_POST, etc.&lt;br /&gt;    * ereg() no longer available in core PHP6.&lt;br /&gt;    * Initiating objects with the reference operator (&amp; new Object()) will generate E_STRICT error.&lt;br /&gt;    * E_STRICT error messages are included in E_ALL errors.&lt;br /&gt;    * {} for string offsets no longer available.&lt;br /&gt;    * [] un-deprecated for accessing characters in a string.&lt;br /&gt;&lt;br /&gt;    * ASP-style tags can no longer be used.&lt;br /&gt;    * Better Unicode Support. (Full Unicode Support)&lt;br /&gt;    * var will be an alias of public, and raises E_STRICT warning.&lt;br /&gt;    * Support for 64 bit integers.&lt;br /&gt;    * With ternary operator, the "true" expression is no longer required - this can be done: $a = $s ?: 'b'; (Not clear yet exactly how this will work).&lt;br /&gt;    * zend.ze1_compatibility_mode removed.&lt;br /&gt;    * safe_mode is being removed.&lt;br /&gt;    * Freetype1 and GD1 support removed.&lt;br /&gt;    * dl() is only enabled when a SAPI layers registers it explicitly.&lt;br /&gt;    * Support for dynamic break levels removed.&lt;br /&gt;    * XMLReader and XMLWriter will be in the core distribution.&lt;br /&gt;    * mime_magic removed from the core.&lt;br /&gt;    * Fileinfo moved to the core.&lt;br /&gt;    * ext/soap on by default.&lt;br /&gt;    * foreach supports multi-dimensional arrays: foreach($a as $b =&gt; list($c, $d))&lt;br /&gt;    * microtime() will return as float by default.&lt;br /&gt;    * opcode cache included in core distribution, but turned off by default.&lt;br /&gt;    * flags parameter available for file_get_contents().&lt;br /&gt;    * before_needle parameter added to strstr() - allows strstr() to return part of haystack before occurence of the needle.&lt;br /&gt;    * namespace, import, and goto become reserved words.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;    * In PHP 6, the Fileinfo extension will replace mime_magic and it will be integrated in the core while mime_magic will be taken out of the core and changed into extension.&lt;br /&gt;    * In PHP 6, the exclusion of the ereg frequent expressions library that is going to become an extension.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;    * PHP which can be exploited by those who are practicing Denial of Service (DoS) type attacks upon a system which is affected.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;What's New in PHP 5 - Database Support&lt;br /&gt;&lt;br /&gt;PHP 5 offers some big enhancements to its ability to interact with databases. The most significant addition is the embedded SQLite database, a quick, lightweight database engine made specifically for embedded applications. This means there is no RDBMS process running on the server; SQLite reads and writes directly to files on disk. This results in significantly lower memory overhead when the database is not being used, but major performance problems arise if the system is used in a high traffic environment. SQLite is intended for small scale use, as best I can gather.&lt;br /&gt;&lt;br /&gt;When testing it with small tables and less than one thousand rows per table, it was comparable to MySQL in executing simple joins with only one concurrent request, but performance from SQLite degraded exponentially with five or more concurrent connections coming in, which makes perfect sense. This is a good database solution for a small site that needs minimal features and expects minimal usage. It could also be useful for storing embedded configuration data in a PHP 5 application that may house its main data store in another RDBMS, and only run small queries against SQLite. SQLite is relatively standards compliant with a few major exceptions, most notably the lack of an ALTER TABLE statement.&lt;br /&gt;&lt;br /&gt;PHP 5 also introduces support for the MySQL 4.1 client library with the introduction of the mysqli extension. The mysqli extension provides some basic objects for working with the MySQL server. The mysqli class is used as a connection object and as the ability to open and close connections as well as get context and state information from the server. The mysqli_stmt class represents a prepared statement that allows you to execute “prepare” and “execute” queries against the database. Lastly, the mysqli_result object provides a cursor based interface for reading results, providing similar functionality to the functions available in the standard MySQL extension using a MySQL resource handle. The new extension also adds support for SSL and input/output parameters. &lt;br /&gt;&lt;br /&gt;The last notable addition in the database area is enhanced support for Firebird/InterBase, an RDBMS that offers most ANSI SQL-92 features and runs on most operating systems. The ibase extension provides most of the same functionality for Firebird/InterBase as the new mysqli extension does for MySQL but in the same manner as the old MySQL extension - that is, no objects.&lt;br /&gt;&lt;br /&gt;What's New in PHP 5 - SPL: Exceptions and Iterators&lt;br /&gt;&lt;br /&gt;PHP 5 comes with the Standard PHP Library (SPL), a collection of objects built to handle various tasks such as exception handling and object traversal (iteration). There are basically six groups of classes/interfaces available natively to the SPL.&lt;br /&gt;&lt;br /&gt;   1. Iterators: SPL provides built in iterators to assist in a common task - object traversal. Iterators provide a way to traverse an object’s contents without exposing the inner workings of the object to the outside world. Iterators can be built to work on any data structure and provide a standardized interface. Some of the iterator classes and interfaces available in the SPL are: Iterator, OuterIterator, RecursiveIterator, IteratorIterator, ParentIterator, SeekableIterator, NoRewindIterator, and InifiniteIterator.&lt;br /&gt;&lt;br /&gt;      Each iterator has a specific purpose and details can be found in the PHP manual.&lt;br /&gt;   2. Directories: Two directory classes are available in the SPL: DirectoryIterator and RecursiveDirectoryIterator. These classes allow iterator based directory traversal and eliminates the need for messy directory handles.&lt;br /&gt;   3. XML: There is one XML handling class in SPL, SimpleXMLIterator, which provides iteration over a simplexml object.&lt;br /&gt;   4. Arrays: SPL offers something that has long been in need in PHP - ArrayObject and ArrayIterator. These object provide, as you may have guessed, an array object as well as an object to traverse the contents of an array without making assumptions on the way the array is storing it's internal data.&lt;br /&gt;   5. Counting: The SPL interface Countable allows you to hook into the standard array function count(), meaning you can use the count() function on a user defined object and get a meaningful result by implementing the Countable interface. This is very useful for non-simple data structures.&lt;br /&gt;   6. Exceptions: Probably the biggest feature addition via the SPL, exceptions allow graceful error handling through try/catch blocks. The Exception class is simple to extend and the SPL provides a few standard classes of exceptions for common problems, such as LogicException, BadFunctionCallException, DomainException, OutOfRangeException, and InvalidArgumentException. Error handling has been a longtime problem in PHP and has resulted in some of the ugliest code I've ever seen, particularly using the PEAR error class. Exceptions should eliminate this sort of problem in the future.&lt;br /&gt;&lt;br /&gt;What's New in PHP 5 - OOP: Object Enhancements&lt;br /&gt;&lt;br /&gt;PHP 5 makes leaps and bounds in its support for objects. Aside from all the new features, Zend claims to have addressed the performance problems involved with object creation and usage in previous versions of PHP, a fact that in itself should encourage more developers to use object-based PHP. PHP 5 offers enhancements in a few key areas including object autoloading, destructors, visibility, static methods, class constants, type hinting, interfaces, cloning, reflection and several magic methods.&lt;br /&gt;&lt;br /&gt;Autoloading is a great new feature that provides a way for developers to make sure all dependencies for a class are in place before using it. If you attempt to instantiate a class that has not yet been defined, PHP 5 will call the __autoload() function as a last attempt to load the class before failing with an error. Since most developers put one class per file, and many classes often depend on another either by way of inheritance or encapsulation, __autoload() allows you to make sure all the necessary class files have been included. While PHP 4 had constructors, PHP 5 offers a new features: destructors. Destructors are called when an object is destroyed or all references to it have been removed. Destructors are implemented in classes by use of the __destruct function. The __construct function has also been introduced and takes precedence over the old-style constructor function. The old style still works, but it is recommended that __construct is used as it takes higher priority.&lt;br /&gt;&lt;br /&gt;One of the biggest additions to PHP's support for objects is visibility modifiers, also known as access modifiers. The var keyword has been deprecated and class variables are now to be declared as public, private, or protected. Public class variables are available to any other part of the program. Private variables are only available to that class. Protected variables are available to a class as well as its child classes, unlike private which only allows the class itself to access the variable. Methods can also be declared as public, private, or protected, and if none are declared a method is assumed to be public. Access modifiers allow PHP programmers to programmatically hide the inner workings of one object from another by preventing other objects from accessing class data directly. PHP 5 also introduces the static keyword. Static methods are called without an object instance and calls to static methods are resolved at compile time, not runtime. Static properties are accessed by the :: operator, not -&gt;, and the special variable $this is not available in static methods.&lt;br /&gt;&lt;br /&gt;Not only can you declares constants in C-style syntax, const constant = 'constant value';, but a class can contain it's own constants and access them internally using self::constant. This simplifies management of constants and keeps them contained within the classes they belong to, preventing code clutter and conflicts with other constants in the same application that may need the same name but a different value. PHP 5 also allows type hints in method parameter declarations. If a parameter is given a type hint and an object of the wrong type is passed to it, PHP will generate a fatal error. It would be preferable for an exception to be thrown, but type hinting does at least allow responsibility to be placed in the calling code for making sure the proper data type is passed into a function call. Type hints can be used in any function, not strictly in class methods.&lt;br /&gt;&lt;br /&gt;PHP 5 also introduces abstract classes and interfaces, which is probably THE most significant enhancement to the language. Abstract classes and interfaces allow high level design principles to be semantically applied to PHP classes. PHP includes three special method keywords, final, abstract and virtual, to facilitate the use of inheritance and interfaces. When a method is declared as final, it cannot be overridden by a child class. When a method is declared as abstract, it must be defined in a child class. When a method is declared as virtual, it may be inherited as is or overridden by a child class. When used in combination, abstract classes and interfaces enforce high level design throughout all levels of implementation and support properly coded objects. They can be used in excess, as can anything else, but used properly these are the most powerful tools available to object oriented developers.&lt;br /&gt;&lt;br /&gt;The last features of note are object cloning, some more magic functions and the reflection class. Object cloning allows the implementation of a magic method, __clone() to define what exactly takes place when clone is called on an object. It allows developers to implement deep copying of object data when cloning without writing messy code. A few other noteworthy magic functions are __sleep() and __wakeup(), which are used in conjunction with serialize and unserialize to ensure proper destruction and recreation of resources used within an object. Additionally, the __toString magic method allows a class to decide how to react when it is used in string context. The reflection class works as the name implies; it allows developers to programmatically reverse-engineer classes, interfaces, functions and extensions. Reflection is a powerful tool in developing custom application frameworks.&lt;br /&gt;&lt;br /&gt;Conclusion&lt;br /&gt;&lt;br /&gt;Overall, PHP 5 offers dramatic improvements over PHP 4 in a lot of areas. These improvements are, by and large, geared toward advanced PHP developers. With the exception of the SimpleXML extension, most of the new functionality will probably have no appeal to the largest segment of the PHP programming population - that is, developers who look at PHP as a simple scripting language and use it to accomplish one task at a time. For PHP application developers though, I see PHP 5 quickly becoming the de facto standard. Start putting pressure on your hosts now to upgrade, because PHP 5 was definitely worth the wait.&lt;br /&gt;&lt;br /&gt;Snippets&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; class Foo&lt;br /&gt;&lt;br /&gt; {&lt;br /&gt;&lt;br /&gt;     function __construct()&lt;br /&gt;&lt;br /&gt;     {&lt;br /&gt;&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;     function Foo()&lt;br /&gt;&lt;br /&gt;     {&lt;br /&gt;&lt;br /&gt;         self::__construct();&lt;br /&gt;&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; ?&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2359215229347242038?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2359215229347242038/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2359215229347242038' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2359215229347242038'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2359215229347242038'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/02/best-for-interview-php4-php5-php6-php-4.html' title='Best For Interview , PHP4 , PHP5, PHP6 , PHP 4 vs 5 vs 6'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-4653878577756810223</id><published>2010-01-29T00:49:00.000-08:00</published><updated>2010-01-29T00:50:28.359-08:00</updated><title type='text'>Category Ul-Li Tree structure For Menu Items</title><content type='html'>function category_navigation($pid,$level)&lt;br /&gt; {&lt;br /&gt;  global $res;&lt;br /&gt;  global $catUlList;&lt;br /&gt;  $res[0] = "-Root-";&lt;br /&gt;  $blank = ""; &lt;br /&gt;  &lt;br /&gt;  for($i=0; $i&lt; $level; $i++)&lt;br /&gt;  $blank   .=  "\t";&lt;br /&gt;  &lt;br /&gt;  &lt;br /&gt;  &lt;br /&gt;  $parents = $this-&gt;find('all' , array('conditions' =&gt; array('Category.parent_id' =&gt; $pid)));&lt;br /&gt;  &lt;br /&gt;  if(!empty($parents))&lt;br /&gt;  {&lt;br /&gt;   $catUlList .= "\n$blank&lt;ul&gt;";&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  $level++;&lt;br /&gt;  &lt;br /&gt;  &lt;br /&gt;  &lt;br /&gt;  foreach($parents as $value)&lt;br /&gt;  {  &lt;br /&gt;   unset($value['ParentCategory']);&lt;br /&gt;   unset($value['Product']);&lt;br /&gt;   &lt;br /&gt;   $catName = $value['Category']['name'];&lt;br /&gt;   $catUrlName = str_replace(" ","_",$value['Category']['name']);&lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;   $catUlList .= "\n$blank&lt;li&gt;";&lt;br /&gt;   &lt;br /&gt;   $catUlList .= "&lt;a href='".SITE_URL."products/".$value['Category']['id'].":".$catUrlName."'&gt;";&lt;br /&gt;   $catUlList .= $catName;&lt;br /&gt;   $catUlList .= "&lt;/a&gt;";&lt;br /&gt;   &lt;br /&gt;   //$catUlList .= $html-&gt;link($catName, SITE_URL."products/".$value['Category']['id'].":".$catUrlName);&lt;br /&gt;   &lt;br /&gt;   $this-&gt;category_navigation($value['Category']['id'],$level);&lt;br /&gt;   $catUlList .= "\n$blank&lt;/li&gt;";&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  if(!empty($parents))&lt;br /&gt;  {&lt;br /&gt;  $catUlList .= "\n$blank&lt;/ul&gt;";&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;  $fp = fopen("category_ul_list.php","w");&lt;br /&gt;  fwrite($fp,$catUlList);&lt;br /&gt;  &lt;br /&gt;  return $catUlList;&lt;br /&gt; }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-4653878577756810223?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/4653878577756810223/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=4653878577756810223' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4653878577756810223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4653878577756810223'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2010/01/category-ul-li-tree-structure-for-menu.html' title='Category Ul-Li Tree structure For Menu Items'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-1839362129312153696</id><published>2009-12-11T01:38:00.000-08:00</published><updated>2010-02-03T10:41:57.995-08:00</updated><title type='text'>Send mail function by cake php.</title><content type='html'>function sendMail($To, $Subject, $MessageFile, $From, $smtp="1")&lt;br /&gt;{ &lt;br /&gt;$this-&gt;Email-&gt;to      = $To;&lt;br /&gt;$this-&gt;Email-&gt;from    = $From;&lt;br /&gt;&lt;br /&gt;$this-&gt;Email-&gt;subject = $Subject;&lt;br /&gt;$this-&gt;Email-&gt;template = $MessageFile;&lt;br /&gt;$this-&gt;Email-&gt;sendAs = 'both';&lt;br /&gt;&lt;br /&gt;if($smtp == 1)&lt;br /&gt;{&lt;br /&gt;$this-&gt;Email-&gt;smtpOptions = array(&lt;br /&gt;'port' =&gt; '25', &lt;br /&gt;'timeout' =&gt; '30',&lt;br /&gt;'host' =&gt; 'relay.airtelbroadband.in',&lt;br /&gt;'username' =&gt; $From,&lt;br /&gt;'password' =&gt; 'octal123',&lt;br /&gt;'client' =&gt; 'smtp_helo_hostname'&lt;br /&gt;);&lt;br /&gt;}&lt;br /&gt;$this-&gt;Email-&gt;delivery = 'smtp';    &lt;br /&gt;&lt;br /&gt;if($this-&gt;Email-&gt;send())&lt;br /&gt;{&lt;br /&gt;return true;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;return false;&lt;br /&gt;}&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-1839362129312153696?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1839362129312153696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1839362129312153696'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/12/send-mail-function-by-cake-php.html' title='Send mail function by cake php.'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3132075633404523488</id><published>2009-12-08T02:15:00.000-08:00</published><updated>2009-12-08T02:17:03.400-08:00</updated><title type='text'>Category tree structure select box in cake php</title><content type='html'>########################&lt;br /&gt; # Created By : Rahul Dev Xarma&lt;br /&gt; # private function of this class will be use for showing category list in tree structure.&lt;br /&gt; # With selectLeader($id = 0) function &lt;br /&gt; ########################&lt;br /&gt; function __display($pid,$level)&lt;br /&gt; {&lt;br /&gt;  global $res;&lt;br /&gt;  $blank = ""; &lt;br /&gt;  &lt;br /&gt;  for($i=0; $i&lt; $level; $i++)&lt;br /&gt;  $blank   .=  "-";&lt;br /&gt;  &lt;br /&gt;  $parents = $this-&gt;Category-&gt;find('all' , array('conditions' =&gt; array('Category.parent_id' =&gt; $pid)));&lt;br /&gt;  &lt;br /&gt;  if(!empty($parents))&lt;br /&gt;  $level++;&lt;br /&gt;  &lt;br /&gt;  foreach($parents as $value)&lt;br /&gt;  {  &lt;br /&gt;   $res[$value['Category']['id']] = $blank.$value['Category']['name'];   &lt;br /&gt;   $this-&gt;__display($value['Category']['id'],$level);&lt;br /&gt;  }&lt;br /&gt; } &lt;br /&gt; &lt;br /&gt;&lt;br /&gt; ########################&lt;br /&gt; # Created By : Rahul Dev Xarma &lt;br /&gt; # This function will be use for showing category list in tree structure&lt;br /&gt; #  __display($pid,$level)&lt;br /&gt; ########################&lt;br /&gt; function selectLeader($id = 0)&lt;br /&gt; {&lt;br /&gt;  global $res;&lt;br /&gt;  $level = 0;&lt;br /&gt;  $parents = $this-&gt;Category-&gt;find('all',array('conditions' =&gt; array('Category.parent_id' =&gt; $id)));&lt;br /&gt;  $i = 0; &lt;br /&gt;  foreach($parents as $value)&lt;br /&gt;  {&lt;br /&gt;   $level = 0;&lt;br /&gt;   $res[$value['Category']['id']] =  $value['Category']['name'];&lt;br /&gt;   $this-&gt;__display($result['categories_id'],0);&lt;br /&gt;  }&lt;br /&gt;  return  $res;&lt;br /&gt; }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3132075633404523488?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3132075633404523488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3132075633404523488' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3132075633404523488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3132075633404523488'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/12/category-tree-structure-select-box-in.html' title='Category tree structure select box in cake php'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-5696811459336744594</id><published>2009-12-07T22:07:00.000-08:00</published><updated>2009-12-07T22:10:32.684-08:00</updated><title type='text'>Check Category Level in depth return One if category is exist in given level and Zero when category have great level then given level</title><content type='html'>####Created By Rahul Dev Xarma [RDX]&lt;br /&gt; function _IsCatLevel($catId,$Levels = NULL)&lt;br /&gt; {&lt;br /&gt;  $pid = $catId;&lt;br /&gt;  $flage = 1;&lt;br /&gt;  if((!empty($Levels) || $Levels !=NULL) &amp;&amp; $catId!=0)&lt;br /&gt;  {&lt;br /&gt;  &lt;br /&gt;   $parents = $this-&gt;Category-&gt;find('all',array('conditions' =&gt; array('Category.id' =&gt; $pid)));&lt;br /&gt;   $curLevel = 0 ;&lt;br /&gt;   &lt;br /&gt;   while($pid!=NULL || $pid!=0)&lt;br /&gt;   {&lt;br /&gt;   $parents = $this-&gt;Category-&gt;find('all',array('conditions' =&gt; array('Category.id' =&gt; $pid)));&lt;br /&gt;   //pr($parents);&lt;br /&gt;   $pid = $parents[0]['Category']['parent_id'];&lt;br /&gt;   $curLevel++;&lt;br /&gt;   &lt;br /&gt;    if($curLevel == $Levels)&lt;br /&gt;    {&lt;br /&gt;    $flage = 0;&lt;br /&gt;    break;&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;  if($flage == 0)&lt;br /&gt;   return 0;&lt;br /&gt;  else&lt;br /&gt;   return 1;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt; #### End Created By RDX&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-5696811459336744594?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/5696811459336744594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=5696811459336744594' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5696811459336744594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5696811459336744594'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/12/check-category-level-in-depth-return.html' title='Check Category Level in depth return One if category is exist in given level and Zero when category have great level then given level'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-1010092606129633551</id><published>2009-12-04T20:43:00.000-08:00</published><updated>2009-12-04T20:44:52.742-08:00</updated><title type='text'>calculates the distance between two points (given  latitude/longitude of those points)</title><content type='html'>function distance($lat1, $lon1, $lat2, $lon2, $unit) { &lt;br /&gt;&lt;br /&gt;  $theta = $lon1 - $lon2; &lt;br /&gt;  $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) +  cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); &lt;br /&gt;  $dist = acos($dist); &lt;br /&gt;  $dist = rad2deg($dist); &lt;br /&gt;  $miles = $dist * 60 * 1.1515;&lt;br /&gt;  $unit = strtoupper($unit);&lt;br /&gt;&lt;br /&gt;  if ($unit == "K") {&lt;br /&gt;    return ($miles * 1.609344); &lt;br /&gt;  } else if ($unit == "N") {&lt;br /&gt;      return ($miles * 0.8684);&lt;br /&gt;    } else {&lt;br /&gt;        return $miles;&lt;br /&gt;      }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;echo distance(32.9697, -96.80322, 29.46786, -98.53506, "m") . " miles&lt;br&gt;";&lt;br /&gt;echo distance(32.9697, -96.80322, 29.46786, -98.53506, "k") . " kilometers&lt;br&gt;";&lt;br /&gt;echo distance(32.9697, -96.80322, 29.46786, -98.53506, "n") . " nautical miles&lt;br&gt;";&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-1010092606129633551?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/1010092606129633551/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=1010092606129633551' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1010092606129633551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1010092606129633551'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/12/calculates-distance-between-two-points.html' title='calculates the distance between two points (given  latitude/longitude of those points)'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-4045934172259901154</id><published>2009-11-25T20:27:00.000-08:00</published><updated>2009-11-25T20:32:47.565-08:00</updated><title type='text'>File structure of joomla</title><content type='html'>The most basic files, such as index.php, component.php, templateDetails.xml, template_thumbnail.png, favicon.ico, params.ini should be placed directly in your template folder. The most common is to place images, CSS files, JavaScript files etc in separate folders. Joomla override files must be placed in folders in the folder "html".&lt;br /&gt;&lt;br /&gt;When making the template folder, your language files should be copied to your template folder. The ones for the front end site should be placed directly in the template folder. If you have language files for the back end, these should be placed in a folder, named for instance "admin". All the language files will be copied automatically to the right folders if stated correctly in the templateDetails.xml.&lt;br /&gt;&lt;br /&gt;Typical Template Directory Structure&lt;br /&gt;&lt;br /&gt;It is most common for a template to have at least the following files:&lt;br /&gt;&lt;br /&gt;    * index.php&lt;br /&gt;&lt;br /&gt;    Provides the logic for the display and positioning of modules and components.&lt;br /&gt;&lt;br /&gt;    * component.php&lt;br /&gt;&lt;br /&gt;    Provides the logic for the display of the printer friendly page, "E-mail this link to a friend." etc.&lt;br /&gt;&lt;br /&gt;    * template.css&lt;br /&gt;&lt;br /&gt;    Handles the presentational aspects of the template including specifications for margins, fonts, headings, image borders, list formatting, etc.&lt;br /&gt;&lt;br /&gt;    * templateDetails.xml&lt;br /&gt;&lt;br /&gt;    Holds meta-information related to the template and is used by the Installer and the Template Manager.&lt;br /&gt;&lt;br /&gt;    * template_thumbnail.ext - replace .ext with the extension format of the image (.jpg, .png, .gif)&lt;br /&gt;&lt;br /&gt;    Generally a 200x150 pixel image that is shown when the cursor is held over the template name in the Template Manager. This gives the Administrator a snapshot view of the template before applying it to the Site.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A typical template for Joomla! 1.5 will include the following directories:&lt;br /&gt;&lt;br /&gt;    * css - contains all the .css files&lt;br /&gt;    * html - contains template override files for core output and module chrome&lt;br /&gt;    * images - contains all images used by the template&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-4045934172259901154?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://docs.joomla.org/File_structure_for_packaging' title='File structure of joomla'/><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/4045934172259901154/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=4045934172259901154' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4045934172259901154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4045934172259901154'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/11/file-structure-of-joomla.html' title='File structure of joomla'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-7842729393404789238</id><published>2009-11-24T21:53:00.001-08:00</published><updated>2009-11-24T21:55:50.862-08:00</updated><title type='text'>How do I get the browser window size?</title><content type='html'>To determine the actual size of the browser window, use the following properties:&lt;br /&gt;&lt;br /&gt;    * in Netscape Navigator 4:&lt;br /&gt;      window.innerWidth, window.innerHeight&lt;br /&gt;    * in Microsoft Internet Explorer:&lt;br /&gt;      document.body.offsetWidth, document.body.offsetHeight &lt;br /&gt;&lt;br /&gt;Note that the code that uses document.body.offsetWidth and document.body.offsetHeight must be executed after the browser has parsed the BODY tag.&lt;br /&gt;&lt;br /&gt;The following code sets the variables winW and winH to the actual width and height of the browser window, and outputs the width and height values. If the user has an old browser, then winW and winH are set to 630 and 460, respectively.&lt;br /&gt;&lt;br /&gt;var winW = 630, winH = 460;&lt;br /&gt;&lt;br /&gt;if (parseInt(navigator.appVersion)&gt;3) {&lt;br /&gt; if (navigator.appName=="Netscape") {&lt;br /&gt;  winW = window.innerWidth;&lt;br /&gt;  winH = window.innerHeight;&lt;br /&gt; }&lt;br /&gt; if (navigator.appName.indexOf("Microsoft")!=-1) {&lt;br /&gt;  winW = document.body.offsetWidth;&lt;br /&gt;  winH = document.body.offsetHeight;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;document.write(&lt;br /&gt; "Window width = "+winW+""br"&lt;br /&gt;+"Window height = "+winH&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;In your browser, this code produces the following output:&lt;br /&gt;Window width = 1280&lt;br /&gt;Window height = 770&lt;br /&gt;&lt;br /&gt;Note that if the above code executes within a frame, it will give you the frame's width and height.&lt;br /&gt;&lt;br /&gt;To adjust the width and height values taking into accout the scrollbars:&lt;br /&gt;&lt;br /&gt;    * in Netscape Navigator: subtract 16 from the width and height&lt;br /&gt;    * in Microsoft Internet Explorer: subtract 20 from the width and height &lt;br /&gt;&lt;br /&gt;Thus, the code adjusted for scrollbars might look as follows:&lt;br /&gt;&lt;br /&gt;if (parseInt(navigator.appVersion)&gt;3) {&lt;br /&gt; if (navigator.appName=="Netscape") {&lt;br /&gt;  winW = window.innerWidth-16;&lt;br /&gt;  winH = window.innerHeight-16;&lt;br /&gt; }&lt;br /&gt; if (navigator.appName.indexOf("Microsoft")!=-1) {&lt;br /&gt;  winW = document.body.offsetWidth-20;&lt;br /&gt;  winH = document.body.offsetHeight-20;&lt;br /&gt; }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-7842729393404789238?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.javascripter.net/faq/browserw.htm' title='How do I get the browser window size?'/><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/7842729393404789238/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=7842729393404789238' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/7842729393404789238'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/7842729393404789238'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/11/how-do-i-get-browser-window-size.html' title='How do I get the browser window size?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3472961376326582487</id><published>2009-08-18T11:03:00.001-07:00</published><updated>2009-08-18T11:03:42.464-07:00</updated><title type='text'>How to make a download page in own site, which i can know that how many file has been loaded by particular user or particular ipaddress?</title><content type='html'>We can use hyperlink having URL where file are kept. and we only allow regisetered user to download. from session of user we can get the user detail&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3472961376326582487?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3472961376326582487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3472961376326582487' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3472961376326582487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3472961376326582487'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/08/how-to-make-download-page-in-own-site.html' title='How to make a download page in own site, which i can know that how many file has been loaded by particular user or particular ipaddress?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-2739873219022051479</id><published>2009-08-18T11:02:00.003-07:00</published><updated>2009-08-18T11:02:59.016-07:00</updated><title type='text'>What is the difference between echo and print statement?</title><content type='html'>There is a slight difference between print and echo which would depend on how you want to use the outcome. Using the print method can return a true/false value. This may be helpful during a script execution of somesort. Echo does not return a value, but has been considered as a faster executed command. All this can get into a rather complicated discussion, so for now, you can just use whichever one you prefer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-2739873219022051479?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/2739873219022051479/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=2739873219022051479' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2739873219022051479'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/2739873219022051479'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/08/what-is-difference-between-echo-and.html' title='What is the difference between echo and print statement?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3545793423659925229</id><published>2009-08-18T11:02:00.001-07:00</published><updated>2009-08-18T11:02:29.485-07:00</updated><title type='text'>What is differenc between mysql_connect and mysql_pconnec?</title><content type='html'>mysql_pconnect establishes a persistent connection. If you don't need one (such as a website that is mostly HTML files or PHP files that don't call the db) then you don't need to use it. mysql_connect establishes a connection for the duration of the script that access the db. Once the script has finished executing it closes the connection. The only time you need to close the connection manually is if you jump out of the script for any reason.&lt;br /&gt;&lt;br /&gt;If you do use mysql_pconnect. You only need to call it once for the session. That's the beauty of it. It will hold open a connection to the db that you can use over and over again simply by calling the resource ID whenever you need to interact with the db.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3545793423659925229?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3545793423659925229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3545793423659925229' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3545793423659925229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3545793423659925229'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/08/what-is-differenc-between-mysqlconnect.html' title='What is differenc between mysql_connect and mysql_pconnec?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-7602318514222351874</id><published>2009-08-18T11:01:00.001-07:00</published><updated>2009-08-18T11:01:57.518-07:00</updated><title type='text'>How i can get ip address?</title><content type='html'>We can use SERVER var $_SERVER['SERVER_ADDR'] and getenv("REMOTE_ADDR") functions to get the IP address.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-7602318514222351874?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/7602318514222351874/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=7602318514222351874' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/7602318514222351874'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/7602318514222351874'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/08/how-i-can-get-ip-address.html' title='How i can get ip address?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3387549531176660872</id><published>2009-08-18T11:00:00.002-07:00</published><updated>2009-08-18T11:01:28.618-07:00</updated><title type='text'>How i will check that user is, logged in or not. i want to make it a function and i want to use in each page and after login i want to go in current p</title><content type='html'>For this we can use the session objec($_SESSION)t. When the user login with his/ her user name and password, usually we check those to ensure for correctness. If that user name and password are valid one then we can store that user name in a session and then we can very that session variable has been set or not in a single files and we can include that file in all pages.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3387549531176660872?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3387549531176660872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3387549531176660872' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3387549531176660872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3387549531176660872'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/08/how-i-will-check-that-user-is-logged-in.html' title='How i will check that user is, logged in or not. i want to make it a function and i want to use in each page and after login i want to go in current p'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3821358510354734974</id><published>2009-08-18T11:00:00.001-07:00</published><updated>2009-08-18T11:00:50.018-07:00</updated><title type='text'>How we know browser properties ?</title><content type='html'>get_browser() attempts to determine the capabilities of the user's browser. This is done by looking up the browser's information in the browscap.ini file.&lt;br /&gt;&lt;br /&gt;echo $_SERVER['HTTP_USER_AGENT'] . "&lt;hr /&gt;\n";&lt;br /&gt;&lt;br /&gt;$browser = get_browser();&lt;br /&gt;&lt;br /&gt;foreach ($browser as $name =&gt; $value) {&lt;br /&gt;   echo "&lt;b&gt;$name&lt;/b&gt; $value&lt;br /&gt;\n";&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3821358510354734974?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3821358510354734974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3821358510354734974' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3821358510354734974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3821358510354734974'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/08/how-we-know-browser-properties.html' title='How we know browser properties ?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-1930032325724260313</id><published>2009-08-18T10:59:00.002-07:00</published><updated>2009-08-18T11:00:10.887-07:00</updated><title type='text'>If you have to work with dates in the following format: "Tuesday, February 14, 2006 @ 10:39 am", how can you convert them to another format, that is e</title><content type='html'>The strtotime function can convert a string to a timestamp. A timestamp can be converted to date format. So it is best to store the dates as timestamp in the database, and just output them in the format you like.&lt;br /&gt;&lt;br /&gt;So let's say we have&lt;br /&gt;$date = "Tuesday, February 14, 2006 @ 10:39 am";&lt;br /&gt;In order to convert that to a timestamp, we need to get rid of the "@" sign, and we can use the remaining string as a parameter for the strtotime function.&lt;br /&gt;&lt;br /&gt;So we have&lt;br /&gt;$date = str_replace("@ ","",$date);&lt;br /&gt;$date = strtotime($date);&lt;br /&gt;&lt;br /&gt;now $date is a timestamp&lt;br /&gt;and we can say:&lt;br /&gt;&lt;br /&gt;echo date("d M Y",$date);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-1930032325724260313?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/1930032325724260313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=1930032325724260313' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1930032325724260313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1930032325724260313'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/08/if-you-have-to-work-with-dates-in.html' title='If you have to work with dates in the following format: &quot;Tuesday, February 14, 2006 @ 10:39 am&quot;, how can you convert them to another format, that is e'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-4146260977586419163</id><published>2009-08-18T10:59:00.001-07:00</published><updated>2009-08-18T10:59:38.704-07:00</updated><title type='text'>What is CAPTCHA?</title><content type='html'>CAPTCHA stands for Completely Automated Public Turing Test to tell Computers and Humans Apart. To prevent spammers from using bots to automatically fill out forms, CAPTCHA programmers will generate an image containing distorted images of a string of numbers and letters. Computers cannot determine what the numbers and letters are from the image but humans have great pattern recognition abilities and will be able to fairly accurately determine the string of numbers and letters. By entering the numbers and letters from the image in the validation field, the application can be fairly assured that there is a human client using it. To read more look here:&lt;br /&gt;http://en.wikipedia.org/wiki/Captcha&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-4146260977586419163?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/4146260977586419163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=4146260977586419163' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4146260977586419163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4146260977586419163'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/08/what-is-captcha.html' title='What is CAPTCHA?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-5553810684154674660</id><published>2009-07-15T08:39:00.001-07:00</published><updated>2009-07-15T08:39:48.430-07:00</updated><title type='text'>error types of php ?</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'Arial Narrow'; color: rgb(40, 40, 40); line-height: 18px; "&gt;Three types of errors in PHP?&lt;br /&gt;a)Notics&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Arial Narrow'; color: rgb(40, 40, 40); line-height: 18px; "&gt;b)Fatal&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Arial Narrow'; color: rgb(40, 40, 40); line-height: 18px; "&gt;c)warnings&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-5553810684154674660?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/5553810684154674660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=5553810684154674660' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5553810684154674660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5553810684154674660'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/07/error-types-of-php.html' title='error types of php ?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-6476848889039535350</id><published>2009-07-15T08:34:00.000-07:00</published><updated>2009-07-15T08:36:23.978-07:00</updated><title type='text'>sorting array functions ?</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'Arial Narrow'; color: rgb(40, 40, 40); line-height: 18px; "&gt;1- sort($array)- is used for enumerated array(numeric array)&lt;br /&gt;sorts the array element in asending order.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Arial Narrow'; color: rgb(40, 40, 40); line-height: 18px; "&gt;2- rsort($array)- used for enumerated array,sorts the array element in decending order.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Arial Narrow'; color: rgb(40, 40, 40); line-height: 18px; "&gt;3- asort($array)- used for associative array,sorts the array value in asending order.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Arial Narrow'; color: rgb(40, 40, 40); line-height: 18px; "&gt;4- arsort($array)- used for associative array,sorts the array value in decending order.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Arial Narrow'; color: rgb(40, 40, 40); line-height: 18px; "&gt;5- ksort($array)- used for associative array,sorts the array keys in asending order.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Arial Narrow'; color: rgb(40, 40, 40); line-height: 18px; "&gt;6- krsort($array)- used for associative array,sorts the array keys in decending order.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-6476848889039535350?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/6476848889039535350/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=6476848889039535350' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6476848889039535350'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6476848889039535350'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/07/sorting-array-functions.html' title='sorting array functions ?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-3725519010166970940</id><published>2009-07-15T08:32:00.000-07:00</published><updated>2009-07-15T08:33:26.758-07:00</updated><title type='text'>create a database using PHP and mysql?</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'Arial Narrow'; color: rgb(40, 40, 40); line-height: 18px; "&gt;We can create mysql table with the use of mysql_create_db($databaseName) to create a database.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-3725519010166970940?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/3725519010166970940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=3725519010166970940' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3725519010166970940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/3725519010166970940'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/07/create-database-using-php-and-mysql.html' title='create a database using PHP and mysql?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-6584271013964037691</id><published>2009-07-15T08:30:00.001-07:00</published><updated>2009-07-15T08:31:46.906-07:00</updated><title type='text'>how many type can we get data from the result set of mysql() ?</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'Arial Narrow'; color: rgb(40, 40, 40); "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; line-height: 18px; "&gt;1 mysql_fetch_row()&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; line-height: 18px; "&gt;2 mysql_fetch_array()&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; line-height: 18px; "&gt;3 mysql_fetch_object()&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; line-height: 18px; "&gt;4 mysql_fetch_assoc()&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-6584271013964037691?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/6584271013964037691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=6584271013964037691' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6584271013964037691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6584271013964037691'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/07/how-many-type-can-we-get-data-from.html' title='how many type can we get data from the result set of mysql() ?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-4803943881722930847</id><published>2009-07-15T08:28:00.000-07:00</published><updated>2009-07-15T08:30:04.859-07:00</updated><title type='text'>submit a form witout submit button.</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'Arial Narrow'; color: rgb(40, 40, 40); line-height: 18px; "&gt;by using javascript function submit() you can submit form.&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:'Arial Narrow';color:#282828;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;by giving onclick="submit();"  to a button.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:'Arial Narrow';color:#282828;"&gt;&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-4803943881722930847?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/4803943881722930847/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=4803943881722930847' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4803943881722930847'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/4803943881722930847'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/07/submit-form-witout-submit-button.html' title='submit a form witout submit button.'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-5095462123791676379</id><published>2009-07-15T08:25:00.000-07:00</published><updated>2009-07-15T08:28:15.332-07:00</updated><title type='text'>diffrent  bitween get and post ?</title><content type='html'>&lt;span class="Apple-style-span"  style=" color: rgb(40, 40, 40); line-height: 18px; font-family:'Arial Narrow';"&gt; When we submit a form, which has the GET method it displays pair of name/value used in the form at the address bar of the browser preceded by url. Post method doesn’t display these values.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-5095462123791676379?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/5095462123791676379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=5095462123791676379' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5095462123791676379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/5095462123791676379'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/07/diffrent-bitween-get-and-post.html' title='diffrent  bitween get and post ?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-6167197583541468853</id><published>2009-07-14T11:32:00.000-07:00</published><updated>2009-07-14T11:35:13.388-07:00</updated><title type='text'>Difference between mysql_connect() and mysql_pconnect()?</title><content type='html'>In shortly mysql_pconnect() makes a persistent connection to the database which  do not close when the execution of your script ends&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-6167197583541468853?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/6167197583541468853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=6167197583541468853' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6167197583541468853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/6167197583541468853'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/07/difference-between-mysqlconnect-and.html' title='Difference between mysql_connect() and mysql_pconnect()?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-1379762040973024051</id><published>2009-07-14T11:30:00.000-07:00</published><updated>2009-07-14T11:31:35.538-07:00</updated><title type='text'>Reverse sort an array</title><content type='html'>&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;span style="color: rgb(0, 0, 187);"&gt;&lt;?php&lt;br /&gt;$myworld &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= array(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"a"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"PHP"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"b"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"learning"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"c"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"I'm"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;krsort&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$myworld&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;print_r&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$myworld&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;?&gt;&lt;/span&gt; &lt;/span&gt; &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Which confirms your suspicions:&lt;br /&gt;&lt;br /&gt;Array&lt;br /&gt;(&lt;br /&gt;    [c] =&gt; I'm&lt;br /&gt;    [b] =&gt; learning&lt;br /&gt;    [a] =&gt; PHP&lt;br /&gt;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-1379762040973024051?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/1379762040973024051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=1379762040973024051' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1379762040973024051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1379762040973024051'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/07/reverse-sort-array.html' title='Reverse sort an array'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3554313364149478671.post-1287015736997822938</id><published>2009-07-14T11:24:00.000-07:00</published><updated>2009-07-14T11:25:13.337-07:00</updated><title type='text'>My own sort function?</title><content type='html'>In PHP you will, in most cases, be able to get by with one of the default sort functions, perhaps used in conjunction with each other.&lt;br /&gt;&lt;br /&gt;However there will be times where you want to sort based on some other factor.&lt;br /&gt;&lt;br /&gt;When you need to do this, you use the user sort function within PHP, which looks like this usort(array,function) where you specify the user-defined function that will sort the array.&lt;br /&gt;&lt;br /&gt;Here is a simple example I've whipped up using a user-defined function to sort an array based on the length of the values, which is useful if you want to find the longest word in an array, for example.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;span style="color: rgb(0, 0, 187);"&gt;&lt;?php&lt;br /&gt;$inputwords &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= array(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"whichever"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"word"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"is"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"the"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"longest"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"will"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"appear"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"at"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"the"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"top"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;usort&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$inputwords&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"sortlen"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;print_r&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$inputwords&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;&lt;br /&gt;function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;sortlen&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$a&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$b&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;) {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$lena &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;strlen&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$a&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;); &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$lenb &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;strlen&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$b&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;if (&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$lena &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;== &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$lenb&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;) return &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;0&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;return (&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$lena &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$lenb&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;) ? -&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;1 &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;: &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;?&gt;&lt;/span&gt; &lt;/span&gt; &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This prints the following:&lt;br /&gt;&lt;br /&gt;Array&lt;br /&gt;(&lt;br /&gt;    [0] =&gt; whichever&lt;br /&gt;    [1] =&gt; longest&lt;br /&gt;    [2] =&gt; appear&lt;br /&gt;    [3] =&gt; word&lt;br /&gt;    [4] =&gt; will&lt;br /&gt;    [5] =&gt; top&lt;br /&gt;    [6] =&gt; the&lt;br /&gt;    [7] =&gt; the&lt;br /&gt;    [8] =&gt; at&lt;br /&gt;    [9] =&gt; is&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;Just for completeness, let's reverse from symbol to sort with the shortest value in the array at the top:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;span style="color: rgb(0, 0, 187);"&gt;&lt;?php&lt;br /&gt;$inputwords &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= array(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"whichever"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"word"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"is"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"the"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"shortest"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"will"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"appear"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"at"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"the"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"top"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;usort&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$inputwords&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"sortlen"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;print_r&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$inputwords&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;&lt;br /&gt;function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;sortlen&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$a&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$b&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;) {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$lena &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;strlen&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$a&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;); &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$lenb &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;strlen&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$b&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;if (&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$lena &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;== &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$lenb&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;) return &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;0&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;return (&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$lena &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&lt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$lenb&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;) ? -&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;1 &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;: &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;?&gt;&lt;/span&gt; &lt;/span&gt; &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Which prints this:&lt;br /&gt;&lt;br /&gt;Array&lt;br /&gt;(&lt;br /&gt;    [0] =&gt; is&lt;br /&gt;    [1] =&gt; at&lt;br /&gt;    [2] =&gt; top&lt;br /&gt;    [3] =&gt; the&lt;br /&gt;    [4] =&gt; the&lt;br /&gt;    [5] =&gt; word&lt;br /&gt;    [6] =&gt; will&lt;br /&gt;    [7] =&gt; appear&lt;br /&gt;    [8] =&gt; shortest&lt;br /&gt;    [9] =&gt; whichever&lt;br /&gt;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3554313364149478671-1287015736997822938?l=phpfriend.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpfriend.blogspot.com/feeds/1287015736997822938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3554313364149478671&amp;postID=1287015736997822938' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1287015736997822938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3554313364149478671/posts/default/1287015736997822938'/><link rel='alternate' type='text/html' href='http://phpfriend.blogspot.com/2009/07/my-own-sort-function.html' title='My own sort function?'/><author><name>Rahul Dev Sharma</name><uri>http://www.blogger.com/profile/17805672570088583406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_BQwfKGYdglQ/TJ9oPvuTa7I/AAAAAAAAArw/tJOpRg2s_qM/S220/rahul+30.jpg'/></author><thr:total>0</thr:total></entry></feed>
