Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

MTS9307 – Web server programming

Autumn, 2023

labs – week 9-10

Marking lab in week 10

The solutions for this lab should be submitted in Moodle by  12/05/2023 5.00pm (Friday week 10)

------------------------------------------------------------------------------------------------

IMPORTANT NOTE: Make sure you have included all the information needed (all files and a script of your database including all tables and data), so your solution can be run in a browser. If you  need  to  create  a  script  of the  database,  you  can  use  the  phpMyAdmin  option ‘Export(custom)’ . Make sure to check all needed SQL statements for the database and tables. The registration form is not compulsory, so if you do not have a registration form, you need to provide the username and password to login into the application.

Task 1. (10 marks)

Create  a  database  for  a  Music  Conservatorium  offering  various  classes.  The  Music Conservatorium has 2 faculties: Instrumental  and Ensembles. Each  faculty offers  several classes. A limited number of students can enrol in each class. Instrumental faculty offers individual classes (one student per class); the Ensembles faculty offers group classes limited to 5 students. Also, each class is run by one music staff (teacher) and each teacher belongs to a single faculty.

Note: you can use php script to create the database and tables or you can use phpMyAdmin.

Using the created database, create an application that will allow students to login and enrol in/withdraw from their preferred classes.

The student should be able to enrol in a class.

The student should be able to see (in a table) the classes in which is enrolled.

The student should be able to withdraw from the class in which is already enrolled.                 The  student  should be  able to  select  any  of the  following  queries  and  after  entering  its associated parameter, should be able to see the result:

a) The ID and title of classes (for example, G1 - Guitar individual lesson) offered by a specific faculty (specific faculty means Instrumental or Ensembles);

b) The name ofthe students enrolled in a specific class (the student should enter/select either ID or name of the class);

c) The  name  of the  music  staff (teachers)  in  a  specific  faculty  (the  student  should enter/select the faculty);

d) The number of students in each class;

e) The number of teachers in each faculty;

f)  The studentID and name of students who have classes with a specific teacher (the student should enter/select the teacher);

g) The number of students who have enrolled in the classes offered by each faculty (note that, for instance, if one student has enrolled in three classes, should be counted three times).

The student can enrol in many classes, make any number of withdrawals possible, and make any number of possible  queries. But, the  enrolment  should be limited to  one  student in individual classes and 5 students per group class (the student cannot enrol in classes that are full).

At least three different PHP files (e.g. Enrolment.php, Withdraw.php, and Queries.php) should be allocated to the three tasks of enrolment, withdrawal, and query results, respectively.

Please note that after logging on and during all sessions, the student is not required to re-enter the username and password again.

Note: To add to the security of your code, never keep a table containing passwords! Instead, use a function (like md5) to encode passwords, and keep their encoded equivalence in your table.

You can use any tool for maintaining state information with PHP.