讲解Web编程、辅导Java程序语言、Java编程调试
- 首页 >> Python编程Assignment 2
Semester 1, 2021
DUE ON: 11:59 PM, Wednesday 26 May 2021
Assignment Worth: 25% of total marks
NB: Assignments will be accepted up to five (5) days late, but a penalty of 5% per day (or part of a day) late
will be imposed on either the team or the individual depending on the circumstances.
NB: This is an individual assignment. Students are referred to the school’s policy on plagiarism. A confirmed
case will incur zero mark to all the involved students.
NB about naming standard:
- All file names must be consistent with what is specified in the assignment instruction.
o For Task 2.1, please use the same name “booking” for all types of files for this task. For
example, booking.html, booking.php, booking.js.
o For Task 2.2, please use the same name “admin” for all types of files for this task. For
example, admin.html, admin.php, admin.js.
o For the MySql table creation command, please write in mysqlcommand.txt
1. Overview
The aim of this assignment is to develop a better understanding of building web applications using
simple Ajax techniques, PHP, and MySQL. It assumes that you are able to work with MySQL and
PHP on the server, as learned in the first part and Assignment One of this course, and that you
can develop an Ajax client interface using HTML and JavaScript, as learned in the second part of
this course.
For this assignment, you will need to create all the appropriate HTML, JavaScript, PHP files and
Database tables. You should save and test all your HTML and PHP files on cmslamp14.aut.ac.nz
server in a directory "/home/
2. Assignment Tasks
The assignment is to develop a simple web-based taxi booking system called CabsOnline.
CabsOnline allows passengers to book taxi services from any of their internet connected
computers or mobile phones. The techniques you are going to use include the Ajax techniques
(JavaScript/HTML, XMLHttpRequest, CSS, and DOM), MySQL and PHP. For client-server
communication, you must use XMLHttpRequest object.
Two components (booking and admin) of such an online service that must be completed for this
assignment are specified in the following two sub-sections. Other components such as querying
service for drivers, monitoring services for customers, payment processing, detailed processing for
assigning taxi are not required in this assignment but you are free to extend for your fun later.
2.1 The Booking Component
This component is used to allow a passenger to put in a taxi booking request in Auckland and
surrounding areas.
1) On the client side, design an HTML page (booking.html) and a client-side program to take
inputs for a booking request, and pass them to server for processing (using XHR object). You
need to validate these inputs before sending them to the server:
• Customer Name (Text input type. Must set its name attribute to ”cname”: type=”text” name=”cname”>. NOT NULL)
2
• Phone Number (Text input type. Must set its name attribute to ”phone”: type=”text” name=”phone”>. NOT NULL). Phone number must be all numbers
with length between 10-12
• Unit Number (Text input type. Must set its name attribute to ”unumber”: type=”text” name=”unumber”>. Optional)
• Street Number (Text input type. Must set its name attribute to ”snumber”: type=”text” name=”snumber”>. Not Null)
• Street Name (Text input type. Must set its name attribute to ”stname”: type=”text” name=”stname”>. NOT NULL)
• Suburb (Text input type. Must set its name attribute to ”sbname”: type=”text” name=”sbname”>. Optional)
• Destination Suburb (Text input type. Must set its name attribute to ”dsbname”:
. Optional)1
• Pick-Up Date (text or date input type. Must set its name attribute ”date”. NOT NULL,
should initially contain the current date in dd/mm/yyyy format e.g. 01/05/2021. This
can be edited by the user.
• Pick-up Time (text or time input type. Must set its name attribute ”time”. NOT NULL,
should initially contain the current time in 24h format HH:MM format e.g. 18:30. This
can be edited by the user.
Please note that the pick-up date and time must not be earlier than current date
and time on the client machine.
2) On the server side, for each booking request, a server-side program is required to generate a
unique booking reference number, booking date/time and a status with initial value
“unassigned”, and add them together with customer’s inputs into the MySQL table. In
addition, it is also required to return confirmation information to the client.
3) Design and create a MySQL table for storing information of all requests. For each request, you
need to store the generated booking number, customer’s inputs, the generated booking
date/time, and the generated status.
4) On the client side, upon receiving the returned information from the server, the client-side
program needs to display the returned confirmation information “Thank you! Your booking
reference number is
at
element must include a
element that uses the confirmation information
as its content.
2.2 The Admin Component
This component allows administrative people of CabsOnline to view those taxi booking requests
that need to be assigned as soon as possible and to assign taxi for a particular booking request.
Note that authentication is not required though it is necessary in the real application. If you provide
this function, you must provide the password and explain it in the readme document. The specific
functions of this component include:
1) Design an HTML page (admin.html) that takes two types of requests:
1
*** Note that it is not necessary to validate the genuineness of an address. But if you want to do that to make the
application more realistic, you can use google.maps.Geocoder() Web API. Please refer to Google Map API
online document or https://codepen.io/pavenuto/pen/dXkgEz on how to do that.
3
The first is to search booking requests and is realized by a single button to show pick-up
requests.
This search function has one text input field:
• Search Bookings (Text input type. Must set its name attribute to ”bsearch”:
. Optional). User can either input a
reference number or nothing:
i. If a reference number is input, then the booking record associated with this
reference number is returned by the server.
ii. If user input nothing (empty), then a list of bookings with a pick-up time within 2
hours from now is returned by the server (see below Item 3 for details).
• Search Button (button input type. Must set its name attribute to ”sbutton”: type=”text” name=”sbutton”>).
The second is to assign taxi for a particular booking request (See Item 4 for details)
2) Once the button search booking is pressed, a client-side program issues a query request to
the server (using XHR object); once the button assign taxi is pressed, a client program
issues an assigning request to the server with a booking reference number.
3) On the server side, a server-side program responds differently for different types of
requests from the client:
a. For a request for showing pick-up requests, the server-side program executes a
query on the MySQL database for finding those “unassigned” booking requests
with a pick-up time within 2 hours from now only. For each found request, the
booking reference number, customer name, contact phone, pick-up suburb,
destination suburb, and pick-up date/time are required to return to the client.
b. For a request for assigning taxi, make an update to the MySQL database to change
the status of the booking request that matches the given booking reference number
from “unassigned” to “assigned”, and return confirmation information to the
client.
4) On the client side, for a request for showing pick-up requests, you display the returned
information in a
• Inside the div element is a