Question: CS 3030 Scripting Languages Lab 9: CGI Introduction Lab 9 is a simple example of CGI. Your CGI Perl script will be called from a

CS 3030 Scripting Languages Lab 9: CGI Introduction Lab 9 is a simple example of CGI. Your CGI Perl script will be called from a HTML file that will be provided to you. The HTML page will present the user with a form field, the contents of which will be passed to the CGI script as one or two parameters. Your CGI script will examine the parameters, ensure the parameters are correct and safe ("scrubbed") cal.cgi will then call /usr/bin/cal -h PARAMETERS" with those scrubbed parameters and display its output. You should see the parameters in a HI header and the output from cal as preformatted text. Perl will be run in "taint" mode by using the "-T" parameter on the # ! /usr/bin/perl line. In "taint" mode, Perl will not permit a value received from outside of the script to be simply passed as parameters to a program being called. This is a security feature. We will satisfy Perl's "taint" mode by extracting the parameters using regular expressions, which removes the "taint" from the parameters. Requirements For this assignment, you will place your lab files in your very own web documents folder, located on icarus at~/public html. Your PERL CGI script shall be named~/public_html/cal.cgi and be marked executable and readable by group and world (Chmod 755). Your CGI script will be called by an HTML file, cal.html, Templates for both files are located in /var/classes/cs3030/lab9/templates You will copy cal.html as-is to~/public_html and Chmod it 755, You will add code to cal.cgi that verifies that the parameters are valid, and then the template will call /bin/cal -h PARAMETERS where PARAMETERS are the "scrubbed" and verified parameters passed in by the user You will test your work by accessing your web page using a web browser: http://icarus.cs.weber.edu/~USERNAME/cal.html, where USERNAME is your icarus usemame Specific Requirements Your cal.cgi script should accept a parameter passed in by cal.html that may be of three forms ONLY . YYYY: A single 1-4 digit number from 1-9999: cal will print all twelve months of that year MM YYYY: a 1-2 digit month from 1-12 flowed by a 1-4 digit year from 1-9999 Mon YYYY: a 3 or more case-insensitive character prefix of a valid month January-December followed by a 1-4 digit year from 1-9999 Extract ONLY valid parameters and set the Sdate variable equal to the parameters. If the parameters are invalid set Sdate to (empty string). If the parameters are blank, set $date to a single space"". Cal should always produce output. The job of your CGI is to guarantee that the parameters are one of the three forms listed above CS 3030 Scripting Languages Lab 9: CGI Introduction Lab 9 is a simple example of CGI. Your CGI Perl script will be called from a HTML file that will be provided to you. The HTML page will present the user with a form field, the contents of which will be passed to the CGI script as one or two parameters. Your CGI script will examine the parameters, ensure the parameters are correct and safe ("scrubbed") cal.cgi will then call /usr/bin/cal -h PARAMETERS" with those scrubbed parameters and display its output. You should see the parameters in a HI header and the output from cal as preformatted text. Perl will be run in "taint" mode by using the "-T" parameter on the # ! /usr/bin/perl line. In "taint" mode, Perl will not permit a value received from outside of the script to be simply passed as parameters to a program being called. This is a security feature. We will satisfy Perl's "taint" mode by extracting the parameters using regular expressions, which removes the "taint" from the parameters. Requirements For this assignment, you will place your lab files in your very own web documents folder, located on icarus at~/public html. Your PERL CGI script shall be named~/public_html/cal.cgi and be marked executable and readable by group and world (Chmod 755). Your CGI script will be called by an HTML file, cal.html, Templates for both files are located in /var/classes/cs3030/lab9/templates You will copy cal.html as-is to~/public_html and Chmod it 755, You will add code to cal.cgi that verifies that the parameters are valid, and then the template will call /bin/cal -h PARAMETERS where PARAMETERS are the "scrubbed" and verified parameters passed in by the user You will test your work by accessing your web page using a web browser: http://icarus.cs.weber.edu/~USERNAME/cal.html, where USERNAME is your icarus usemame Specific Requirements Your cal.cgi script should accept a parameter passed in by cal.html that may be of three forms ONLY . YYYY: A single 1-4 digit number from 1-9999: cal will print all twelve months of that year MM YYYY: a 1-2 digit month from 1-12 flowed by a 1-4 digit year from 1-9999 Mon YYYY: a 3 or more case-insensitive character prefix of a valid month January-December followed by a 1-4 digit year from 1-9999 Extract ONLY valid parameters and set the Sdate variable equal to the parameters. If the parameters are invalid set Sdate to (empty string). If the parameters are blank, set $date to a single space"". Cal should always produce output. The job of your CGI is to guarantee that the parameters are one of the three forms listed above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
