October 2 - ndgriffeth/Class-Notes-and-Lectures GitHub Wiki

For tonight

Each project group, please email

  • names of group members
  • project title
  • 1-sentence project description

Homework Comments

Client-server systems

Client-Server Introduction, from About.com, by Bradley Mitchell: You should know all of this.

Web Servers, from Wikipedia: Sections 1-4. Section 7 on market share is interesting but optional.

Web Clients, from Wikipedia: Sections 1 and 3. You need to know this!

More advanced: Client-Server Architecture: Optional reading.

Determining how to process a page.

See Section 3, "Functions," in the Wikipedia article on Web clients, mentioned above. This explains how a Web browser deals with a page.

For Web servers processing a page, see this.

Using tags

For defining a form.
A form is used to collect data from a user and send it to a server. The Browser needs to know exactly what input data is being collected by the form and what php file should process it. The basic scheme for defining a form is:

<form action="..." method="post">
<input type="..." name="...">
...
<input type="..." name="...">
<input type="submit">
</form>

All of the information needs to be between the beginning and the ending form tags.

For defining a Web page with a php script.
Every statement that appears in PHP code, i.e., between "", must be a PHP statement. PHP doesn't recognize HTML.

HTML can be included outside the php start and end tags, or you can put statements like

  echo "<h1>Header</h1>" 

in a PHP block to generate html code.

Variable types

Debugging

Assignment for Monday October 7

For this assignment, you will need to create two html pages, each containing a form that invokes a php file on the server (which you will also write).

The first html page should collect user input data (using a form) and send it to a php script that appends the data to a file in the directory ABOVE the document root.

The second html page should contain a form asking for a user name and password (which you will not check, just yet), and invoke a php script that displays the contents of the file. For reading the file, you must use only the fgets() function. You are not allowed to use the functions that read and write the entire file (in other words, you must write a loop for this assignment).

The assignment is due on midnight Monday. Each late day will count 10 points off. If you send me your assignment early, I will check it and give you a chance to correct any errors.

Challenge Problems:

  • Create a username/password file and use it to check the usernames and passwords in the assignment above.

  • Create a comma-separated values file using Excel and save it. Then create an html page than invokes a php script to display the Excel file. You could also have the html page check authenticate users (check username and password) and/or accept the name of the comma-separated file to read.

Review questions

  1. What is a client/server system?

  2. Give three examples of client/server systems.

  3. What are three typical differences between a client and a server? Which of these differences always apply, and which do not?

  4. Define each of the following:
    a. Web browser.
    b. Web server.
    c. Uniform resource locator.

⚠️ **GitHub.com Fallback** ⚠️