Php And Three Tier Architecture Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

To allow customers to upload their own meter readings online, WindPower launch a server-side page to archive this target. The web page have to be able to generate and post dynamic content, as well as read information to database management system (DBMS) for authentication. According to these requirements, the use of Common Gateway Interface (CGI) program is necessary.

Why using PHP

PHP is an open source project, especially for Web database applications, as it has integrated tools for Web and database environments. In particular, the flexibility of embedding scripts in HTML pages permits easy integration of the HTML presentation and code. Database layer integration support is also very good, more than 15 libraries available for almost all popular interaction with the database server. Web Database Applications with PHP and MySQL , 2nd Edition, David Lane, Hugh E. Williams, O'Reilly .This isn't to say that other scripting languages do not have excellent features. However, there are many reasons that make PHP become a better choice than others, especially well support to access DBMS.

PHP has many excellent libraries that provide fast, customized access to DBMSs and is an ideal tool for developing application logic in the middle tier of a three-tier application.

Three-tier architecture:

Because PHP integrates so well with HTML, using PHP to generate static sequence of characters is far less complicated, less interesting than other high-level language.

A PHP script can be written using plain text, you can use any text editor to create, such as the Unix editors joe, vi, vim, or a Microsoft Windows editor such as Notepad or WordPad.

What is our system?

Our system is three-tier architecture. In this architecture, including a cluster of database at backend, a set of web servers at the front end, as well as client from internet.

In the first part, there are some databases which is separate from the Web server. These databases hold a large-scale data, which means it requires more system resources to handle I / O and data processing. As a result, its performance will be strengthened.

In the second part, there is a Web server. This architecture provides load balancing to handle a large number of customer requirements from the Internet. In addition, the database is a separate Web server. This architecture protection of databases, to prevent direct access to the Internet. Conseguencely, safety will be improved.

In the final part, customers can complete all the steps and Web browser. Because the system is holding the engine on the server side, the client does not need to install any program in advance. In fact, customers can upload your own meter reading at any Web browser can access the Internet. Ultimately, the availability will be strengthened.

Save data into CSVr

In this design, the web server will create a Comma Separated Value (CSV) file to store customers' meter reading. While user press "Submit" button, their data will be inserted into the CSV file incremantally.

The meter input page:

The inserted data in CSV file:

How does it work?

In order to let user have a good using experience, user interface is simple and convenient. There only are 3 steps to finish the uploading of the meter reading:

1. Log in, then open meter reading upload page through the web browser.

2. Enter Account number, Meter Serial number, Meter reading and choose the day.

3. Click the submit button, the web page then, will display "Meter reading upload successful" and customer information for validation.

Step 1:

Open a web browser, and enter "". After user logged in, meter reading upload page will be displayed. Customer will find their last meter reading.

Customer will find their last meter reading:

Step 2:

Enter "Electricity Account no.", "Meter Serial no.", "Meter Reading", and choose the data in calender or input the day manuelly in yyyy/mm/dd format. Then click the "Submit" button. If necessary, you can click the "reset" button to re enter data.

Customer data sample:

Step 3:

Click the "Submit" button, and then client, then you will see a notice: "Meter reading upload successful" and the information that they submitted. These means the data was successfully uploaded.

The notification page:


In order to help customer input information correctly and avoid error happen in uploading meter reading, we should prevent them from uploading a meter reading that is less than the previous reading and not allowing meter readings for invalid dates. In addition, the web page should be able to appear message to notify user what mistake being happen. Furthermore, user would not be able to submit their data before the mistake were clean.

To let the web site have ability to check data and make real time respond, it should use a technology call AJAX (Asynchronous JavaScript and XML). AJAX is a name of a group of technology, include JavaScript, CSS, and XML. It could run on web browser and enhance the interactivity, usability and speed.

JavaScript could be a client side scripting language, developed by Netscape. JavaScript was released since 1996. At that time, it supported Netscape Navigator 2.0 and Internet Explorer 3.0.

XML(Extensible Markup Language) was design to improve data description, storing, and exchanging. It released in 1998 by W3C. Its node concept design and the hierarchical structure provide well support on data storing.

CSS(Cascading Style Sheets) is a Stylesheet language. It is used to separate the data layer and display layer in HTML. On other word, CSS could provide a fixable method to define and format the looking of the web page.

The most important usage of AJAX is using XHR (XMLHttpRequest) to play with web server. A XHR object will be created while user establish connection to web server. The XHR object will happen between web browser and web server. The XHR object will listen to the web servers' update for web page make a partly update. Then XHR will pass the update to the web browser to renew the part of web page. This mechanism successfully decreases the bandwidth using and data processing. AJAX was generally using on interactive web page, such as Google Map, Google search suggestion, and stock price quoting.

In our system, we are going to use JavaScript to do the validation, because JavaScript is a scripting language. JavaScript is able to use function to validate the data that does client input with right data we want. For example, is it input right day, month, and year. In addition, JavaScript could prevent user submit data if data was not meet the system enquired.

Create the variable:

Firstly, the script in would create a lot of variables that we are going to use (Pic 2.2).

The validation function

Then, we will use the function to do the validation (Pic 2.3). On line 19, the code is used to start checking by if loop with the conditions. The code on line 22 alert user "Please select date for meter reading!", if they have not input the day. From line 25 to 41, the function is setup to alert user if they are not input the correct year, month, day, also the meter reading.

The validation to the meter reading

From line 52, the JavaScript will check the meter reading input. It will alert if user input the meter reading is less then previous or it is not a number.

These code will disable the submit button

From line 120 to 136, the JavaScript will get the result from the script we talk above. If user input wrong data, the submit button will not allow user to press it. If the data is correct, the function will release the submit button. At this time, user will see the text on the button is black, not grey.

The submit button

The script from line 147 to 160 is about the submit button. The submit button will play with JavaScript (line 152), to get validate information. Considering there are if the browser could not play with JavaScript, line 155 to 158 allow user see the submit button without JavaScript.

Using the JavaScript, there are some advantage and disadvantage.

On the negative side, there have security and reliability problem. Because JavaScript is run on client computer, it is able be exploited for malicious purposes, Such as: Dead-code insertion, Code Transposition, Register Reassignment... Some user will stop JavaScript running, it will affect the system running.

Beside it, as the result of its portable, it running is fully relied on client side web browser. That means if client browser does not support JavaScript, or has not a new enough version, some script will be failed in running.

Although JavaScript have some weakness, there are many positive feature help it become developers' first choice.

Firstly, JavaScript is not load on server side, that save the running resources and increase server capacity. In other word, client can run JavaScript functions immediately, instead of wait for server reply.

Secondly, JavaScript is relatively simple to learn and implement. It is a open sources high level language, it is easy to implement, compared with other programming language like Python, Perl, C#…

Lastly, JavaScript is a well compatible language. It can insert into web page and other written in other language, like PHP and Perl. It can play with other language for variety of applications nicely.

In Conclusion, AJAX (especially JavaScript and XML) provide our system ability to do validation, which highly decrease the occurrence rate of wrong data. And its compatibility with PHP highly reduces development time cost. Finally, because it run on client side, it directly save server computing resources. It indirectly save administration cost, hardware investment cost and save the development cost.


In order to increase traffic and we can use a website plug-in called "add this." "This" is the easiest way to share we can Facebook, Twitter, and various web mail or other social networking sites. "Join the" who can share our website are used by different sites it is only one ball. If the site requires login, the user has logged in, "add this" automatically log on to the site. Moreover, users need only enter the information they want to share or send and kick button, and then will be shared. This will remember to add users. It allows users to more easily share can increase traffic to our website.

"Add this" can also help us to collect statistics, remember how many users to share our website or send them to friends. "Add this" how much traffic can be collected back to your static pages, you can see what share of the preliminaries on our website. "Add this" shared data to an existing Google Analytics report is easy, lets you view the "Add This" share custom events, on your dashboard. "Add this" will show all data in the past 30 days on any available domain. It can help us to update our website, so that more people can see and use our site.

"YouTube" is one of the largest video sharing site, one of the reasons it can be so successful because "YouTube" are using the "add this", it allows "YouTube" of a growing number of tourists. No only "YouTube" have a great marketing skills, but also "YouTube" have using other website to let more people know. It is a good example to know about the power of "share".

"Add this" is creating by a web page form. The form has asked where to put the button. And need to select the button style like does it needs to have the share count and how the button looks. And the website will automatically create the code by your selection and web master just need to copy the html code in to our webpage's html file then we can having "Add this" function. "Add this" has the largest open collection of services, and it will let "Add this" become better. "Add this" also support 50 languages, and it will automatically translate to the languages that suitable for us. "Add this" also trusted by sites like Whitehouse and a lot of government there is no doubt that the secure is very save. "Add this" also can suitable for differ web browser, such as "Internet Explorer","Firefox" and "Chrome".

For using the "add this" can directly increase our blog traffic and FAQ site, because it can provide a very simple way to allow users to share our website and blog. Through the use of email and the largest social networking site "Facebook." When the blog and website to increase traffic, we can accept questions in the form of more and more users, we can solve this problem, the form and answer questions as soon as possible to our users. This is also a number of advantages, use the "add this." Frist we can more easy to gather statics, because we can know more about how the people know our website is them know it on search engine or they know our website by their friends. Not only, but also "Add this" can support flash and SSL/ HTTPS security it will suitable for our website, it can fulfill the requirements set out in our FAQ website and our blog. On the other hand, mobile web browsing is also need to think about; because a lot of people are browsing by their mobile phone, "Add this" is support by android mobile OS that will be increase traffic. Another advantage for using "Add this" is, it will be more easy to answer the question form our users, because if users always share our answer, more people can see our it, more people can know about the question without asking us.

Although "Add this" got a lot of advantage, but we need to use more human resources to control this plug in on our website. In addition, maybe we need to use a better server to host our FAQ website and blog.

Use the "Add this" We need to put more human resources and time to control and collect statistics. We will "add this" bottom of the questions and answers for each, which allows users to easily share our site to other countries. Our "Add this" button will have "Facebook", "Twitter " "G-mail" and "Hotmail" it is the general sharing ways. To controlling "Add this", we will check the statistics every day and mark it down in a file, and "Add this" can displays the data form the last 30 days across the domains that have across us. And "Add this" can output differ report model like different flow chart for our click summary; content; services and geography, it is easy to let our doing report to the web master. This report can help webmasters understand how people know and what we always make our web site, their friends, then the site administrator can use this statistical data to improve our site.


Virtual host is much cheaper than a dedicated server. Rather than a machine to host a Web site, ISP can set up a machine's host hundreds of websites. To the user is browsing your site, it looks like you have a dedicated server. Drawback to the virtual host, your site is to share resources, machinery and all other sites hosted on this machine. You may also be limited to what kind of program can run on the server. If you can run the CGI program, you may be limited to very simple scripts or choose from the list the script has prechosen by the ISP. You may also tie to any e-commerce solutions for Internet service providers have chosen.

Virtual hosting is a way to host multiple domains on a computer using a IP address. This allows a machine to share resources such as memory and processor cycles to more effective use of its resources.

A widely used Web application is shared hosting. Shared Web Hosting Dedicated Web server is lower than the price, because many clients can reside on a server.

Virtual network is commonly used in large companies, whose business model is to provide low cost web hosting customers. Most such sites web hosting service customers on a global scale shared server hosting, web hosting technologies.

Many companies use virtual servers for internal use, there is a technical or administrative reason to keep several separate sites, such as customer extranet site, the staff extranet, intranet, various departments within the enterprise network. If there are no security concerns, the site structure, they can be combined into a single virtual host server technology to reduce management and administrative overhead, the number of separate servers required to support the business.

Our system is the three-tier architecture. In this framework, including a group of back-end database, a Web server front end, and the client in the form of the Internet. In the first part, there is database. The database is separate from the Web server. It has a large data, which means it requires more system resources to handle I / O and data processing. As a result, its performance will be strengthened. In the second part, there is a Web server. This architecture can provide load balancing to handle a large number of client requests in the form of the Internet. In addition, the database is isolated to form a network server, which consists of the database in the form of protection to prevent direct access to the Internet. As a result, safety will be improved. In the final part, customers can complete all the steps and Web browser. Because the system is holding the engine on the server side, the client does not need to install any program. In fact, customers can upload meter reading at any time, if the Web browser can access the Internet. As a result, availability will be strengthened.

A specific definition of "the cloud" because of the controversial blog, in popular scientific journals, and even in my own office. In the popular definition is based on the fact that the clouds are constantly changing, like the Internet itself. Whether your definition may be, "cloud" of course includes many different technologies. Including the number of cloud computing and cloud hosting.

Cloud hosting was developed years ago and in certain ways mimics cloud computing. It is a type of web hosting, there is a load balancer to determine how much CPU and other resources to the needs of each client. Then, the distribution of these resources as required, from the hosting provider's server farm. Users will only pay for what they use. Cloud hosting can host the site, but really want to build a scalable virtual environment, resource-intensive application development.

Cloud hosting is very useful if you are developing an API (application programming interface) or anyone who needs a lot of CPU or other resources. The examples include:

• If you need to upload thousands of images, resize them, and deploy it on the site like iStock Photo.

• If you have a project requiring thousands of calculations no time limit.

Cloud computing is Internet-based computing, that is, shared resources, software and information to computers and other equipment needs, such as the power grid.

Cloud computing is a paradigm shift following the shift from mainframe to client-server in the early 1980s. Details of the selected users, who no longer require specialized knowledge, or control, technology infrastructure "cloud", to support them. Cloud computing describes a new supplement, consumption, and IT service delivery model based on the Internet, it usually involves too, the Internet provides a virtual dynamic scalability and regular resources. This is a by-product and the consequences of the easy access to the remote computer's Internet website. This usually takes the form of Web-based tool or application, users can access and use the Web browser as if it is a program installed on your local computer. NIST, provides a more objective and specific definition here. The so-called "cloud" is used as a metaphor for the Internet, based on the use of clouds drawing in the past on behalf of the telephone network, and later to the Internet computer network diagram depicts an abstract as the great underlying infrastructure. A typical cloud computing providers to provide a common business online application is accessed from another Web service or software, such as a website, and software and data are stored on the server. A key factor is the cloud to customize and create a user-defined experience.

Most cloud computing infrastructure services, including through the establishment of joint centers and servers. Clouds often single point of access for all computing needs of consumers. Commercial products is generally expected to meet quality of service (QoS) requirements of customers, including service level agreements are usually (SLA). The main cloud service providers including Microsoft, HP, IBM, Salesforce, and Amazon, and Google.


Secure Sockets Layer (SSL) and Transport Layer Security (TLS) provide secure encryption protocol for communications networks, such as the Internet. SSL and TSL encrypted network connections section of the application layer, end to end to ensure the safety of transit at the transport layer. Several versions of the protocol widely used in applications such as Web browsing, e-mail, Internet fax, messaging and voice-over-IP (VoIP).

The Secure Sockets Layer (SSL) is a common security management protocol for the Internet transmission. SSL developed by Netscape for transmitting private documents via the Internet. It also received support from Microsoft and other Internet client / server development and the standard until evolving into Transport Layer Security. SSL is now a part of, including a modern Web browser such as IE, Firefox and Chrome, the Web server products.

Both Web servers and Web browsers rely on SSL encryption protocol to create a unique private communication channels through the public Internet. Each SSL Certificate contains two key: one public and one private key. Public key used to encrypt information and decrypt information encrypted using the private key. When the Web browser's security domain, A-level encryption built on the basis of the client SSL certificates and Web browser, and ability Caozuoxitong host server. As more and more widespread use of SSL, and some types of SSL certificates has emerged: Extended Validation (EV) SSL Certificates and Domain Validation (DV) of the SSL certificate.

Extended Validation (EV) SSL certificate is a new type of SSL certificate, which aims to provide users with more confidence, who you are, you control or have their own websites. EV SSL Certificates provide high security Web browsers information to clearly identify the site of tissue identity. The development of the network to determine the EV SSL certificate's browser is considered to be high-security browser. Their aim is to trigger unique visual cues indicate the presence of EV SSL certificates.

As people use e-commerce, business and social activities of the network, they would share their personal and confidential information. High-profile fraud and phishing scams can make the users concerned about the incidents of identity their issues. Before they enter sensitive data, they want to prove that the site is to believe that their information will be encrypted. Without it, they may abandon their shopping cart or other transaction, and other places to do business. High security web browsers and EV SSL Certificates provide third-party and the visual display, so that consumer confidence and build trust in online business validation.

Domain Validation (DV) of the SSL certificate server security certificates, providing a minimum level of authentication, from the commercial certificate authority.

How does it work? When the user through the SSL enrollment process, you will receive an e-mail address of your choice and SSL to verify domain ownership verification e-mail links. You only need to open the link and verify that "I agree", your order will be successfully validated and SSL will soon be issued. This makes the problem domain validation SSL fastest, because it requires several minutes to complete the entire process. Domain Validation SSL is the most suitable who need SSL, and want the immediate and safe and normal forms of site shopping cart.

DV also offers SSL certificates to encrypt and high reliability, because they have a standard CA RapidSSL, Geotrust's, Thawte issued. For more information about domain validation SSL in the SSL domain name only. SSL equipment, you want to display your company name and location of the proposed installation of business validation SSL certificates.

Before a DV SSL certificate can be issued, the issuing certification authority to verify the contacts in the field of the certificate of approval request. This approval is usually caused by e-mail, but can also be by telephone or by other methods. This is because the issue of DV SSL certificate usually can be automated, SSL certificates DV price is usually higher than the guarantee or EV SSL certificate, you need the human factor in the process of issuing certificates, and other organizations to provide low-level verification process.

Although DV SSL certificate owner's consent, they do not try to verify who the owner of this domain is very important. Verify that the domain to make this an ideal choice for a certificate, a man fishing and middleman attacks.

Transport Layer Security (TLS) is a protocol to ensure privacy and data integrity between client / server applications communicate through the Internet. TLS provides endpoint authentication and communications privacy over the Internet using encryption. When the communication between server and client, TLS to ensure that no third party may eavesdrop or tamper with any message. TLS is the Secure Sockets Layer (SSL) successor.

TLS is composed of two layers: TLS Record Protocol and the TLS Handshake Protocol. TLS Record Protocol provides some, such as the Data Encryption Standard (DES) encrypted secure connection. TLS Record Protocol can also be used without encryption. TLS Handshake Protocol allows the server and clients authenticate each other, negotiate an encryption algorithm and cryptographic keys before data exchange.

TLS protocol is based on Netscape's SSL 3.0 protocol, however, TLS and SSL are not interoperable. TLS protocol does contain a mechanism that allows TLS to achieve the return to the SSL 3.0. The latest browser versions support TLS. TLS Working Group, established in 1996 to continue work on the TLS protocol and related applications.