|
home—lects—exams—hws
D2L—breeze (snow day)
Due: 2012.Apr.20 (Fri)21 (Sat) 23:59
(Due Sat. night to give you an extra day,
yet still reserve a weekend-day to meet and work w/ your group on Sunday).
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. 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 a .sql file containing
all the
You do not need to include SQL check-constraints
enforcing data validation.
Note that MySQLAdmin tool includes a buton for exporting your database declarations
to a .sql file.
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 php.radford.edu/~yourUserId/hw05/index.php 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() } |
home—lects—exams—hws
D2L—breeze (snow day)
©2012, Ian Barland, Radford University Last modified 2012.Apr.18 (Wed) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |