|
home—lects—exams—hws
breeze (snow day)
Due: 2011.Nov.16 (Wed) 23:59
You will add to your hw04 by storing .W.o.W. skills in a database, retrieving information for one given skill, and retreiving a summary list of all skills. You will also add login sessions.
(10%) Have a user login page authenticate the user/password against a database. [Clarification Nov.12:] Have the user's login time out after some amount of inactivity (10min, or perhaps 30sec, for testing).
(You'll presumably add authorized users to the database manually — not through web forms.) For grading purposes, mention a user/password that I can use, next to the entry forms.
(30%)
Modify the ol' skill entry form so once the information
is validated,
the skill gets added to the database.
(You may over-write any previously existing information for that skill,
or see extra-credit below.)
Include all the
You do not need to include SQL check-constraints
enforcing data validation.
As discussed in lecture,
be sure to guard against SQL injection
by calling
(30%) Make a page which shows a summary list of all skills previously entered: just the skill name, and which classes its available to. The landing page should be this and/or your login page.
(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 full description, min-level requirement, and who submitted the skill.
Note that
this is asking for a link which behaves like a form, 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
As before,
have a file sources.php (in the same directory)
which simply
Your forms do not need to otherwise contain a
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
(A general warning, not pertinent to this homework:)
However, when
/* Call 'onSubmit' manually [which runs any code stored in * the form's attribute, but doesn't actually submit.] * If that code returns true, then *we* trigger the submit. */ if (document.getElementById('theFormsId').onSubmit()) { /* We just called onSubmit(); we reach here iff that function returned true. */ document.getElementById('theFormsId').submit() } |
2 Note that if, for previous homeworks, you took the time to loop over all files in the directory, you're reaping dividends from that investment now. ↩
home—lects—exams—hws
breeze (snow day)
©2011, Ian Barland, Radford University Last modified 2011.Nov.12 (Sat) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |