程序代写代做代考 Hive Java javascript database Your task for this practical assignment consists of two parts:
Your task for this practical assignment consists of two parts:
1. Develop a web-based system using HTML, PHP, and MySQL that provides the functionality stated in the Requirements section below.
2. Make the system that you have created accessible and usable via the URL
http://cgi.csc.liv.ac.uk/~x6cj/classes.php
taking care that the access rights for the file classes.php are neither too restrictive nor too permissive. Making the system usable includes setting up the corresponding database on the departmental MySQL server and filling it with the appropriate data.
Requirements
A community college is offering a variety of adult evening courses and would like to introduce a web-based system that allows people to book a place on these courses. Each course is typically offered more than once during a week, on different days of the week and different times. Every time a course is run it can only accommodate a certain number of participants, in the following we will call this the capacity of the course or the number of places on the course. We keep the range and capacity of classes small. To further simplify things, we assume that people do not have to create accounts with the system but instead enter a few personal details when they book a course. They also need to enter what previous knowledge they have of the subject of the course they are booking. This is intended to help the instructor to better prepare the course for its participants.
In more detail, the college offers the following courses at the indicated times and all with the indicated capacity independent of the time at which the course is offered:
Course Title
Times
Capacity
Creative Cupcakes
Monday, 19:00; Wednesday, 19:00; Friday, 19:00
2
Digital Photography
Tuesday, 19:00; Thursday, 19:00
4
Family History for Beginners
Monday, 20:00; Tuesday, 20:00
3
Fundamentals of Acrylic Painting
Wednesday, 20:00; Friday, 20:00
2
Holiday French
Thursday, 20:00
2
That is, in total there are 5 different courses, offered between once and three times a week, and each with a capacity for only two to four participants every time the course runs. For instance, two people can take the course on Digital Photography on Tuesday at 19:00 and another two can take the course on Digital Photography on Thursday at 19:00.
The web-based system should allow a user to
1. select a course title via a drop-down/pop-up list or selection menu;
2. select a day of the week and time at which that particular course is offered via a separate drop-down/pop-up list or selection menu;
3. enter their name via a text field;
4. enter their phone/mobile number via a second text field (in case the course is cancelled at short notice and participants have to be notified);
5. enter their previous knowledge of the subject of the course via a third text field;
6. submit a booking request by pressing a `Submit’ button, after selecting/entering the data above. .
Ideally, the user of the system 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 page can be used if this is the only way that you are able to realise this system.
Also, ideally, the menus are populated with data from a database.
On submission of a booking request, the user should be shown a confirmation whether the booking request has been successful or unsuccessful. This is subject to the following conditions:
· The system 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; and starts with a letter. If these constraints are satisfied, then we call the name valid. If these constraints are not satisfied, then the system should display an error message and the booking request must be unsuccessful.
· The system should ensure that the string entered as a phone or mobile number satisfies the following constraints: A phone or mobile number only consists of digits and spaces; contains either nine or ten digits; and starts with the digit 0. If these constraints are satisfied, then we call the phone number valid. If these constraints are not satisfied, then the system should display an error message and the booking request must be unsuccessful.
· If name and phone number are valid, then a booking request must be successful if the selected course at the selected date and time still has at least one place left. On success, the number of places on the selected course at the selected date and time is reduced by one and a record of the booking will be kept in the database, including the course title, date and time, name, phone number, and previous knowledge of the subject of the course.
· A booking request must be unsuccessful if there are no places left on the selected course at the selected date and time.
Underlying the system must be a MySQL database. Initially, the database must contain information on the course titles, the dates and times at which each course runs and number of places available. The database should then keep track of the number of places remaining after each successful booking requests and also keep a record of each successful booking.
· The description of the system above suggests that a user goes through a sequence of several steps in order to submit a booking request. However, if you use a single page design for your system, then there is little that prevents a user from skipping a step or skipping all steps before pressing the `Submit’ button. Your system should make sure that a request is only processed once the `Submit’ button has been pressed and should produce appropriate error messages if the request does not contain all the necessary data.
· The system would ideally help the user by listing in the first menu only the titles of those courses which still have places left at one of the dates and times it runs and, once the user has selected a particular course title in that menu, would in the second menu only list the dates and times at which the selected course still has places left.
· It would also be helpful to the user if entries in the two menus are listed in a `sensible’ order, that is, course titles should be ordered alphabetically and the dates and times chronologically. Also, each course title should only occur at most once in the first menu and each date and time at most once in the second menu.
· If a booking request is unsuccessful, then it should then be possible for the user to make another attempt with as little effort as possible. For example, if name and phone number were valid, but there were no places left on the selected course, then the system would ideally be programmed in such a way that there is no need to enter name and phone number again (but invalid data should not be carried forward). The information on previous knowledge of the subject should carry over if the same course title is selected again, but not if a different course title is selected.
· Note that a student can enter an arbitrary string as previous knowledge on the subject of a course, including a string that contains quotation marks, double quotation marks and backslashes. You need to make sure that such strings are correctly stored in the database.
· One should expect that all `inputs’ to the system, even those that are intended to come from a menu, will be used by malicious users to inject code that causes your system to malfunction or reveal the contents of the database. You should program the system in a way that safeguards against such attacks.
· It is possible that two users nearly simultaneously try to book the last remaining place on a course at a particular date and time. Depending on how you implement the interaction with the database, this could lead to a situation in which your system determines for both users that there is still a place remaining and then records for both users that he/she has successfully booked that place. This is obviously incorrect and needs to be avoided. In such a situation, the booking request of exactly one of the two users 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 courses. If someone tries to use the system once all places on the courses have already been booked, then the system should produce a message indicating that all courses are full instead of showing the various lists/menus and text fields. The same should also happen if this situation occurs when a user re-enters the system 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 . Your code should be properly commented. This includes pointing out which parts of your code have been developed with the help of on-line sources or textbooks by including references for these sources at the appropriate points.
A system that satisfies these requirements in addition to the basic functional requirements will receive higher marks.
Submission
Submit your HTML/PHP code and a dump of your MySQL database (as separate, individual files; not as part of an archive file) 。