COP3832, Assignment 4
Due 3/14 at the start of class.
You may NOT use CGI.pm for this assignment.
Upload the following files and hand in printouts of each:
-
access.conf
-
language.cgi
-
image.cgi
-
validate.cgi
Create a subdirectory of hw that is named content. Be sure
that access is restricted to hw as it was in assignment 3.
Create four files in the content directory
-
lang.html.en
-
lang.html.es
-
lang.html.de
-
lang.html.fr
-
Enable and turn on language negotiation in the content directory.
Modify access.conf to do this.
-
Each page should represent a page in a different language. You do not need
to get fancy, just place the appropriate language name in each file: English,
Spanish, German, French. Of course, feel free to add actual language content
to each page.
-
Each page will also have a link to an image that will be explained below.
To state it simply: whatever browser is used to reference the page, the image
will indicate that this page is better viewed using a different browser.
Create a script that will have the same effect as language negotiation. However,
the script takes care of all the details, it will not use the server's language
negotiation abilities. Name the script language.cgi
.
-
The name of the page to be displayed will be in the query string. Nothing
else except the name of the page will be in the query string. The final extension
of en, es,de, or fr should not be included here.
-
Extract the first langauge from the HTTP_ACCEPT_LANGUAGE environment variable.
-
Append the first language as an extension to the page name from the query
string.
-
Use a relocation header to have the new page displayed. Be sure that the
new page cannot be cached.
-
Place the script in your server's cgi-gin directory.
Create a script that will display one of the following images depending on
the browser that is used to reference the page. Name the script
image.cgi
.
-
For non MSIE browsers use
/home/scsfac/downeyt/public_html/images/bnrIE.gif
-
For all MSIE browsers use
/home/scsfac/downeyt/public_html/images/nnc_lockup.gif
-
For each of the language pages that you created above, include a statement
like
This page is best viewed using
and then include an image tag that calls this script.
-
You can detect the type of browser by searching for the string
MSIE
in the HTTP_USER_AGENT
environment
variable.
-
Place the script in your server's cgi-bin directory.
Create a script that contains a form and validates that all the fields have
been filled in. Do not use JavaScript to validate, use server side scripting
with Perl. name the script validate.cgi
.
-
If the script is called for the first time, then just display the form.
-
If the script is submitted with valid information, then print a nice thankyou
page.
-
If one of the fields is not filled in, then redisplay the form. The user's
previous valid choices should still be present. Create a list of error messages
indicating which fields need to be filled in.
-
The form must contain the following
-
A text field.
-
A list of radio buttons. At least 3 buttons. None should be pre-checked.
-
A multiple selection list. At least 4 options. None should be pre-selected.
-
A submit button
-
You may NOT use CGI.pm for this assignment.
-
Refer to my page Making Froms Sticky.
Create a file named hw4.html in your hw directory on your server.
-
Create a hypertext link to lang.html in the content directory.
Please note that there is no such file in content. Since language
negotitation is turned on in content, then one of the four pages should
be displayed.
-
Create a hypertext link to the language negotiation script for the page
lang.html. When clicked, the appropriate page should be displayed.
-
Create a hypertext link to the validation script.