COP3832, Assignment 3
Due 11/7 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. Create a file
in the hw directory with the name
.3832access containing the following. You may also add your current
ipaddress to the allow from list. However, each time you finish working
on your file, be sure to have only my two ipaddresses on the line.
You can find out your current ipaddress by running my
ipaddress script. Your ipaddress
will change each time you log onto the web. Set the permissions for .3832access
to 600.
<limit GET POST>
order deny,allow
deny from all
allow from 131.94.129.42 131.94.125.142
</limit>
Create eight files in the content directory
-
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 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. 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.
-
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 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.
-
If the script is submitted with valid information, then print a nice thankyou
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
-
A submit button. Change the text that appears on the button.
-
A reset button. Change the text that appears on the button.
-
A text box that will contain a person's full name.
-
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. You may assume that all words are separated by one space.
-
The page will not accept the person's first choice for the radio button.
Whichever radio button the user selects first, the form will not be valid
until the user selects a different button.
-
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 cannot be 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 hw4.html in your hw directory on your server.
-
Create a hypertext link to lang.html in the content directory.
Create a hypertext link to index.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 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.