CP3101B Web Programming and Applications
Assignment 1 - HTML5, PHP, CSS, SQL and Page at a time web applications

Due: Feb 19, 2013, 11:50 PM
Late penalty: 20% penalty for 48 hours late, not excepted after that.
Hand in: Please do the following for your submission:
  1. Include a CREATIVE_ADDITIONS.txt in the root of your submission. This describes any extra features you want us to take into consideration.
  2. Include a MEMBERS.txt file with the matriculation numbers of both members of your team. MEMBERS.txt should look like a111111 Jane Doe a222222 Jill Smith so the following will get your matriculation numbers arnold@cp3101b-1:~$ sed -e 's/ .*$//' MEMBERS.txt a111111 a222222
  3. Include a README.txt which describes how we install your application. and any special considerations/instructions.
  4. Include a schema.sql file which we can use to initialize our database with your schema and any sample data.
  5. Include a config.inc which should centralize any configuration, so for example, variables for the database user name, database password, etc. With luck, after modifying this file, and loading your schema, we can play with your application.
  6. Other than MEMBERS.txt, there should be no identifying information, and no passwords in your submission. We may share your application with the class during a code review.
  7. Make sure that file permissions permit the minimum necessary access. See chmod. It should not be possible to browse your sessions directory from the web, nor see your config files etc.
  8. Zip your submission so that, when we unzip, we have a single directory with your complete application, CREATIVE_ADDITIONS.txt, MEMBERS.txt, README.txt, ... in it. Do this by executing, on cp3101b-1 cd ~/public_html zip -r todo todo Leaving a todo.zip for submission. You can test this on cp3101b-1 via cd ~ mkdir tmp cd tmp unzip ~/public_html/todo.zip and verifying the contents as well as file permissions. In the above, I am assuming that your application is in ~/public_html/todo and you have no ~/tmp directory. Alter these instructions as appropriate.
  9. Please submit here. and compare the output on the screen with unzip -t todo.zip only one submission/group.
Marking: 10% Creative additions, marked relative to your classmates 90% From the features as outlined below.
  • Code quality: simple, clear, concise
  • Code extensability: is it extendable, easy to re-purpose for another application
  • Code documentation: if you have good naming, and your code is clear, you will need minimal documentation.
  • Easy to install: if we can't install it, we can't mark it. Make it easy for us to securely install. Write simple, clear instructions, single config file.
  • Functionality: Does it have the minimal features implemented well.
  • Web site design: Does the application make good use of CSS, for a simple, effective website design.
Just a reminder, I mark, essentially, on the following scale.
  • 5/5 Solved, well understood, well comunicated: Evidence of excellent understanding of all tools, concepts and the problem at hand, so much so that the tools are used in simple, effective and creative ways to solve the problem. Example: Simple, clear, concise, reusable code. Well designed, clean webpages, with all features.
  • 4/5 Solved: Evidence of understanding of all tools, concepts and ability to combine them to produce a solution. Example: Correct code with some of the following issues (for example): long, poor naming, hard to read code, poorly documented, hard to re-use the code. Not a great layout, style.
  • 3/5 Solved with serious issues. Evidence that tools and concepts are understood, but could not be combined into a solution. Example: Missing or non-functional features or concepts. Messy, disorganized code.
  • 2/5 Incomplete: A serious attempt to create a solution using the appropriate technologies. The solution does not work, though many requirements are addressed.
  • 1/5 Started: An attempt using the required tools and concepts, with some progress. Evidence of syntactic understanding.
Groups: Work in teams of size 2
Environment:We will run your PHP in our virtual machine. It should render correctly in the labs versions of Firefox, Chrome and IE.

Introduction

We have already gone over the GuessGame application, including seeing an sample MVC web architecture for it. It's time for a change. For this assignment, you are to create a ToDo application. This ToDo web application is targeted at tasks that can be broken down into managable, well understood chunks. For example, reading a book, painting a room, studying for a test. The basic version of this application will allow each user to define a list of tasks they wish to finish. For each task, they assign a number of 30 minute work units. Users can see their progress on tasks, they can mark units of work for a task as completed. They can add more tasks. Here is mockup of the content of a minimal All Tasks page, feel free to create a better user interface!
This application should be complete as far as web application features are concerned. You might think of this application in the following way: In the future, when you need to quickly put together a 'page at a time' type web application, you will be able to grab the ToDo application and quickly modify it for your new purposes. You will also see why frameworks, such as CodeIgniter, Django,... exist, and what they try to do for you. You can choose to write another application if you wish, we will be looking at the extent to which your submission is a great web application. Please let us know before you begin though.

Application Description

Your application should consist of a few pages, here are some suggestions. The following are avalable for public viewing.

The following are available only to authenticated users. Add in any other pages you feel are necessary. The purpose of some of these pages, ie. contact, news, is to have a reason for website navigation and to have some content for your utilities links. They can be 'static' though probably will be generated by PHP to maintain consistency.

From the point of view of CRUD (Create Read Update Delete), your application is required to support Your database schema may have more tables, you should infer the operations on these tables from above.

Web application requirements

All submitted work must be your own PHP, CSS, HTML5, postgresql SQL, or supplied code, appropriately modified. You will learn little if you use html/css generating tools, or a framework. Your submission should exercise at least the following.

Creative Additions (the 10%)

These are ideas only, feel free to come up with different additions. By the way, more is not necessarily better. A few well thought out, interesting additions to keep the application simple is better than many features making the application confusing and ugly.

References

Questions and Answers

Question:
What do you mean by sanitize inputs?
Answer:
I will answer a broader question: How should I secure my application? Answer: Understand what is going into and out of your application.

For in, make sure things are of the right type and length, whitelist. Use prepared statements for SQL (stuff going into your db). For out, make sure that what the user recieves is not misinterpreted, escape all strings sent to you by the user, going back onto webpages. to prevent XSS. Use https to prevent session hijacking. Don't place ids on the webpage. Understand the difference between GET and POST and make sure to use them appropriately (think passwords). Do you want plaintext passwords in the database?

Question:
Do I have to work in a team?
Answer:
No, but if you want a team member, let me know.
Question:
How can I make it easy for the TAs to evaluate my work?
Answer:
Some are wondering how we will be able to install your web application. My suggestion is for you to 1) Have a configuration file called config.inc which has a few parameters to be set by anyone installing your scripts. This could include variables capturing the location of session store prefix for any absolute references, all other references should be relative. database userid and passwords you can expect us to replace these as appropriate. 2) Include DDL to drop and create your database schema including initial test data schema.sql 3) a README.txt with any special instructions. Expect your application to be hosted on our virtual machine, clients will run Firefox, Chrome, IE and Safari as they are installed in our lab. You should be able to handle multiple simultaneous connections. This is a given for web applications.
Question:
What would a config file look like?
Answer:
config.inc --------------------------- <?php $db_user="my_db_user_name"; $db_name="my_db_name"; $db_password="my_db_password"; $url_prefix="https://..."; $session_save_path="path to my session directory"; ... ?> Other php scripts can require 'config.inc'; at the start.
Question:
What is DDL?
Answer:
Data definition language. Like CREATE TABLE appusers (...
Question:
Can I use Javascript, Flash, ...
Answer:
No, this is about page at a time web applications. Javascript is later.
Question:
Will appearance be marked?
Answer:
Some part of it will go to design and some part to usability. For colors, you might want to take a look at colorschemedesigner.com, for example. Put these in your css and there you have it.