CMSC 210
Spring 2017
Exercise
03/17/2017
First Server Scripts Lab
Due: end of class 

Assignment:  (worth 3 points)

Get server scripts working.


0)
 Get the cgi-bin directory set up.   Instructions:
  • Connect to the server via putty or ssh to connect to  cs.longwood.edu
  • Change to the web directory by typing: 
    • cd public_html
  • Create the directory cgi-bin by typing.
    • mkdir cgi-bin
  • Change the protections on the directory by typing:
    • chmod uo+x cgi-bin
  • NOTE: Much of the above can also be done via WinSCP, but I am not giving those instructions here.

1)  Test a pre-written script that is already on the server.
  • Get the file by typing:
    • cp ~scottmce/public_html/cgi-bin/FirstTest.py   cgi-bin
  • Download the html file by right-clicking on the link below
  • In the html code, change the action attribute to have YOUR userid, rather than mine.
  • Load the FirstScriptTester file in a browser.   Test out the form and see if it behaves as expected.  IF NOT, ASK FOR HELP.  Be sure to try typing in different things.
  • What does it do if the field is left blank?
SHOW DR MAC BEFORE YOU MOVE ON!



2)  Test another pre-written script that is already on the server.
  • Get the file by typing:
    • cp ~scottmce/public_html/cgi-bin/SecondTest.php  cgi-bin
  • Download the html file by right-clicking on the link below.
  • In the SecondScriptTester, change the action attribute to have YOUR userid, rather than mine.
  • Load the SecondScriptTester file in a browser.   Test out the form and see if it behaves as expected.  IF NOT, ASK FOR HELP.

3)  Modify the script.
  • In the SecondTest.php file, 
    • Change it to say "you are mature"  rather than "you are old".
  • Load the SecondScriptTester file in a browser.   Test out the form and see if it behaves as expected.  IF NOT, ASK FOR HELP.
SHOW DR MAC !



4 )   Now, modify the script to say "please enter your age" if the age field is left blank.     Modify the PHP rather than Javascript.

Handin:

Showing Dr Mac your work will get you credit for this exercise.