8.5 Exercises

8.5  Exercises

1.  (Easy: Environment Variables)

Write a CGI program that returns the values of the environment variables. Run this program from a browser running on a Unix, a Windows, and a Macintosh machine. Compare the value of the environment variables. Make a table showing the values for the three systems. Understand the names of the environment variables and the values they have.

2.  (Easy: Web Graphic Creation)

Write a CGI program that returns a graphic image that it creates on the fly. The image is in JPEG format. Use a module such as GD.pm to do so. Let the CGI program return a random, but somewhat appealing image every time.

3.  (Easy: Web Graphic Creation, Access Counter, Multiple Counters)

Write a CGI program that returns a graphic image of an integer. This CGI program reads from a simple text file where the current value of the integer is stored. The text file contains only one integer. Every time the CGI program is called, the integer is incremented by the program and a graphic image corresponding to the new value of the integer is sent to the Web browser. Link this CGI program from a Web page, with appropriate arguments if any, using the GET syntax to show the image. Use this link as a counter in the bottom of a Web page, possibly, your personal Web page.

Learn how a file can be locked. Lock the counter file so that two or more browsers invoking the CGI program at the same time does not override each other’s update of the counter value.

Extend the program further so that several counters can be kept in the same file on the server. Give each counter a name. Identify the counters in the text file with the name assigned. Use the same CGI program but with different counter names to update the appropriate counters. Place links to the CGI program with appropriate arguments on various Web pages.

4.  (Easy: Environment Variables, Browser)

Write a CGI program that keeps a log file with statistics on browsers that access the Web site. Assume there are at least two main browser brands and their various versions. Keep track of version numbers as well.

The program should run discreetly. For example, a program that maintains a graphic counter on the top Web page for a site can keep the browser statistics as well.

5.  (Easy: Web Log Analysis)

Write a CGI program that keeps statistics on the type of domains that access a Web site. The domain types can be edu, org, com and gov for the United States. The program also keeps track of which country the visitors have come from, for those domains for which it can figure out the country of origin. The program does so discreetly. For example, the program can do the statistics gathering along with the CGI-based counter program discussed earlier.

6.  (Medium to Hard: Web-based E-mail, Can be a long-term project)

  Write a CGI program that can interface with a Unix mail server and allow one to read mail over the Web. This can be potentially hard. Research into how Unix mail servers work and how one can read the mail from the server. Write an algorithm and then implement it. List all problems you face and how you solve them.

7.  (Medium: Cookies, Research)

 A CGI program can send cookies to a browser. Due to lack of space, cookies are not discussed in this Chapter although they are briefly discussed in the next Chapter. Read documentation on cookies on the Web at a site such as www.cookiecentral.com. Perl has modules that can help a program generate cookies with the correct syntax. Look at www.cpan.org for relevant modules. Now, enhance the CGI programs discussed in this book so that they can set cookies.

8.  (Hard: Chat Program, Reseach, Can be a long-term project)

Write a program that allows individuals to chat on the Web. Such a program can be potentially hard to write, depending on how much sophistication you want to incorporate. Concepts and tools from CGI programming as well as network programming are needed to write such a program. Start very simply. Once you have a simple working version, document the improvements that can be made to such a program. Discuss how improvements can be implemented, and implement some. Go through several cycles of improvement.

9.  (Hard: Chat Program, Cryptography, Research, Can be a long-term project)

Extend the chat program in the previous problem so that chatting can be done securely using encryption techniques.

10.  (Simple to Medium: Amortization)

Write a CGI program that calculates loan repayment schedules on the Web. Suppose someone types in a principal amount, the rate of interest, whether it is simple or compound, and the length of the loan period, on an HTML form on the Web. The program prints the length of time that will be needed to repay the loan, and also an amortization schedule.

11.  (Simple to Medium: Amortization, Web Graphics)

Learn how you can draw a graph using a Perl module. Write a CGI program that returns a bar graph or any other kind of graph, showing how the principal decreases after every year of a loan’s life. This problem extends the previous problem.

12.  (Medium to Hard: Text Processing, Artificial Intelligence, Can be a long-term project)

Write a program that can chat with a user like the simple version of the Eliza program discussed in Section 4.12.2. The program allows a user to type in a statement, reads it, and responds to it in an “intelligent” manner. Document the problems you see in the implementation. Discuss how you can solve them. Implement some of your solutions.

13.  (Medium to Hard: XML, Research)

A CGI program can return XML documents. However, you will have to know how to use XML, its syntax, DTDs, XSL stylesheets, etc. All these are outside the scope of this book. We assume you will learn all these on your own. Now, once you have done that, rewrite all the CGI programs in the text that produce HTML pages to produce XML pages instead.

14.  Medium to Hard: Search Engine, Text Processing, Can be a long-term project)

In the exercises for Chapter 7, you were asked to write a search engine for a “small domain.” Re-read the description of these problems. Now, write a CGI program that allows users to interface to the underlying search engine using an HTML form. The form allows users to search for keywords using logical and and logical or. The CGI program returns a nice-looking HTML document with the search results.

15.  (Medium: Research, Module Installation, May need root permission)

Learn how the Apache web server works. The Web server usually has to fork a process for each CGI interaction with a browser. This is expensive in terms of resource requirements and time. It is now possible to make the process faster so that a new process does not have to be created every time. This is done by embedding Perl in the Apache web server. Research into how this can be done. Install any modules that you can find to do this that is free or costs just a little.

16.  (Hard: Many interactive components, Long-term project)

A Virtual Bookstore

You are going to write a program that supports the operation of a virtual bookstore called the Garden of the Gods Booksellers.

You need to have a large textual bibliographic file in the bibtex format for the project. An example bibliographic file is at

http://www.cs.uccs.edu/,kalita/work/bookstore/all-books.html. An entry in this file looks like the following.

 

@Book{edward-gait-1906,

  author =      "Gait~b1863, Edward Albert",

  title =       "A History of Assam",

  publisher =   "Thacker, Spink \& Co.",

  year =        "1906",

  editor =      "",

  volume =      "",

  series =      "",

  address =     "Calcutta",

  topic =  "History; Assam",

  edition =     "",

  price  =  "$20",

  month =       "",

  note =        "PATG"

}

 

It tells us that it is a book entry. All our entries are for books in this file. It has an internal index called ‘edward-gait-1906.’  Then, it gives us some details about the entry.

Please note that some fields may not be specified. Also, you cannot assume that the fields are in the same order all the time. You also should anticipate that some fields may be added or removed later. There can be blank spaces or lines anywhere inside an entry.

Note that in a real project, one would use a database and not a text file. The database will have tables, and one of the tables will correspond to the text file we talk about here.

Things to Do

Make a directory called bookstore and put all your files and sub-directories under it. Divide the work you do into an ample number of subroutines so that later modification to the program is easy. The sub-tasks are listed below. These assume you know HTML fairly well. If you do not, pick up a book in a bookstore and learn on your own. HTML is a very easy language.

(a) Let the user search this file in three possible ways: by title, by topic, and by author. Searching is done by presenting a form to the user. You need to link the Perl search program to the home page for the bookstore.

(b) Provide a clickable help file for users who want to do complex searches. You should not allow them to use all possible regular expressions Pearl allows. It could be very complex and confusing for a lay person surfing the Web.

(c) Process the selected entries to produce a presentable HTML document that contains the bibliographic entries. This HTML document should look nice and be easily readable. Present only the author and title now. But, make the information that you supply for each book clickable for more information. When the user clicks on a book, show all the details about the book from the database entry.

(d) Give the customer a way to choose any of the search results and put it in a shopping cart. Any time the user puts anything in a shopping cart, let the customer see the whole shopping cart at that point in time if he/she wishes. Tell the user that he/she can pop books out of the shopping cart now or any time later. For the shopping cart, use a temporary file in the /tmp directory. This tmp file should be unique to each order.

(e) Let the user search as many times as he or she wants to. This you can do by having a little form that shows up somewhere on the screen: A form that asks the user whether he or she wants to search again, or whether he or she is done with searches.

(f)  Once the user is done with all his or her searches, allow him or her to look at the shopping cart. Use a form to present the selected entries. Compute the total price. Let the user deselect books at this time if he or she wants. Let the user go back to the search mode also.

(g) Select some books as specials of the week and sell them at 25% discount. Gently show one special of the week at a time as the user performs search. The special of the week should be selectable for buying. The specials of the week are stored in a file called specials.html using the bibtex format. Create this file on your own.

(h) Give a discount of 10% if the user buys more than three books, and a discount of 20% if the user buys more than 6 books. Add shipping and handling cost.

(i)  Once the user has selected a set of books, ask the user to enter (in a form), a name, an e-mail address, a surface address, a phone number (use it as an internal index or key; make up a unique key if the phone number is not provided), a credit card number with its type (let the user select among popular credit cards) and expiration date. Keep all the customer information in a textual database that you add to as you get new customers. Note that the program at this time is not secure.

(j)  Send a confirmation of the order with the list of books and prices to the user. This confirmation is sent by an e-mail message that the system generates automatically.

(k) Let the user the choice of joining one of several mailing lists whose names appear in a pop-up menu. Get the names of the mailing lists by looking at the topic entries of the books the user has bought. You create a mailing list by keeping e-mail addresses in a file with an appropriate name. If the customer decides to join a mailing list, append his or her e-mail address to the end of the file that contains the e-mail addresses for the appropriate list. Keep all the mailing list files in a specific sub-directory named mailing-lists.

(l)  Keep all the orders from all users in a file that store employees can access later for shipping purposes. Each entry in the order information database should contain the customer identifier (phone number), the book identifier (the book’s internal index), the date of purchase, the date of shipping, and the price of the book. Keep this information in a textual file.

For The Employees

We want to allow the employees of the bookstore to be able to look at customer data. You need to write the Perl routines which the employees of the bookstore can use to search the customer information.

(a) Make available a password protected link on the WWW page for employees so that they can look at the customer and order databases. Store your passwords in a file called passwords, which can be a text file. Before they are given access to the customer and order information, the employees first must be given a way to enter a username, a social security number, and then a password. Once they have registered with a password, they may change their password any time if they can provide their username and the old password. Note that here are simulating a very simple authentication mechanism that is not really secure.

(b) Make an HTML table to allow employees to view a list of customers in descending order of money they have spent. The owner and employees should be able to do this from the browser, but by using the password.

(c) We will allow empolyees to enter new books into our book database. New books are entered by the employee by typing in a file name that contains a list of new books. The list of new books is in a file called newItems.txt. This file also uses the same format given earlier. Create this file on your own. As each new book is added, make the system send e-mail to the users who have shown interest in books of that kind and have joined the appropriate mailing list. Use the topic field in the new book’s entry to select for appropriateness. You send details about a book in a mail message. You loop through every e-mail
address in the mailing list file.

17.  (Hard: Many interactive components, Long-term project)

A Virtual Grocery Store

Assume there is a grocery store called Kalita’s and you have been employed to develop Web presence for it.

All the machine specific instructions pertain to a Unix or Linux machine. Create a directory called public_html as a subdirectory in your home directory. The directory must be readable and executable by everyone, and the file must be readable by everyone.

Now, we are going to make an initial effort at writing our grocery store program. Make a directory called GroceryStore in your public_html directory and store all your files for the effort under this directory.

We are going to make up a syntax for entering our grocery store items. This may not be the best syntax, but this works. It gives us the flexibility that we need for our purposes. In real life, such a program would use a database with one or more tables.

Let us assume that we have grocery items belonging to the following categories Produce, Deli, Dairy, Meat, Beverages, Snack Foods, Paper Products, Books and Magazines, Spices and Condiment, and Frozen Foods.

Write up a file for the grocery items that we have in the store. Let this file have 15 items belonging to any five categories given above. Have 3 items per category.

An entry in this file looks like the following.

 

@Item{

  ID =                  "20-130-5000",

  name =                "Philadelphia Cream Cheese",

  category =            "Dairy",

  manufacturer =        "General Foods, Inc.",

  price =               "0.99",

  unit=                 "ounce",

  unitsPerItem =        "16",

  packaging =           "plastic container",

  inventory =           "1000",

  description =         "Low calorie; No fat"

}

 

It tells us that it is a grocery item. It has an internal ID. Then, it gives us details about the entry. Note that some fields may not be specified. Also, a field may be specified over several lines.

Our goal now is to make up a Web page from the item file. By processing this file, we want to make an HTML page where the item categories are shown as clickable links. Show the items in a sorted manner. When a user clicks on a link for a certain category, show all the products in that category with detailed information that you deem important. You should sort the items.

Things to Do

The sub-tasks are given below. Divide the work you do into an ample number of subroutines so that later modification to the program is easy.

(a) We will let a customer look at items in virtual aisles. When a customer wants to search items belonging to a certain category (say, Dairy), produce (a) neat-looking aisle(s) where clickable names of the items belonging to the category are shown. When a customer clicks on a name, more details about that item are shown in a pleasing format.

(b) Let the customer also search the database by the name of an item. Allow for partial specification of the item’s name. The result of the search should be a clickable list of items that the customer can click for more detailed information.

(c) Give the customer a way to choose any of the search results and put it in a shopping cart. Any time the user puts anything in a shopping cart, let the customer see the whole shopping cart at that point in time if she wishes. Tell the customer that she can remove items out of the shopping cart now or any time later. For the shopping cart, use a temporary file in a temporary directory. This temporary file should be unique to each order.

(d) Let the customer search as many times as she wants to. This you can do by having a little form that shows up somewhere on the screen: A form that asks the user whether she wants to search again, or whether she is done with searches.

(e) Once the user is done with all her searches, allow her to look at the shopping cart. Use a form to present the selected entries. Let the user deselect items at this time if she wants. Let the user go back to the search mode also.

(f)  Once the user has selected a set of items, ask the user to enter (in a form), a name, an e-mail address, a surface address, a phone number (use it as an internal index or key; make up a unique key if the phone number is not provided), a credit card number with its type (let the user select among popular credit cards) and expiration date. Keep all the customer information in a textual database that you add to as you get new customers.

(g) Send a confirmation of the order with the list of items and prices to the customer. This confirmation is sent by an e-mail message that the system generates automatically.

(h) Keep all the orders from all users in a file that store employees can access later for shipping purposes. Each entry in the order information database should contain the customer identifier (phone number), the item identifier (the item’s internal index), the date of purchase, the date of shipping, and the price of the item. Keep this information in a textual file.

For The Employees

We want to allow the employees of the grocery store to be able to look at customer data. You need to write the Perl routines which the employees of the store can use to search the customer information.

(a) Make available a password protected link on the WWW page for employees so that they can look at the databases. Store your passwords in a file called passwords, which can be a text file. Before she is given access to the customer and order information, the employee first must be given a way to enter a username, a social security number, and then a password. Once an employee has registered with a password, she may change their password any time if she can provide their username and the old password. Note that the passwords are insecure.

(b) We will allow employees to enter new grocery items into our items database. New items are entered by the employee by typing in a file name that contains a list of new items. The list of new items is at newItems.txt using the format given earlier. Create this file on your own.

18.  (Hard: Many interactive components, Long-term project)

A Virtual Auction Site

Assume there is an auction house called priceIsRight.com and you have been employed to develop Web presence for it. You can develop the pages on any machine of your choice, but ultimately, you must transfer the files to a Web server. The machine-specific instructions below are about a Unix machine.

Create a directory called public_html as a subdirectory in your home directory. The directory must be readable and executable by everyone, and the file must be readable by everyone. Create the top page for the auction site under this directory.

We will now enhance the auction Web site to make it dynamic in nature. To make things dynamic, we need to have our data in files and create HTML or XML pages from these files using Perl programs, which may or may not be CGI programs. Note that the project requires you to learn HTML and XML on your own.

Organizing the Files

In your public_html directory, Make subdirectories html, xml, data and cgi_bin to store your files. Organize them neatly under each sub-directory. You can make additional subdirectories or sub-subdirectories if you find the need for it.

Data Files

We will keep all the data that are needed in text files. There will be at least four data files. Let’s call them sellers.txt, bidders.txt, auctionCategories.txt and auctionItems.txt. In the sellers.txt file you will save details about persons putting items on the auction block. In the bidders.txt you will store information about persons bidding on items. Both sellers and bidders will provide the data to you by filling in forms on the Web site.

In the file auctionCategories.txt store details about categories of items to be sold. In the file auctionItems.txt, store details of all items being auctioned. Of course, you will have to store the category of an item being sold in the auctionItems.txt file. Therefore, there should be some correspondence between what you store in the auctionCategories.txt file and the auctionItems.txt file.

Decide on a reasonable syntax for all four files. In a real company, such files will be stored in databases, but we will have to make do with text files where you can store various “fields” for an entry separated by some predefined text separator.

Programs to Generate HTML and XML files (non-CGI) for Categories and Items

You will now write programs that will generate HTML files for the site. These files should automatically create the files that are going to be displayed on the Web. Do as little as possible by hand. For example, when you create any files or directories, change their permission modes within your program. These programs will not be linked to the Web, but you will run these programs by hand from time to time. Create files or sub-directories within the program. Don’t move files by hand if you can help it.

These new files that you generate are going to be form the core of your auction site. Link the new files to the main page of the auction site. Indicate that they were program-created when you link them. Of course, you may need a few hand-created files to make the site complete.

Extra Credit

Write Perl programs to create XML files corresponding to categories of items and individual items.

CGI programs for Sellers and Bidders

You will now write additional Perl scripts that are going to be linked to forms on the Web site. You will have a CGI program linked to the page where the seller registers to put an item on the auction block. This CGI program will take the seller data entered in the form and add the new details to the sellers.txt file. On the page where a seller enters personal information, provide a link to those who have already registered. When someone registers, ask her or him to choose a seller ID and a password. You are going to store the seller ID and password in the sellers.txt file. Do not worry about security issues. Normally passwords would be stored in an encrypted form. If a person is already registered, let him or her be able to put items on the auction block without having to enter personal data again. If a person has not registered earlier, allow the person to enter personal data and register.

Once a person is registered, take him to the page where he or she can put items on the auction block. Once again, here you need a form where the person enters all the data about the item he or she wants to auction. You need to write a CGI program that is going to take all this data and put it in the file auctionItems.txt. If the item’s category doesn’t exist already, you need to modify the

auctionCategories.txt file also.

You need to write CGI programs for bidding also. The bidder side is similar to the seller side also. You need to ask bidders to create an ID and a password in addition to entering other details. If a person is a registered bidder, he or she should be able to enter the ID and password, and go to a page where he or she can bid on an item. If he or she is not already registered, he or she should be asked to enter personal details.

Programs to Work with Additional Data Files

Corresponding to every item in the auction block, we should also have a file that contains details of how the auction is proceeding. It should have details such as when the auction started and when it is going to end, the minimum price accepted, and the current maximum price, etc. You can keep this information on top of the file. Then, you should keep details of who have bid and what price he or she is willing to pay. For this assignment, you can make the assumption that each item is on the auction block for 48 hours. Once 48 hours are over, declare a winner, and the winning price. You need to do this by a Perl program that is not going to be connected to the Web, but run by you, say every once in
a while.

A Search Engine for Your Auction Site

You will now create a search engine for the auction Web site that you have created. You will perform searches over HTML pages only. You must have all your HTML pages in the directory called html under your public_html directory. You may have subdirectories in the html directory. If you have not placed all your HTML files in the html directory, please do so now.

You will make an analysis of all your HTML pages related to the auction house including those in the sub-directories.

The following is the bare minimum idea. Search engines are much more sophisticated than this. When you analyze an HTML file, keep track of all the words that occur in the title, in the meta tag with content attribute, at various heading levels, and in regular paragraph text. You will have to strip all unneeded HTML tags. You will use what is called a stop list of the most common words such as of, the, a, an, etc., to take out such words. You should then build a “database” of the remaining words and keep information such as the URL of the file where the word occurs.

You will create a form for searching your Web site. Give it a heading such as Search the Auction House or something similar. You will link the submit button of the form to search the “database” you have created and present in a nice format the results of the search. The user should be able to go to the URL by clicking on the generated page. Allow for search by more than one word. Allow the user to use and and or with the keywords when searching.

19.  (Hard: Many interactive components, Long-term project)

A Sports Site

Assume there is a site called CollegeSports.com (or, HighSchoolSports.com; choose one) and you have been employed to develop Web presence for it. This site is going to have news and scores.

You can develop the pages on any machine of your choice, but ultimately, you must transfer the files to a Web server. The machine-specific details correspond to a Linux machine. Create the top page for the Web site by hand.

Next, we will enhance the Web site to make it dynamic in nature.

Our goal is to have a sports site that is viewed either as XML or HTML. Learn HTML or XML on your own if you do not know them. The sports site will be essentially all dynamic except, maybe, for the top page that will be designed to look nice and appealing. For the rest of the pages that are dynamic, functionality matters more than looks, although they should not be ugly. The sports site will carry information about schools or universities, teams a certain school or university has, statistics on individual players, and statistics on individual teams.

Some initial data may be provided by you in the form of text files. However, most data is expected to be entered by volunteers (or, if you make money, by “paid volunteers”) who register to enter data for specific schools.

Organizing the Files

In your public_html directory, make subdirectories html, xml, data and cgi_bin to store your files. Organize them neatly under each sub-directory. You can make additional subdirectories or sub-subdirectories if you find the need for it.

Data Files

We will keep all the data that are needed in text files. In a real application, we will use a database. There will be at least five data files. Let’s call them schools.txt, schoolTeams.txt,

teamStatistics.txt, player.txt and personnel.txt.

The file schools.txt, there is data about specific schools. These include data such as school name, a unique abbreviation or ID, a name for the teams, and any additional information you deem important. Keep the information in a clearly and consistently formatted manner. You should create the data file with data about one or two schools to start with. Later, a registered volunteer should be able to enter data from the Web. You can think of storing data for a school, one per line, or one per paragraph. Clearly separate the parts of an individual record using a pre-specified textual separator.

The file schoolTeams.txt is a text file that contains information about specific teams. The data for a team contains fields such as the unique abbreviation for the school, a unique abbreviation or ID for the sport, names of coach(es), etc. Again, create the file with some initial information. Allow that information will be entered by registered volunteers later from the Web.

File teamStatistics.txt includes fields such as the unique school abbreviation, the sports abbreviation, win-loss statistics for the season, and any other additional information you need. Enter some initial data when you create the file. Additional data will be entered from the Web or calculated automatically.

File players.txt includes fields such as the name of a player, his or her unique ID or abbreviation (unique within the team for a specific school), unique school abbreviation, unique sports abbreviation, his or her summary statistics for the season in some acceptable fashion. Create the file with some initial data. Allow data to be entered from the Web or to be automatically created later.

The personnel.txt file contains fields such as the name of an individual, an email addressed that is used as a login ID, a unique school abbreviation, a password, and any other pertinent information. There is no initial data in this file. All data is entered from the Web.

Programs to Generate HTML and XML files (non-CGI)

Write individual Perl functions that will scan the contents of each of the files individually (you may have to consult more than one file) and produce XML data files. The XML data files will have accompanying DTD files that are non-dynamic. You have to pre-write these DTD files. In addition, there are accompanying non-dynamic XSL files that transform the XML data files to HTML for the browsers. The XSL files are pre-written also.

Write a function called createpages.pl that calls all the functions for individual files and does anything else needed to create a whole new Web site (except for the top page) every time you run. Store the program-created XML data files in non-changing file names so that they can be linked easily from the top page.

There are many details to be considered in generating these pages. Make your own decisions regarding the complexity of the pages and do the best you can.

CGI programs

You will now write CGI programs so that data can be entered from the Web. First create a form such that an individual, volunteer or paid, can register to enter data for a specific school. This will populate the file personnel.txt from the Web.

Next, create a form to allow someone registered to enter data. There is an email address and a password that need to be entered. This is checked against the file personnel.txt. If the login is successful, allow the person to choose what type of data he/she wants to enter: basic school or team data, team statistics, player data, etc. Different types of data update different data files. Based on the choice, bring up appropriate forms. Each form is linked to a CGI program that performs appropriate checks and updates corresponding files.

Once again, all this is a lot of work, and make the best decisions you can.

A Search Engine for The Sports Site

You will now create a search engine for the sports-based Web site that you have created. You will perform searches over HTML and XML pages. You must have all your HTML pages in the directory called html under your public_html directory. You may have subdirectories in the html directory. If you have not placed all your HTML files in the html directory, please do so now. You will place all your XML files, similarly, in an directory called
xml under the public_html directory. Once again, you can create subdirectoriess if you want to.

You will make an analysis of all your HTML and XML pages including those in the sub-directories.

The following is the bare minimum idea. Search engines are much more sophisticated than this. When you analyze an HTML or XML file, keep track of all the words that occur in the title, in the meta tag with content attribute, at various heading levels, and in regular paragraph texts. You will have to strip all unneeded HTML tags. You will strip your XML tags although, in reality, the XML tags contain semantic information and should not be summarily dismissed. You will use what is called a stop list of the most common words such as of, the, a, an, etc., to take out such
words. You should then build a “database” of the remaining words and keep information such as the URL of the file where the word occurs. In our case, the “database” is just one or more text files.

You will create a form for searching your Web site. Give it a heading such as Search My Sports Site or something similar. You will link the submit button of the form to search the “database” you have created and present in a nice format the results of the search. The user should be able to go to the URL by clicking on the generated page. Allow for search by more than one word. Allow the user to use and and or with the keywords when searching.