|
home—lects—exams—hws
D2L—breeze (snow day)
Due: 2013.May.03 (Fri) 23:59
You will add to your hw06 by storing .W.o.W. skills in a database, and retreiving a summary list of all skills. For extra-credit, you can add additional basic functionality.
As in previous homeworks, your page at https://php.radford.edu/~yourUserId/itec325/hw07/index.php should have a link to your skill-entry form near the top, and include a list all your files (with links), and should also display their source (between May.04 through May.30). See hw04-soln/ for an example.
(30%)
Modify the ol' skill entry form so once the information
is validated,
the skill gets added to the database.
So that I can grade,
include a line at the bottom of the page which is the SQL
(Of course, I'll also grade by checking your all-skills page, but in case you don't
complete that, I need something to grade.)
Note: You don't need to add the classes-available-to, to get full credit. Instead, adding this feature is 25% extra-credit. In that case, the classes-available-to should also be included when giving the detailed skill-information.
Be sure all your pages/programs always close any database connection they open!
Here is a hw07-setup.sql file which you can use (either in MyPHP or Oracle SQL), to create the tables you'll need. (It's fine to adjust (or even ignore) this file, if you want something different.)
As discussed in lecture,
be sure to guard against SQL injection
by calling
Note that I'll test the hw by entering skill-names which include spaces and apostrophes, and skill-descriptions which contain apostrophes and semicolons, to check that HTML/javascript and SQL injection attacks are being guarded against.
(40%) Make a page which shows a summary list of all skills previously entered: just the skill name, the associated ability (“Wisdom” etc.), and the minimum-level. This page should also include a link to the skill-entry-form page.
Be sure to have a prominent link to this page near the start of your php.radford.edu/~yourUserId/hw07/index.php. (This can replace, or simply be next to, the link to the skill-entry-form.)
Be sure all your pages/programs always close any database connection they open!
(30%) Each skill-name on the summary list should be a link which, when clicked, brings you to a detailed-information page that includes the previous information plus the full description and who submitted the skill.
(The layout of this information does not need to be anything elegant, but it should not be prone to HTML/script injection.)
Note that
this is asking for a link which behaves a little bit
like a form-handler, since
you won't have a separate URL for every single course —
instead you'll have one page which (given a particular skill-name) pulls
the detailed information out of the database.
How do you have a link which provides an argument (skill-name) to another page?
One easy way1
is to have the link contain the parameter(s) explicitly,
e.g. “
As always, to guard against HTML/script injection,
be sure to call
I'll say it again, just because it's fun: Be sure all your pages/programs always close any database connection they open!
Extra credit (15%; more involved): Handle the situation where a second person wants to edit an existing skill's info even while somebody else is in the process of editing it. You can either use a pessimistic approach (don't let the second person start), or an optimistic approach (when somebody submits, make sure that the database still has the same info as when they started — at least for any fields which they modified).
The former case is easier, but you have to worry about the first user timing out. You can use database locks to help you with this (but you don't have to).
Transmitting the arguments through
home—lects—exams—hws
D2L—breeze (snow day)
©2012, Ian Barland, Radford University Last modified 2013.May.02 (Thu) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |