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

homelectsexamshws
D2Lbreeze (snow day)

hw04
sanitized html
and automated source-listings

Due: 2013.Mar.04 (Mon) 23:59, on D2L dropbox hw04 (and, 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, you will take your hw03 solution (copied to a directory hw04), and modify it as follows:

  1. Modify the form so that it resembles the screenshots above. In particular:
  2. Have your form actually submit to skill-handle.php, and generate a response similar to the one pictured above.

    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

    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.

  3. Put your css into a separate file.
  4. Your file hw04/index.php should call show all the files in your solution, as in the hw03-soln/.

    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.

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

    Use the function show_file_info below, along with scandir and your function hyperlink. For full credit, use array_map at least once, where appropriate.

  5. Required functions (w/ test cases, except as noted):

As usual, I will visit the URL https://php.radford.edu/~yourUserName/itec325/hw04/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:

1It's a bit dangerous to normalize all quotes to a single type, since it means your test cases won't catch mis-matched quote-types.      

2In regular expressions including unicode “u” (which is that the trailing //u means), the escape sequence “\p{Z}” means “any whitespace, including odd unicode characters like nonbreaking-space, thin-space, vertical-tab, etc.”. See details.      

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

homelectsexamshws
D2Lbreeze (snow day)


©2012, Ian Barland, Radford University
Last modified 2013.Mar.26 (Tue)
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Powered by PLT Scheme