RU beehive logo ITEC dept promo banner
ITEC 325
2014spring
ibarland

homelectshws
D2Lbreeze (snow day)

hw03
sanitized html
and automated source-listings

Due: 2014.Mar.07 (Fri) 23:59, on D2L dropbox hw03 (and, accessible online).

Scenario

You are working for Lizard Entertainment, makers of the popular adventure game, .World of Wowcraft (“.W.o.W.”). In .W.o.W., players choose a type of character: either warrior, mage, priest, or rogue. Over the course of the game, their characters can learn various skills, depending on type: For example, the diplomacy skill (which is learnable only by rogues and priests), or the acrobatics skill (which is learnable only by rogues and warriors), etc.. Each skill is be tied to one of six built-in character traits: Strength, Intelligence, Wisdom, Dexterity, Constitution, and Charisma. Finally, each skill has a minimum-level (between 30 and 100 inclusive).

Your boss decides that a key feature of the game is that people can add their own skills to the game. Your job is to build a web-page that lets people enter new skills for the game to use. People will enter the name of the skill, a detailed description, which character-types can use it, what trait it's tied to, and their own name (to get the glory). When they submit their form, they will see a response page summarizing the information they entered.

An example of filling out the form The result of the processing the form

Your Task

For this homework: Make a web-form at https://php.radford.edu/~yourUserName/itec325/hw03/skill-form.php which submits to skill-handle.php.

  1. When printing values taken from the form, sanitize the HTML. A user should be able to enter (say) a description which includes characters like < and ' and newlines, and the resulting summary should show the same string as whas was entered, up to whitespace. (However, do show linebreaks, in the skill-description.)

    Note that the checkboxes in skill-form.php should all have the same name attribute (and it should end in “[]”), so that you can retrieve it as an array in your form.

  2. Your file hw03/index.php should show all the files in your solution.

    The page does need to contain (near the top) your name, a link to your skill-form, a link to this homework-assignment, and a “table of contents” — a list of links to later in the page, with the detailed information for each file.

    TODO: Ian, show example.

    The source should be shown only if the current time is between 2014-Mar-07 23:59 and 2014-May-31 23:59; otherwise show a message along of the lines of “source code only available between 2014-Mar-07 23:59 and 2014-May-31 23:59.”

  3. Call the function show_file_info below, along with scandir, to show all the files in your directory.

  4. Required functions (w/ test cases, except as noted):
  5. I am providing a file utils.php (and its tests utils-test.php) which contains a function show_source_between, which takes in a filename, start-time and end-time, and it prints (not returns) the file's source if it's currently between the selected times, or else a message stating when the solutions were/will-be available. See show_source.

    No test cases required — this function prints, and does not return anything.

  6. I am providing a file utils.php (and its tests utils-test.php) which contains a function testAsHTML testUpToWhitespace, which compares an actual and expected output, ignoring most whitespace.

I will visit the URL https://php.radford.edu/~yourUserName/itec325/hw03/index.php to grade your work. If that URL is not accessible, you will get a 0 for that portion of the grading!


Other requirements

These apply to all homeworks for this class:

1the function to show-source a file is one of the few exceptions      

homelectshws
D2Lbreeze (snow day)


©2014, Ian Barland, Radford University
Last modified 2014.Mar.01 (Sat)
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Powered by PLT Scheme