




已阅读5页,还剩14页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
ONLINE SHOPPING WEB PAGEbyLian CaiECE 345T.A. Purvesh Thakker7/22/99Project #17ABSTRACT Ever since its introduction to the general public in the early nineties, the Internet has gained more and more popularity amongst the general public. It has thoroughly changed peoples lives. Similar to television, radio, newspaper, and other forms of media, the Internet reaches a large portion of the population. However, the Internet also allows interaction between people. More and more businesses are taking advantage of the Internets popularity and its interactive capabilities of selling products to customers. Web pages are created to advertise and sell products to consumers. This paper describes the design of an online web page using PERL and CGI. The design allows customers to purchase products online using their credit cards. In addition, the design and testing of a clock circuit is discussed. Finally, the paper examines some ways in which the performance of the web page may be enhanced. iiTABLE OF CONTENTSAuthorPage1. INTRODUCTIONLC12. DESIGN PROCEDURELC53. DESIGN DETAILSLC6 3.1 Order.htmlLC6 3.2 Order.cgiLC7 3.3 Process1.cgiLC8 3.4 Process2.cgiLC94. DESIGN VERIFICATIONLC115. COSTLC126. SPECIAL CIRCUITLC137. CONCLUSIONLC158. FIGURESLC16iii1. INTRODUCTIONIn the not too distant future, any business, no matter what they sell, must consider going online as a way to stay competitive. Going online will not be a luxury, but a necessity. There are many reasons why going online is beneficial to both the industry and the consumers. The Internet obeys the law of increasing returns. As an example, imagine that a telephone network company has 10 customers and they call each other once a day. In one day, that is one hundred phone calls (10*10=100). Now suppose the company has one more customer. The number of phone calls becomes one hundred and twenty one (11*11). The number of customers for the company increased by 10%, but the profit of the company increased by 21%. This is one major reason why so many companies are trying to do business on the Internet. The Internet is basically a gigantic network where everyone is interconnected.Companies go online for several reasons. One major reason is that companies want to tap into the huge consumer base that is growing at a rapid pace. Another reason is lower overhead. It costs about $150 for a company to get a domain name, and another $150 to get access to a server with 10 megabytes of space to store files. This is much cheaper than renting a location, decorating the interior of the store, getting a parking lot, and also making sure the company is located in a geographically good location. In addition, the customer can access the companys web site from anywhere in the world. This way, a company does not need to move or rent new property if it decides to expand. This low over head can allow a company to cut down on the price of its merchandise; thus the savings gets passed down to the consumer. This makes a company more competitive. Furthermore, the company can also have advertisements to promote its products and online surveys to better market its products. Why would customers purchase merchandises online? The reason is because it is more convenient and cost efficient. A customer can purchase a product anywhere, at anytime. If a web site has a search engine, the customer can also search for a specific product. Since it costs less for a 1 company to sell online, the savings get passed on to the consumers. In addition, it is much easier for a customer to go around and compare different companies online so they can choose the one that offers the best deal. In a way, the Internet provides a medium where both companies and consumers can benefit. To aid companies in doing online transactions, software applications are needed. The primary goal of this project is to provide an application that makes online purchasing both feasible and convenient. The primary goal of this project is to develop a more efficient on-line ordering system. The web page allows the customer to look at an online catalog and select items that they wish to purchase. After the customer has decided what he or she wishes to purchase, the customer is then asked to input billing and shipping information. The web page has been designed to catch any possible errors. If an error occurs, the customer will be notified of where the error occurred. If there is no error, then the customer is asked to select quantities of each product and verify that all of the information is correct. After verification, the amount due is calculated according to individual state taxes and the cost and quantity of each item. The web page also allows the customer to input special requests on individual transactions. Another feature allows the customer to fill out company surveys. Furthermore, an individual invoice number is automatically generated for each customer. Every transaction is automatically logged into a log file, which allows the company to keep records of the transactions. In addition, once processed, email will be sent to both the customer and the company owner to confirm and verify the purchase. Figure 1. Server block diagramBefore continuing in the discussion, it may be helpful to have a general idea of the concepts behind this project. Figure 1 shows a web browser, a web server and a CGI script. Most web pages are static documents. To access a static document, first, the user sends a request from his or her browser for2the HTML document in the web server. After receiving the request, the web server sends the document back to the browser that then displays the web page on the users monitor. Notice the CGI scripts were never called or accessed in this process. Nothing special happens with a static document. There is little or no interactivity between the user and the web page. Web pages that allow user interaction are called dynamic web pages. In order for the user to interact with the web page, one needs a way for the web server to communicate with an external program. CGI (Common Gateway Interface) was created for this purpose. CGI is a standard that defines how a web server communicates with external programs. This is what makes dynamic processes possible. To understand how CGI works, look at Figure 1 again. A user inputs information on the browser and makes a request to have a CGI program process that information. The server then sends this information to the CGI program. After the CGI program has processed this information, it sends the results back to the server, which then sends it back to the browser to be displayed to the user. This project is composed of sixteen files, order.html, survey.html, order.cgi, process1.cgi, process2.cgi, survey.cgi, orderlog.dat, ordernumber.dat and item1.html through item7.html. What each file does will be discussed in detail later.Order.html provides the interface for which customers interact with the other files. Order.html allows the customer to view and select the products available. It also allows customers to input shipping and billing information. Furthermore, it has a link to the survey for the customer to fill out. Finally, order.html calls order.cgi. Order.cgi is called by order.html to process the information. The first task that order.cgi performs is to see if the user has inputted any errors. If there are errors, order.cgi pinpoints where the errors are so the user will be able to go back and correct the errors. When everything is correct, order.cgi outputs an html document that allows the user to select the number of quantities of each item he or she wishes to purchase. In addition, the document displays the information that the user just inputted and asks the user to verify that everything is correct. If everything is correct, process1.cgi is 3then called. The main task for process1.cgi is to calculate the sub price for each item, (sub price = quantity * price), calculate the tax applied, and then calculate the total price with the tax. It also asks the user to verify all the information up to this time. Once verified, process2.cgi is called.Process2.cgi is used to generate an invoice number using ordernumber.dat, write transactions to a data file called orderlog.dat. It is also used to send email both to the merchant and to the customer once a transaction has been processed.The survey.html and survey.cgi are an add-on to the system. Survey.html allows the user to make selections among a number of choices, once the user selects the results, that information is sent to survey.cgi. Survey.cgi then sends the information to the merchant. 42. DESIGN PROCEDUREThe first question that arises from this project was whether to use CGI or SSI. SSI (Server-side includes) are special purpose programs that perform actions and output the results in HTML. SSI works by having nametags of programs embedded in HTML pages. When an HTML page is invoked, instead of just sending the source code of the page to the browser, the web server searches for these special programs, executes the programs, replaces the nametags with the result of the program, and then sends the web page to the browser. The main advantage of SSI is that it allows server side execution. The main advantage of this is that one does not have to worry about client user power. Another advantage is that one can access a database on the server. The disadvantage is that during busy hours, SSI can overload a server since execution is carried out on the server side. The ECE server that this project uses supports both CGI and SSI. However due to server load considerations, CGI was chosen.One question that many have asked was whether Java was ever considered as an alternative to CGI. The decision was to have some parts of the project in Java and some other parts in CGI. CGI is good for applications that require a lot of data manipulation and form processing. Java, on the other hand, executes animation, graphics, and multimedia features. Unfortunately, the web server used in this project does not support Java, therefore this project is strictly CGI based. Another major decision was whether to use cookies or not. A cookie is basically a tiny bit of information that is passed in the HTTP response header. The processor then processes the information and stores it in a file such as cookie.txt. Cookies are very efficient for passing information between different pages at a web site. Unfortunately, all the references used for this project only briefly described cookies, so it is very hard to get any practice. Initially, there was a decision to use database and have a search engine that searches for what the user specifies. However, due to time constraints, the decision was made to take a simpler approach.53. DESIGN DETAILSFigure 2.Figure 2 provides a more detailed view of how the main components of this project work. This section will explain in detail how each part works. 3.1) Order.html:Order.html is the interface that displays all the products. (All figures from now on appear at the end of the report.) Figure 3 is an actual print out of this interface. The customer can also click on the item that they would like to purchase. A page would pop up displaying a picture of the product and a description of the product. This page allows the customer to select which product they wish to purchase. In addition, Order.html also provides the customer a convenient way to enter billing and shipping information. The information inputted includes type of credit card, expiration date, name of person receiving the product, and his or her address. In addition, if the person making the order is different from the person receiving the order, then 6the customer is also required to input his or her information also. Otherwise, the product is shipped to the same person and address. The phone number is required in case the merchant needs to get in touch with the customer. However, the E-mail address is optional. If it is given, then the customer will receive an E-mail confirmation if a transaction has been processed. In the special request section, the customer can ask for a special request to be made on a particular transaction.When the customer is ready, he or she clicks on the select quantities button. This automatically invokes the order.cgi program. Information is sent to the server. The server then sends the information to order.cgi to be processed. There are two popular methods of sending information to the CGI program. They are the GET and POST methods.In the GET method, the CGI program receives the data in the QUERY_STRING environment variable, while the web server transmits the data to the CGI program through the STDIN (standard input). However, GET can only transmit up to 255 characters of data.Fortunately, the POST method is not limited to 255 characters. In this project, the POST method is used. The statement, , in the order.html file means that the browser is sent the completed form filled by the customer to the server using the POST method. The server then gives the information to the script called order.cgi in the cgi-bin directory of the server. 3.2) Order.cgiAs it was indicated from above and from the flow chart in Figure 2, the order.cgi program is called by order.html to process the information of ordering. The first job of order.cgi is to check the data inputted to see if there is any error on the information gathered. Three variables: $Nrecords, $CKcard and $CK are used to determine if the order can be made. Here, $Nrecords stand for the numbers of the items selected by the customer. If $Nrecords equals to zero, it means the customer did not select any items to order. $Ckcard tells if there is an error in the credit card input field. It is the return value of subroutine check_card. Due to time constraints, the only way for it to check if a credit 7card number is correct or not is by counting the number of digits in the credit card number. Master Card has 16 digits. VISA card has either 13 or 16 and American Express has 15 digits for their credit card number. So if a customer inputs 12 digits, then obviously he or she will get an error telling him or her that the credit card number is not correct. $CK checks the customers profile data. $CK is initialized to zero. If there is an error on the information checked, $CK increments by one. For example, if the zip code entered by the user is less than 4, then $CK increments to a non-zero value. If there is any error with the variables $records, $CKcard or $CK, order.cgi will call the subroutine order_no. The subroutine order_no then pinpoints the missing or incorrect information, and asks the customer to go back and correct it using the back key on the browser. This process will be repeated until no error is found on the information provided by the customer. A typical example is shown in Figure 4 in which the customer forgot to input a bunch of fields. Notice where the error identified is in bold. If order.cgi found no errors, it will call subroutine order_yes. The subroutine will first display a table that contains the name of items selected, description, and respective price. In addition, there will be a box where the customer will be able to select the quantity of each item he or she wishes to purchase. Furthermore, the information entered by the customer on the billing and shipping will be displayed for further verification. Figure 5 is a typical illustration. After a customer has selected quantities that he or she desires to purchase, the customer can click on the “Preview Invoice” button to show a view of his or her order. This invokes another CGI script called process1.cgi. 3.3) Process1.cgiProcess1.cgi is used to calculate the sub price for each item. Sub price = quantity * price. It is also used to calculate the total price with tax incorporated into it. The tax is calculated automatically based on the data provided in an associated array %taxrates(IL,0.078,CO,0.053,CA,0.083,NY,0.084 NA,0.05.) from the state where the8 customer resides. The program will automatically find the corresponding tax rate. It is pretty simple to look up the key and then see its corresponding value. For instance, a look up of Illinois would give a tax rate of 0.078. The program could also be used by customers abroad. At the moment, a flat tax is being applied to all foreign countries. This can be changed in the future, as each country can have a different tax rate in the associative array.The sub price, tax, total price, and related information will also be displayed for the customer to make further review. In fact, all information displayed in this page is organized as an invoice. If the customer finds any mistake, the program provides the customer with one last chance to make any necessary modifications. Once the customer is satisfied with the items selected, including the quantities and prices, he will click on the button titled “Final Processing.” Figure 6 is an illustration of this page. Once the “Final Processing” button is clicked, another script called process2.cgi will be called.3.4) Process2.cgiFirst, the proce
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 想变成狗的猫绘本课件
- 2026届山西省翼城中学化学高二第一学期期末学业水平测试试题含答案
- 患者搬运法课件
- 恐龙课件文案
- 塔吊保养考试题及答案
- 机电矿长考试题及答案
- 护士小组面试题及答案
- 中航西飞招聘考试试题及答案
- 停车起步考试题及答案
- 小学剪纸试题及答案
- 会议活动风险管理研究-全面剖析
- 机械传动知识课件2
- 2025年度运输业安全生产知识竞赛试题(附答案)
- 光伏居间的合同8篇
- 从业人员培训管理制度
- 酒店前台礼貌礼节培训
- 幸福心理学-(彭凯平)
- 2025年中邮保险招聘笔试参考题库含答案解析
- 《中国老年糖尿病诊疗指南(2024版)》解读课件
- 《中国女性乳腺癌患者糖尿病和糖尿病前期管理专家共识》 (2024版)
- 特种设备安全检查与巡查制度
评论
0/150
提交评论