Assignment #3

Assignment 3

The objective of this exercise is to learn to use some of the basic features of Cold Fusion and obtain some experience developing database driven Web applications. This will likely turn out to be a very time-consuming exercise for those of you who have little technical (web & database) experience. I suggest that you begin working on it at least three weeks before the due date. Expect to spend a good deal of time on it.

In the first portion of this exercise, you will learn to use environmental variables that are always available when a browser & a server communicate. Each time a browser makes a request to a server, a set of environment variables are created, some by the Web server and some by the browser.

In ColdFusion, these variables are referred to as CGI environment variables and they use the "CGI" prefix. The environment variables contain a range of data about the transaction between the browser and the server, such as the IP Address, browser type, and authenticated username. You can reference CGI environment variables for a given page request anywhere in the page. All CGI variables are read-only.

Note: The environment variables available to an application, depends on the browser and server software in use for a given request. AT the bottom of this page you will find lists of the cold fusion variables that enable you to get at these environmental variables.

  1. Your first task is to develop a cold fusion page (cfm) that will, when accessed by a user, list, each on a separate line, the following:
    • the browser she is using,
    • the page that brought her there,
    • the server name,
    • the IP address of the remote host making the request (the user's IP address), and
    • The server port.

For the remainder of the assignment, we will use the same School Information System database that is used in the Cold Fusion example that you can view from the February 24th section of the Schedule page.

Your first task is to download the example (School.exe) the database and all the cold fusion templates that are used to do all that the example does. Before beginning the actual download, I suggest that you create a special directory for this purpose; call it CFschool. Then, save the downloaded file in the CFschool directory. Having done that, double click on the file School.exe in that directory and unzip all the files in the CFschool directory -- by using the browse button in the Unzip window that is generated when you double click on the School.exe file. This will produce 15 additional files in the CFschool directory. The sitemap.gif file shows a sitemap of how the example works and the school.mdb file is the access database that is used in the example. (DOWNLOAD the example) Note: All the html files that you download, except for the file Main.html, actually should have the cfm extension instead of the html extension. I set them up with the html extension so that it is easy to view the source code with any html editor that allows you to do that (e.g., Derekware). The sitemap shows the real names of the files.

You will extend the example. Make sure you really understand the Student Information System example, by looking through the files you downloaded and running the example (also accessible from the schedule page) before you begin work on this portion of the assignment.  Your tasks are to:

  1. Develop a student information retrieval page, by modifying query2.cfm, to list the selected student's personal information and all classes he/she takes. The class information should include the course title, meeting time, room, and instructor name. You may refer to the conceptual schema of the school database. As '#' is a reserved tag in Cold Fusion, you need to use two '#" to get one '#' in your SQL query. To avoid SQL errors, you should download the database to your PC so that you could test your SQL query statements before using it in Cold Fusion templates.
     
  2. Produce a teaching schedule report for all instructors. The report should show the information for each instructor and list all classes taught by the instructor. The class information should include course #, title, room, and time and the number of students registered in that class. Again, you should try to test your SQL query in an MS Access database before using it in your Cold Fusion template. It could save you many hours of frustration.
     
  3. Create an assigment 3 webpage that has links to webpages that do what each of the three tasks (above) ask for. This page and the pages that do what the assignment requires must reside on the CIS lab server (cislab1.cbpa.louisville.edu).

The experience you gain from this exercise will help you obtain a better understanding of what it takes to develop this type of application.


CGI server variables

The following table describes the most common CGI environment variables created on the server (not all of these will be available with every server):

Variable

Description

SERVER_SOFTWARE

The name and version of the information server software answering the request (and running the gateway). Format: name/version.

SERVER_NAME

The server's hostname, DNS alias, or IP address as it appears in self-referencing URLs.

GATEWAY_INTERFACE

The revision of the CGI specification to which this server complies. Format: CGI/revision.

SERVER_PROTOCOL

The name and revision of the information protocol this request came in with. Format: protocol/revision.

SERVER_PORT

The port number to which the request was sent.

REQUEST_METHOD

The method with which the request was made. For HTTP, this is Get, Head, Post, and so on.

PATH_INFO

The extra path information, as given by the client. Scripts can be accessed by their virtual pathname, followed by extra information at the end of this path. The extra information is sent as PATH_INFO.

PATH_TRANSLATED

The server provides a translated version of PATH_INFO, which takes the path and does any virtual-to-physical mapping to it.

SCRIPT_NAME

A virtual path to the script being executed; used for self-referencing URLs.

QUERY_STRING

The query information that follows the ? in the URL that referenced this script.

REMOTE_HOST

The hostname making the request. If the server does not have this information, it sets REMOTE_ADDR and does not set REMOTE_HOST.

REMOTE_ADDR

The IP address of the remote host making the request.

AUTH_TYPE

If the server supports user authentication, and the script is protected, this is the protocol-specific authentication method used to validate the user.

REMOTE_USER
AUTH_USER

If the server supports user authentication, and the script is protected, this is the username they have authenticated as. (Also available as AUTH_USER.)

REMOTE_IDENT

If the HTTP server supports RFC 931 identification, this variable is set to the remote username retrieved from the server. Use this variable for logging only.

CONTENT_TYPE

For queries that have attached information, such as HTTP POST and PUT, this is the content type of the data.

CONTENT_LENGTH

The length of the content as given by the client.

CGI client variables

The following chart describes the most common CGI environment variables created by the browser and passed in the request header:

Variable

Description

HTTP_REFERER

The referring document. This is the document that linked to or submitted form data.

HTTP_USER_AGENT

The browser the client is currently using to send the request. Format: software/version library/version.

© 1999 Brian L. Dos Santos