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

homelectsexamshws
breeze (snow day)

hw02
Scaling up

Due: 2011.Mar.18 (Fri)19 (Sat)1 23:59 (but note that the project proposal will be due that same weekend, so start well in advance)

You will continue building a course catalog system from hw01—Input validation. This time you will submit your files on WebCT as well as having

  1. (5%) Make a (stub-page for a) master list of all known courses. (In the future, as you fill out the form, you'll be adding to the list of courses (stored in a database); for now just hard-code info for a couple of courses.)
  2. (15%) Include a standard header (including a picture or logo), navigation links, and a standard footer in all displayed pages, for a standard look-and-feel across your application.
    Your include files may contain unmatched tags.
  3. (40%) Make your course-entry form sticky: if the submitted form doesn't validate on the server side, the user is presented with the page containing all the info already filled (without needing to use their browser's “back” button).

    If the form has no errors, then it will display the results similarly to hw01. (My solution has four php files just for the form: one for (generating) the javascript validation functions; one for generating the form itself; and one for the successful result page; one master file to rule them all.)

  4. (10%) Have only one line of source-code defining the maxlength for the last name; that one value (whether in an array, as a contant, or as a global variable) should be used (a) as the maxlength attribute in the input tag, as well as (b) in the php input-validation checking.
  5. (10%) Re-factor javascript from hw01. You may want to put some javascript functions in their own file of code you might use on other web projects (as done with the code shown in lecture for auto-generating “show just one section” from (the children of) a parent element, hiding-parts.js).

    For example, adding a new concentration to a major should require minimal updates (perhaps: adding one checkbox+text, one line to javascript validation, and one line to php validation). (Extra-credit if it only requires one change in all your files.)

    The points for this are awarded for not having (say) four copies of the same javascript/php code for each concentration, but instead just the code just once (in a function called from a loop, say).

  6. (15%)

    Require that users log in, authenticating with their RU login 3; their session will time out after 5min of inactivity. Further info: You'll ask for a username and a password. You don't need to actually authenticate anything; any username/password will work for now. (In hw03 you'll look up user names in a database, to authenticate). However, until they have logged in, they should not be able to enter course information. (You can do anything reasonable if they are not logged in: either have a note at the top of the page stating that they must log in before completing the form, or flat-out redirect them to the login page.)

    If a user is not logged in (or perhaps their session has timed out), the response form should include a statement to that effect.

    Provide a logout page, to end their session (before 5min expires).

  7. (5%) (As mentioned above): A file crs-cat-sources.php (in the same directory)

You may integrate bits from the hw01-soln/ into your code, but be sure to understand how any code that you use works.

Guidelines

Each file should start (after a doctype declaration) with a PHP comment with your name and a summary description of what the php code accomplishes. Use meaningful variable names, function names, and good comments as needed. Javascript code should be described with inside (“<!-- -->”) comments. Write functions (both php and javascript) as appropriate, to avoid repeated code. All code/html should be well formatted with appropriate white space and indentation so it is easy to read. Strive to minimize lines that wrap. Use standard XHTML tags and make sure your javascript does not use browser-specific constructs. If you have any questions, use the discussion board. Do not modify your final submission after the due-date. To submit your assignment, you will attach all necessary files on WebCT.


1I am such a pushover!      

2 Some extra credit if your crs-cat-sources.php actually loops over all appropriately-named files in its directory.      

3 If you like, you may use the RU authentification as described at tutorial.php.      

homelectsexamshws
breeze (snow day)


©2011, Ian Barland, Radford University
Last modified 2011.Apr.10 (Sun)
Please mail any suggestions
(incl. typos, broken links)
to iba�rlandrad�ford.edu
Powered by PLT Scheme