Assignment 7
  Due Tuesday 12/8 at the start of the exam
  This assignment is optional. If you do it, it will replace one of the first
  5 assignments (not assignment 6).
You may use the parse-lib.pl file which contains functions named
get_query and get_cookie. To access these, include the following
statements in your scripts
require '/home/scsfac/downeyt/scripts/parse-lib.pl';
%query = &get_query;
%cookie = &get_cookie;
After these commands. %query will be the associative array of name/value
pairs of any parameters sent to your script. This function only works for
the GET and POST methods. Also, %cookie will contain all cookies for the
script.
You are to create an HTML document in the root of your server named
scripts2.html. On this page you will have links to two scripts:
random2.pl and confirm2.pl
  - 
    random.pl, this is like the previous assignment, but use cookies instead
    of hidden fields to maintain the counts of how many times the pages have
    been displayed.
    
      - 
	Use the GET method.
      
 - 
	The script will look at the time of day, and check the seconds.
      
 - 
	The script will display three completely different pages, depending on wether
	the seconds have a remainder of 0, 1, or 2 when divided by 3.
      
 - 
	Each page should contain a different title, pithy phrase, alignment, background
	color and text color.
      
 - 
	Each page should have a submit button that calls the script again.
	This will allow the user to redisplay the page, probably with a different
	page (but not always a different page).
      
 - 
	Each page should also contain a count of how many times each of the different
	pages has been displayed. Display the three totals in a table. Label each
	total so it is easy to tell which page each total refers to.
      
 - 
	Notes
	
	  - 
	    Use this command to get the current seconds: 
/usr/bin/date +%S
	   - 
	    Use the chomp command to remove the final carriage return from the
	    seconds: 
chomp($seconds)
	   - 
	    Use the % operator to get the remainder when dividing by three: 
$page
	    = $seconds % 3
	    $page will now have the value of 0, 1, or 2.
	   - 
	    Use the ++ operator to add 1 to a total: 
$one++
	   - 
	    Use cookies to keep track of how many times each page has been loaded. Have
	    the cookies expire after 1 minute. Reset the expiration time everytime the
	    page is re-submitted.
	
 
     
   - 
  
 - 
    confirm.pl, this is similar to the previous assignment, but less
    complicated.
    
      - 
	Use the POST method
      
 - 
	When this script is called with no parameters, then display a form that has
	a text field for the user's name, a text field for the user's phone number.
	Have a submit button labeled Submit.
      
 - 
	Create a table so that all the form elements are aligned nicely.
      
 - 
	Make all the fields required. When the form is submitted with parameters,
	the script must check that the all the fields have been filled in.
      
 - 
	If any of the fields is empty, then display an error message using JavaScript.
	Be specific about which field is missing. If more than 1 field is missing,
	include both in the same message.
      
 - 
	Also, validate each non-empty field.
	
	  - 
	    The Name field should only contain letters, commas, periods, spaces and hyphens.
	    If not, then display an error message using JavaScript. 
	  
 - 
	    The Phone field should be in the format 999-999-9999 or 9999999999. If it
	    is not in the format, then display an error message in JavaScript. 
	
 
       - 
	If all of the required fields are filled in and validated, then redisplay
	the page with all the user's data in text format only (not in form elements).
	You do not have to do anything with the data, just display it.
      
 - 
	Notes
	
	  - 
	    You can also use 
scalar %query to determine if the query associative
	    array has any elements. however, this time, scalar returns true if it has
	    elements and false if it doesn't.