Programming Exercise III:
A Dynamic Website Using CGI
(Industry-Level, Second-to-None Comprehensive Specifications)
Absolutely no copying others’ works
Though these exercises are related, you are NOT allowed to submit one exercise to cover two or more exercises.
Development Requirements
When start developing the exercise, follow the requirements below:
- The exercise has to be Internet-enabled (a trend of current IT systems).
- The system entry page must be located at “
http://undcemcs02.und.edu/~user.id/3/home.html
” and all pages must be hosted by “http://undcemcs02.und.edu/~user.id/
”.
- The systems have to be active even after being graded until the end of this semester.
They will be re-checked for plagiarism from time to time.
Due Date and Submission Methods
Due on or before Wednesday, November 08, 2023.
Send an email to the instructor at
wenchen@cs.und.edu to let him know the exercise is ready for grading.
Objective
There are four steps to achieve our goal, building an online bookstore:
- (VPN) Sign in to our server,
undcemcs02.und.edu
.
- (HTML & CSS) Build static webpages.
- (CGI) Connect the Internet to the server-side programs.
- (Python) Write programs to fulfill the users’ requests.
This exercise is the third step to achieve the goal by using CGI (common gateway interface) to create a dynamic website.
CGI is an interface which tells the webserver how to pass data to and from an application.
More specifically, it describes how request information is passed in environment variables (such as request type, remote IP address), how the request body is passed in via standard input, and how the response is passed out via standard output:
User (client) ⇔ WWW ⇔ CGI (webserver) ⇔ Programs (server) ⇔ Databases/files (server)
Programming Helps
The four programming exercises (32% of the final grade) have each student step-by-step build a simple, dynamic website, which may be the most useful and popular IT system. By doing the exercises, students will gain essential knowledge and experience of using computers because they require you to know how to use various fundamental computer tools (like Linux, HTML, and Python). The instructor will detail how to use them in classes. If you still could not get them to work, come to the instructor and he will help you to set it up in few minutes.
Requirements
This is the third part of a simple dynamic website construction using CGI as the page below:
|
|
|
It includes the following pages:
- Home page (
public_html/3/home.html
and public_html/cgi-bin/3/home.html
), which includes the following three buttons:
- Enter books, which uses the code to generate the input page,
- Show all books, which uses the code to show all books in text, and
- Delete all books, which uses the code to delete the file “
public_html/cgi-bin/3/books.txt
” .
- Input page (
public_html/cgi-bin/3/input.html
), which is displayed after clicking on the “Enter books” button in the home page.
It is for entering books including the following two buttons:
- Enter the book, which uses
- The code to add the book to the file
books.txt
and
- The code to generate the page after input (
public_html/cgi-bin/3/result.html
).
- Home, which uses the code to generate the home page.
- Page after input (
public_html/cgi-bin/3/result.html
), which is displayed after clicking on the “Enter the book” button in the input page (input.html
) or this page (result.html
).
It is for adding more books to the file books.txt
(by using the same input.py
as the input page):
- Output page, which is displayed after clicking on the “Show all books” button in the home page.
It is to show the saved books (the related code can be found from here).
An example is as follows:
- Delete page, which is displayed after clicking on the “Delete all books” button in the home page.
It is to show all the saved books are deleted (the related code can be found from here):
Recommended Steps
Take the following steps to build your Programming Exercise III:
- Connect to the NDUS servers by using VPN (virtual private network) like GlobalProtect.
- Connect to the server “
http://undcemcs02.und.edu/~user.id/
” by using SSH (Secure Shell) like PuTTY.
- Sign in to your account by using your UND credentials.
- Enter the following commands when you sign in to
undcemcs02
the first time:
cd
mkdir public_html
mkdir public_html/3
mkdir public_html/cgi-bin
mkdir public_html/cgi-bin/3
chcon -R -t httpd_user_content_t /home/first.lastname/public_html
chmod 755 ../*
chmod 755 *
- Your homepage of Programming Exercise III is located at
public_html/3/home.html
and the server-side scripts of your Programming Exercise III are located in the folder:
public_html/cgi-bin/3/
like
public_html/cgi-bin/3/home.html
public_html/cgi-bin/3/home.py
public_html/cgi-bin/3/input.html
public_html/cgi-bin/3/input.py
public_html/cgi-bin/3/result.html
public_html/cgi-bin/3/result.py
public_html/cgi-bin/3/books.txt
- Enter the following commands after you create a script:
cd
chmod 755 */*
chmod 755 */*/*
chmod 755 */*/*/*
chmod 755 */*/*/*/*
chmod 755 */*/*/*/*/*
- Start developing your Programming Exercise III.
- Use a browser to check your result at
http://undcemcs02.und.edu/~user.id/3/home.html
- 🍀 Good luck! 🍀
Evaluations
The following features will be considered when grading:
- Specifications:
- The instructor (or your assumed client) has given the exercise specifications as many details as he possibly can.
If you are confused about the specifications, you should ask in advance.
Study the specifications very carefully.
No excuses for misunderstanding or missing parts of the specifications after grading.
- The specifications are not possible to cover every detail.
You are free to implement the issues not mentioned in the specifications, but the implementations should make sense.
Implemented functions lacking of common sense may cause the instructor to grade your exercise mistakenly, and thus lower your grade.
- The exercise must meet the specifications.
However, exercises with functions exceeding the specifications will not receive extra credits.
- Grading:
- This exercise will not be graded if the submission methods are not met.
Students take full responsibility if the website/system is not working.
- Before submitting the exercise, test it comprehensively.
Absolutely no extra points will be given after grading.
- The total weight of all four exercises is 32% (08% each) of the final grade.
- The systems have to be active until the end of this semester.
They will be re-checked for plagiarism from time to time.
- The instructor will inform you the exercise evaluations by emails after grading.
- Comments:
- Make the exercise work first.
Do not include extra features, such as fancy interfaces, in the beginning.
By the way, you will not receive credits for the extra features.
- Time management is critical for software development.
If you are not able to complete the exercise, display whatever you have accomplished, so the instructor can give partial credit to your exercise.