Learn Hosting,WebDev,Scripting Make Money Hosting, WebDev,Scripting
Home :: HostScreamer.com
 
   

Why Php Makes Perfect Sense

March 3rd, 2007

By Femi Lana

PHP is one of the fastest growing web scripting languages on the Internet today, and for good reason. PHP (which stands for Hypertext Preprocessor) was designed explicitly for the web. Designed in 1994 to enable the creation of dynamic web pages quickly and easily, PHP has exploded in growth and has been adopted by major vendors such as Linux that have included the language with their web servers. The language is easy to learn and works with a variety of operating systems. PHP’s strong performance, coupled with its modest learning curve, has made it the language of choice for many businesses wanting a cost-effective rapid application development solution for the web.

One of the main reasons that developers choose PHP is its simplicity and ease of use. PHP competes against a number of other web scripting solutions such as Active Server Pages and PERL, but none of these languages are as easy to learn as PHP. Further, some languages require a moderate amount of programming background before a developer can get up to speed in development. With PHP, however, even non-programmers have been able to develop web-based solutions within a matter of days after going through the basic tutorials on PHP. PHP commands are simply embedded into the same web page with HTML commands, and execute on the server to deliver the web pages to the user.

Another big advantage of PHP is its interoperability with multiple operating systems. A company can use PHP with either Linux, Windows or Macs for example. They can also use PHP with the popular open source Apache server. Compare that with Microsoft’s Active Server Pages, by contrast, which is primarily designed for Microsoft-enabled servers. Portability is becoming a chief concern for businesses that use one or more operating systems in their businesses. Businesses save money by using PHP to leverage their existing I.S. resources rather than investing large sums of money to purchase proprietary products.

PHP is an open source product with a worldwide community of developers. What this means for businesses is that there is a large network of developers who can continually refine PHP to make it a better product. It’s no surprise that since its inception in 1994, developers have created a large library of useful add-ins to make PHP even more powerful than ever. PHP includes support for native databases among numerous other “plug and play” features that enable users to exploit the language to its fullest.

The result of all of this for developers is rapid application development. This is especially important for the web, where businesses must develop web-based applications that can respond to the real-time demands of e-Commerce. PHP enables companies to deploy their web-based solutions quickly, and modify them just as easily when needed. PHP is a stable, reliable language for administrators to use as well. PHP is easily customized to work seamlessly with Open Source databases such as MySQL.

Because of its lightweight design, PHP is fast and performs exceptionally well. Numerous companies have realized that PHP is the best solution for their web server needs. Companies such as Lycos in Europe offer services that are completely written in PHP. The language is well able to handle the voluminous amounts of traffic delivered on a daily basis. Many other major corporations worldwide have used PHP for their enterprise needs as well. These companies include Cisco, Worldcom, Motorola, Air Canada and Deutsche Bank, to name a few.

A number of important statistics mark important milestones in PHP’s growth. According to a Netcraft survey in May 2001, PHP’s popularity grew at a monthly rate of 8-11%. To put this in perspective, the growth of the entire Internet is 4%. At the time the survey was taken, 6.5 million sites were using PHP. As of 2002, PHP leapt beyond Microsoft’s Active Server Pages as the most popular web scripting language in use. PHP is used on 24% of the sites on the Internet.

Clearly the many benefits of PHP have made it the ideal solution for businesses to use in deploying their web-based applications. Companies small and large know that for ease of use, rapid development, superior performance, stability and reliability, and a large worldwide community of users and developers, few languages can come close to delivering what PHP can offer.

visit us at www.futuretrend.co.uk to see how we can help you get the most out of your php applications. Futuretrend’s courses are tailored to industry standards by web professionals

Article Source: http://EzineArticles.com/?expert=Femi_Lana  



Developing A Login System With PHP And MySQL – Part 1

February 25th, 2007

Part 1 By John L

Most interactive websites nowadays would require a user to log in into the website’s system in order to provide a customized experience for the user. Once the user has logged in, the website will be able to provide a presentation that is tailored to the user’s preferences.

A basic login system typically contains 3 components:

1. The component that allows a user to register his preferred login id and password

2. The component that allows the system to verify and authenticate the user when he subsequently logs in

3. The component that sends the user’s password to his registered email address if the user forgets his password

Such a system can be easily created using PHP and MySQL.

===============================================

Component 1 – Registration

Component 1 is typically implemented using a simple HTML form that contains 3 fields and 2 buttons:

1. A preferred login id field
2. A preferred password field
3. A valid email address field
4. A Submit button
5. A Reset button
Assume that such a form is coded into a file named register.html. The following HTML code excerpt is a typical example. When the user has filled in all the fields, the register.php page is called when the user clicks on the Submit button.

[form name="register" method="post" action="register.php"]

[input name="login id" type="text" value="loginid" size="20"/][br]

[input name="password" type="text" value="password" size="20"/][br]

[input name="email" type="text" value="email" size="50"/][br]

[input type="submit" name="submit" value="submit"/]

[input type="reset" name="reset" value="reset"/] [/form]

The following code excerpt can be used as part of register.php to process the registration. It connects to the MySQL database and inserts a line of data into the table used to store the registration information.

@mysql_connect(”localhost”, “mysql_login”, “mysql_pwd”) or die(”Cannot connect to DB!”); @mysql_select_db(”tbl_login”) or die(”Cannot select DB!”); $sql=”INSERT INTO login_tbl (loginid, password and email) VALUES (”.$loginid.”,”.$password.”,”.$email.”)”; $r = mysql_query($sql); if(!$r) {

$err=mysql_error();

print $err;

exit(); }

The code excerpt assumes that the MySQL table that is used to store the registration data is named tbl_login and contains 3 fields – the loginid, password and email fields. The values of the $loginid, $password and $email variables are passed in from the form in register.html using the post method.

===============================================

Component 2 – Verification and Authentication

A registered user will want to log into the system to access the functionality provided by the website. The user will have to provide his login id and password for the system to verify and authenticate.

This is typically done through a simple HTML form. This HTML form typically contains 2 fields and 2 buttons:

1. A login id field
2. A password field
3. A Submit button
4. A Reset button

Assume that such a form is coded into a file named authenticate.html. The following HTML code excerpt is a typical example. When the user has filled in all the fields, the authenticate.php page is called when the user clicks on the Submit button.

[form name="authenticate" method="post" action="authenticate.php"]

[input name="login id" type="text" value="loginid" size="20"/][br]

[input name="password" type="text" value="password" size="20"/][br]

[input type="submit" name="submit" value="submit"/]

[input type="reset" name="reset" value="reset"/] [/form]

The following code excerpt can be used as part of authenticate.php to process the login request. It connects to the MySQL database and queries the table used to store the registration information.

@mysql_connect(”localhost”, “mysql_login”, “mysql_pwd”) or die(”Cannot connect to DB!”); @mysql_select_db(”tbl_login”) or die(”Cannot select DB!”); $sql=”SELECT loginid FROM login_tbl WHERE loginid=’”.$loginid.”’ and password=’”.$password.”’”; $r = mysql_query($sql); if(!$r) {

$err=mysql_error();

print $err;

exit(); } if(mysql_affected_rows()==0){

print “no such login in the system. please try again.”;

exit(); } else{

print “successfully logged into system.”;

//proceed to perform website’s functionality – e.g. present information to the user }

As in component 1, the code excerpt assumes that the MySQL table that is used to store the registration data is named tbl_login and contains 3 fields – the loginid, password and email fields. The values of the $loginid and $password variables are passed in from the form in authenticate.html using the post method.

CONTINUED…

Used with the author’s permission. This article is written by John L.
John L is the Webmaster of Designer Banners (http://www.designerbanners.com).

Article Source: http://EzineArticles.com/?expert=John_L