COP3832, Assignment 5
Due 4/3 at the start of class.
You may NOT use CGI.pm for this assignment.
Upload the following files and hand in printouts of each:
-
language.cgi
-
validate.cgi
Create a new directory on your site named hw5. Add a
.3832access file to the directory. Create it with the usual contents.
Create eight files in the hw5 directory of your server
-
lang.html.en
-
lang.html.es
-
lang.html.de
-
lang.html.fr
-
index.html.en
-
index.html.es
-
index.html.de
-
index.html.fr
Allow language negotiation
-
Enable and turn on language negotiation in the hw5 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.
-
Be sure that each page is not placed into the cache.
-
Each page should use the same style sheet. Include a <LINK> tag in
the <HEAD> section of each page that points to your stye sheet.
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
.
-
Add an alias named /my-cgi-bin to your site. Have the alias point
to the cgi-bin subdirectory of server.
-
Place the script in your server's cgi-gin directory.
-
Place the name of the page to be displayed will be in the query string
when you call the script. 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.
You may need to modify the languages that your browser accepts in order to
match the languages that your script handles.
-
Append the first language as an extension to the page name from the query
string.
-
Open the file, read its contents and send them to the browser.
Create a script that contains a form and validates the fields as described
below. 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.
-
Each page that your script displays should use the style sheet for your site.
-
If the script is submitted with valid information, then print a nice thank
you page. Display the user's first name in the page.
-
If one of the fields is invalid, then redisplay the form. The user's previous
valid choices should still be present. Create an ordered list of error messages
indicating which fields need to be fixed.
-
The page will display a form containing the following elements. Add content
that explains what your page is about and identifies each element. Use a
table so that the entire form will fit on one page.
-
A submit button. Set the text on the button to something other than the default
value.
-
A reset button. Set the text on the button to something other than the default
value.
-
A text box.
-
A textarea.
-
A radio button with at least four options. Do not have any options checked
when the page loads.
-
A checkbox with at least four options. Each of the checkboxes must have the
same name, but different values. Do not have any options checked when the
page loads.
-
A drop down list with at least five options. The first option should be blank.
Do not have any options selected when the page loads.
-
A multiple selection list of at least five options. The first option should
be blank. Two options should be visible in the scrollable area. Do not have
any options selected when the page loads.
-
Add content to the page and organize it so that it is nice to view. Use a
table.
-
Perform the following validations on the form elements. Set the method for
the form to GET.
-
The text box must have at least two words. Words are separated by spaces.
-
The textarea must not contain the word 'foobar' in any possible case
(FooBar, FOObar, fooBAR, etc). The word foobarn would be valid, as
would igfoobar. However, things like !foobar! and
:foobar. are not allowed. You also need to be sure that foobar
isn't at the start or end of a line.
-
The page will not accept the person's first choice for the radio button,
even if the user changes the choice, and then selects their first choice
again. Please note that this is the user's first choice, not the first choice
on the page. Whichever radio button the user selects first, the form will
not be valid if the user submits the page with that choice selected.
-
At least two of the checkboxes must be selected.
-
The page will not accept the first option in the drop down list.
-
At least two of the choices in the multiple selection list must be selected.
Also, the choice(s) cannot contain the first option in the list.
-
You may NOT use CGI.pm for this assignment.
-
Refer to my page Making Froms Sticky.
Create a file named hw5.html in your hw5 directory on
your server.
-
Create a hypertext link to lang.html in the hw5 directory.
Create a hypertext link to index.html in the hw5 directory.
Please note that there is no such file in hw5. Since language negotitation
is turned on in hw5, then one of the four pages should be displayed.
-
Create a hypertext links to the language negotiation script for the page
lang.html and for the page index.html. When clicked, the
appropriate page should be displayed.
-
Create a hypertext link to the validation script.