1. Instructions
2. Overview, Set Up and Modules
2.1 Helpful functions to put in tools.php
3. Booking Form Processing
4. Booking Process Flowchart 4.1 Screening Booking
5. Receipt Page and Tickets 5.1 Tax Invoice Receipt 5.2 Tickets
Marks Allocation
15 marks or 15 of your final grade
Setup, Modules, Programming Structure 3 marks Booking Form Data Processing 5 marks
Receipt and Tickets page 7 marks
2
3 4
6
7 7
8 8 8
9 9 9 9 9
COSC2413242624532690 Web Programming A3
Page 1 of 9
1. Instructions
Students are asked to work individually or in pairs for this assignment and are encouraged to seek help from classmates and teaching staff.
Students must make sure that their homepage available from this url:
titan.csit.rmit.edu.aus1234567wpa4index.php
Where s1234567 is your student id and titan can also be jupiter or saturn.
All media images, video etc must be located in the media folder and not the wp folder.
An official submission must be made by 11.59pm Friday Week 12 via Canvas. Please zip up your wp folder and rename it with your student id, ie
wps1234567.zip
This submission will be used for plagiarism testing and as a reference should problems arise.
If all these things are not done, you may receive zero marks.
Please Note: Keep the wireframe.css file and functionality unmodified, it is a helpful and important part of your development and our marking processes.
Please Note: If there are issues with your assignment that you need to fix before marking can take place, we will assign a temporary mark of 0.1. Dont panic, its a temporary mark which will be updated once you are ready for marking.
COSC2413242624532690 Web Programming A3 Page 2 of 9
2. Overview, Set Up and Modules
The client Lunardo is happy with your work or happy with your price 😛 and wants you to continue developing the website, implementing server side programming functionality.
As part of the development process, the client wants you to have a debug module visible at the bottom of the page ie under the footer so that the inner workings of the page are visible when testing: request data GET and POST must be visible, what is in the SESSION ie the shopping cart and your page code.
A file called tools.php must be created to house ALL PHP functions in one place and included near the top of your file. This file should have sessionstart near the top so that your page has access to the session object.
Movie data may be loaded from a spreadsheet using the fgetcsv function, but this is an advanced task for interested students only.
As much as possible, initialising and processing variables should be in organised structures rather than as disparate adhoc variables. You should also organise processing and validating code into functions so that the index and receipt pages are not cluttered with initialising and processing code.
COSC2413242624532690 Web Programming A3 Page 3 of 9
2.1 Helpful functions to put in tools.php
Instructions when using code examples in a debug module andor when debugging in general:
The blue code is function declaration code to put in tools.php.
The purple code is function calling code to put in your web page or elsewhere in tools.php where
you want the return or output of the function.
1 preShow function prints data and shapestructure of data:
function preShow arr, returnAsStringfalse
ret pre . printrarr, true . pre;
if returnAsString
return ret;
else
echo ret;
preShowPOST; ie echo a string
preShowSESSION;
aaarg preShowmybadarray, true; ie return as a string
echo Why is n aaarg n not working?;
2 Output your current files source code:
function printMyCode
lines fileSERVERSCRIPTFILENAME;
echo pre classmycodeol;
foreach lines as line
echo li.rtrimhtmlentitiesline.li;
echo olpre;
printMyCode; prints all lines of code in this file with line numbers
COSC2413242624532690 Web Programming A3 Page 4 of 9
3 A php multiple dimensional array to javascript object function
function php2js arr, arrName
lineEnd;
echo scriptn;
echo Generated with A4s php2js function ;
echo var arrName .jsonencodearr, JSONPRETTYPRINT;
echo scriptnn;
pricesArrayPHP array … ;
php2jspricesArrayPHP, pricesArrayJS; ie echos javascript equivalent code
COSC2413242624532690 Web Programming A3 Page 5 of 9
3. Booking Form Processing
In assignment 3 you were asked to submit form data to a testing processing script. Now you must submit data to your processing script which will either be located at the top of index.php easier option or in a separate processing script more challenging option. Guiding flow charts for the easier option can be found in the next section.
All form data must be validated server side for two reasons:
1. Not all honest customers have javascript enabled so there must be a server side fall back.
2. Dishonest users will turn javascript off, then try and hack your website, placing malformed
bookings in your tab delimited spreadsheet for fun or for malicious reasons.
Make sure that all inputs movie, seats and customer fields are checked server side using PHP functions.
If trivial errors cannot be sanitised server side eg removing accidentally typed chars from text based inputs, the customer must be asked to correct mistakes and have the original text entries displayed in the text based fields with appropriately styled error messages next to the fields.
You do not need to place errors next to the hidden movie fields or the seat drop down fields; if these values are invalid it is due to a hacker modifying your forms HTML. If you like you can place a message Stop hacking our website! if this happens.
Only when all the data is sanitised and validated should order information be placed into the SESSION and an order be written to your tab delimited bookings spreadsheet.
COSC2413242624532690 Web Programming A3 Page 6 of 9
4. Booking Process Flowchart
4.1 Screening Booking
This is a recommended flowchart for the screening booking process.
POST data is processed by index.php and added to SESSION if all the posted data is valid. If users attempt to navigate to receipt.php, they should be directed to index.php.
Update: To get you started with adding data to the cart, use this code:
SESSIONcart POST;
COSC2413242624532690 Web Programming A3 Page 7 of 9
5. Receipt Page and Tickets
5.1 Tax Invoice Receipt
Once a booking has been written to your tab delimited spreadsheet, a tax invoice ie a receipt for the customer should be generated so that when in print view, the page is styled to be different and fits on an A4 page.
This page can either be a different page ie receipt.php or a part of the single page application ie index.php. it should be on company letterhead with a dummy ABN number: 00 123 456 789
The customer details should be separate to the movies, day and hour, and seat details; and the seat details should be in a table or grid element along with the total price.
Prices are GST inclusive, the receipt should show the total and GST component ie 111 of the total price.
5.2 Tickets
Further, tickets for each film should be generated so that the customer can print either:
a groupshared ticket ie one for all seat holders in the booking that shows quantity of each seat OR
individual tickets for each seat holder eg 3 first class adult tickets if 3 first class adult tickets have
been purchased.
The generation of individual tickets is more complex and is worth more marks.
COSC2413242624532690 Web Programming A3 Page 8 of 9
Marks Allocation
15 marks or 15 of your final grade
Setup, Modules, Programming Structure 3 marks
Git repository is well maintained and a debug module is included near the footer to show POST and SESSION data, and page code.
Initialising and processing variables: movie day, times prices, customer etc are set up in structured multidimensional associative arrays.
Functions are used extensively, above variables are located in tools.php where appropriate, reducing programming clutter in index.php and receipt.php.
Booking Form Data Processing 5 marks
All POST data is checked for invalid entries before any HTML is outputted,
invalid input is not added to the SESSION, user is kept on index page when this happens.
Expiry date cannot be within a month of the purchase date or 28 days, your choice. Invalid text based POST entry is shown in original field for the customer to correct … … and error messages are placed next to invalid fields server side, styled appropriately. Validated bookings are written to bookings tab delimited spreadsheet using fputcsv.
Receipt and Tickets page 7 marks
Receipt page redirects to index page if the SESSION is empty.
Invoice section is styled differently so that it fits on A4 letterhead; business and customer information, purchases and tickets are present.
Total price and GST component calculated server side, both are correct.
All calculated prices are shown to 2 decimal places with in front.
A single group ticket shows all seat types and quantities or alternatively …
… individual tickets for each person in each seat shows screening seating information.
Design and quality of page and tickets is high, is functional, looks very professional: information is laid out in logical organised sections and in grid like structures.
1 mark 1 mark 1 mark
1 mark 1 mark 1 mark 1 mark 1 mark
1 mark
1 mark 1 mark 1 mark 1 mark 1 mark
1 mark
Total: 15 marks or 15 of your final grade
COSC2413242624532690 Web Programming A3 Page 9 of 9