Extra Credit Assignment for CSCI 431

The grade for this assignment can be used to replace your lowest existing assignment grade.

Background

Remember that joe is the PHP enabled web server at UNCA. You can store PHP pages within your public_html directory on the UNCA CSCI workstations, but in order to have them executed as PHP scripts you must use the URL http://joe.cs.unca.edu/~YOURID/YOURFILE.php rather than the usual http://www.cs.unca.edu/~YOURID/YOURFILE.php.

By the way, there is absolutely no reason for you to log into joe. If you do so, you'll just slow the PHP server down. Log into your usual favorate CSCI workstation and edit your file there.

Making dynamic Web pages with PHP

Your task is to create a (pig) Latin translation web page. People will connect to your page containing a form that will allow a sentence to be typed -- perhaps something like the following:


Enter your sentence below:


Your PHP program will "translate" this form in two steps. First, it will have an associative array that translates a few English words into Latin. (By the way, it isn't necessary to do a real translation. Just think of a few useful and fun translations, such as "i" → "ego" or "hamburger" → "porcusburgus".) Your PHP code must store these words in an associative array indexed by the English word,

Second, if your program does not find an English word in its associative array, it must use the Pig Latin translation. For the purpose of this assignment, you can make the Pig Latin translation, just by moving all the constanants at the beginning of the word to the end and then by adding the letters "ay". More sophisticated rules for Pig Latin translations can be found on several web sits, such as Bill Donnelly's English to Pig Latin JavaScript.

After the translation is done, your PHP script should display both the original and transcribed text, in a page similar to:


You entered the phrase:
i need to put something clever here
which have been translated to:
ego eednay otay utpay omethingsay captiosus erehay

In the above translation, we assume that "i" was directory mapped to "ego", and "clever" was mapped to "captiosus".