Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A university offers a range of IT training sessions during welcome week that students can book in advance. The sessions cover topics such as Word

A university offers a range of IT training sessions during welcome week that students can book in advance. The sessions cover topics such as Word Processing, Spreadsheets, etc. To keep the system simple, we assume that the students do not have computer accounts yet but instead enter a few personal details when they book a training session. Sessions on a particular topic are typically offered more than once during welcome week. Every time a session on a particular topic runs it can only accommodate a certain number of participants; in the following we will call this the capacity of the session. We keep the capacity of sessions small. Initially, the number of places available on a specific session is equal to its capacity. In more detail, we assume that the University offers training sessions at the indicated times and all with the indicated capacity independent of the day of the week and time at which the session is offered: Topic Times Capacity Word Processing Tuesday, 10:00; Wednesday, 11:00; Thursday, 12:00 4 Spreadsheets Tuesday, 11:00, Wednesday, 12:00; Thursday, 10:00 3 Email Tuesday, 12:00; Wednesday, 10:00; Thursday, 11:00 3 Presentation Software Tuesday, 10:00; Thursday, 12:00 2 Library Use Wednesday, 11:00 2 That is, in total there are sessions on 5 different topics, offered between once and three times during welcome week, with a capacity for only two to four participants every time a session on a particular topic runs. The web-based system should allow a student to select a topic via a drop-down menu; select a day of the week and time at which a session on that topic is offered via a separate drop-down menu; enter their name via a text field; enter their e-mail address via another text field (in case the student needs to be contacted); after selecting/entering the data above, submit a booking request by pressing a `Submit' button. Ideally, a student is able to enter all this data via a single web page (not a sequence of two or more pages). However, a sequence of web pages can be used if this is the only way that you are able to realise this application. The menus should be populated with data from a database. On submission of a booking request, a student should be shown a confirmation whether the booking request has been successful or unsuccessful. This confirmation should include all the details of the booking that was attempted. This is subject to the following conditions: The application should ensure that the string entered as a name satisfies the following constraints: A name only consist of letters (a-z and A-Z), hyphens, apostrophes and spaces; contains no sequence of two or more of the characters hyphen and apostrophe; starts with a letter or an apostrophe; does not end with a hyphen or a space. If these constraints are satisfied, then we call the name valid. If these constraints are not satisfied, then the application should display an error message and the booking request must be unsuccessful. This must be realised using PHP (not HTML5 nor JavaScript). The application should ensure that the string entered by the user as an e-mail address has exactly one occurrence of @ that is preceded and followed by a non-empty sequence of the characters a-z, dot, underscore, hyphen, where neither sequence ends in a dot or a hyphen. An e-mail address that satisfies these constraints is called valid and the check that the user has entered a valid e-mail address must be performed using PHP only. If the input of the user is not a valid e-mail address, then an error message should be shown and the booking request is unsuccessful. If name and e-mail address are valid, then a booking request must be successful if the selected session still has at least one place left. On success, the number of places on the selected session is reduced by one and a record of the booking will be kept in the database, including the topic, time, name, and e-mail address. A booking request must be unsuccessful if there are no places left on the selected session. Underlying the application must be a MySQL database. Initially, the database must contain information on the modules, times at which sessions for each topic are offered and the capacity of each session. The database should then keep track of the number of free places after each successful booking requests and also keep records of each successful booking, including all the data that the user has provided. The PHP Data Objects (PDO) extension of PHP must be used to implement the interactions between your application and the database. Additional requirements and comments: The description of the application above suggests that a user goes through a sequence of five steps in order to submit a booking request. However, if you use a single page design for your application, then there is little that prevents a user from skipping a step or skipping all steps before clicking on the `Submit' button. Your application should make sure that a request is only processed once the `Submit' button has been activated and should produce appropriate error messages if the request does not contain all the necessary data. But no error messages should be shown before activation of the `Submit' button. The application would ideally help the user by only listing in the first menu only those topics that have sessions with available places, and once a student has selected a particular topic in that menu, would in the second menu only list the times at which sessions with available places take place. It would also be helpful to the user if entries in the two menus are listed in a `sensible' order, that is, topics should be ordered alphabetically and the times chronologically. Also, each module should only occur at most once in the first menu and each time at most once in the second menu. If a booking request is unsuccessful, then it should then be possible for a student to make another attempt with as little effort as possible. For example, if name and e-mail address were valid, but there were no places available on the selected session, then the application would ideally be programmed in such a way that there is no need to enter name and e-mail address again (but invalid data should not be carried forward). One should expect that all `inputs' to the application, even those that are intended to come from a menu, will be used by malicious users to inject code that causes your application to malfunction or reveal the contents of the database. You should program the application in a way that safeguards against such attacks. It is possible that two student nearly simultaneously try to book the last available place on a session. Depending on how you implement the interaction with the database, this could lead to a situation in which your application determines for both students that there is still a place available and then records for both users that he/she has successfully booked that place. This is obviously incorrect behaviour by the application and needs to be avoided. The booking request of exactly one of the two students must be successful and the booking request of the other has to be unsuccessful. There could be more students than the combined capacity of all the sessions. If someone tries to use the application once all places on the sessions have already been booked, then the application should produce a message indicating that all sessions are full instead of showing the various menus and text fields. The same should also happen if this situation occurs when a user re-enters the application after an unsuccessful booking request. As this is an assignment on PHP, the use of other scripting languages should be kept to a minimum. In particular, the use of JavaScript must be restricted to the JavaScript submit() function. User-defined JavaScript functions are not allowed. Use of the PHP superglobal $_GLOBALS is poor programming practice and its use will results in a lower mark. Your code should follow the COMP519 Coding Standard. This includes pointing out which parts of your code have been developed with the help of on-line sources or textbooks and references for these sources. Each of these requirements is linked to one of more of the assessment criteria for this assignment. Therefore, the more requirements a application satisfies, the higher the mark.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions

Question

6. Conclude with the same strength as in the introduction

Answered: 1 week ago

Question

7. Prepare an effective outline

Answered: 1 week ago