All pastes #432880 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-04-10 14:14 UTC
rendered paste body
The idea is that we are setting up a web site holding information about students and courses. The
website offers two interfaces: one for staff and one for students. All users need to logon using a
username. If the system recognises the user as staff, the site offers the staff interface and if the
site recognises the user as a student, the student interface is displayed. The staff interface permits
adding or deleting students and the student interface allows accessing the courses taken by a
student.

The assignment involves server-side scripting (PHP). The files containing your solutions will
have to be on the student server shark, and you will have to do the development work using
shark as your Web server. All the relevant files must be in a subfolder called Assignment in
your shark folder. I need to be able to run your scripts via my browser, so I need to know where
to look! The files referred to below are on the departmental courses server, in the directory
CSC9W6/Assignment.

Stage 1
Write an HTML document (signin.html) which displays a form containing a prompt for the user,
a text field (INPUT TYPE="text") and a ‘submit’ button (INPUT TYPE="submit"), so that
the user is prompted to enter their username in the text field, and the ACTION associated with
the form is to invoke a PHP script (select.php) on the server. For this stage the script should only
welcome the user by their name.

Stage 2
In this stage, the signing on will be linked to a MySQL database which holds all the user
accounts. To start you off two files are provided: the files initialise.php and accounts.sql. You
should run initialise.php on shark (view in a web browser) to create the MySQL database.

Change your select.php script to query the database and look for an entry which matches the
username provided through the form in sign.html. As you will remember from the lectures,
accessing a database involves three steps: firstly, connecting to the database (using the connect()
function), secondly, issuing the query on the database (query()), and thirdly, to get the returned
data (fetchRow() or fetchInto()). Initialise.php provides some guidance for the first two steps
(there is no row fetching as no data will be returned from an INSERT).

If the user is not found in the database, a corresponding message should be displayed and a
hyperlink be offered back to sign.html.

If the username is recognised and it’s a student account, then a link to another page
(showclasses.php) should be displayed. This aspect of the website is continued in Stage 3. If the
username refers to a staff account a link to a page (staffhandling.php) should be displayed.
Stage 4 of this assignment is concerned with the staff aspect.