CSCI 4000 Final Project

CSCI 4000 Final Project

The main programming language for this project should be PHP (mixed with HTML and CSS). If you do not use PHP, you will get 0 points. You must use PDO (PHP Data Object) to interface with the MySQL database.

If you do not use PDO, you will receive 0 points for all questions. JavaScript can be used, but the main mathematics calculations must be done in PHP (or 0 points will be awarded). When you are asked to save data to database for retrieval, you must save data to database and retrieve it (or 0 points will be awarded).

When you see “Richard Ricardo” or “richardricardo” in the examples and screen captures, change it to <your name.

When you see “Richard” or “richard” in the example screen captures, change it to <your first name.

If you do not put <your name / <your first name in the above mentioned fields, you will get 0 points for the question(s).

No two students should submit webpages with exactly the same code, content, layout, or color combination. If found, both students will get 0 points.

Create a folder on your hard disk, name the folder lastname_firstname_final_exam. Save all the files from this project in this folder.

Use XAMPP web server solution stack package to help debugging PHP code. It will make your debugging process easier. All php files must not produce any error, or any warning (-2 points for each error, each warning). Your program must run. A program that does not run will get 0 points. All files must begin with a comment that identifies the author, the course code, and the program date (- 2 points each question if found missing). All html, css and php files must be clearly documented (commented). Points will be taken off (-2 points each question) for insufficient comments (<!-- --, /* */, //).

Before adding PHP code, all html files must pass html validation at http://validator.w3.org/ without any

error (and with only 1 warning).

· When you view page source in a web browser, <!DOCTYPE html must be at the top of every page

(except php only pages). In other words, all html pages must be written in HTML5. (-20 points if not)

o You can put php code before <!DOCTYPE html.

o You cannot put html code before <!DOCTYPE html.

· All css files must pass css validation at http://jigsaw.w3.org/css-validator/ without any error. (-2 points for each error/warning, only 1 warning is allowed for html validator)

Question 1 – Database: PHP Chapter 3/4, eg008 and knowledge of SQL (15 points) Estimated time: 1 hour



· Save question 1 files in folder “lastname_firstname_final_exam”: (2 points)

o create_db.sql

· Create a text file create_db.sql, write sql statements in the file to

o Create a MySQL database richard_ricardo_exam_db. (2 points)

In the database, create 1 table.

§ coordinate3d (2 points)

o Create the following fields (columns) for the table (refer to examples below for details).

§ coordinate3d table: number, x, y, z (4 points)

§ number is the primary key of the table (2 points)

o Insert NO records to the table. Leave the table empty.

o Create a MySQL database username richardfinal with password richardbread, with data

privileges (select, insert, update, delete) for the richard_ricardo_exam_db database. (3 points)

o All above must be done by SQL statements in the text file create_db.sql. (0 points if not)

· Load create_db.sql in XAMPP phpMyAdmin to create the above mentioned database.

· Note: In the real world, do NOT put sql files in a website folder. Keep it offline and safe.

Question 2 – Home Page: PHP Chapter 4, eg008/9 and dynamic textbox (15 points) Estimated time: 1 hour
Save question 2 files in “lastname_firstname_final_exam”: (2 points)

o index.php

o main.css

· Create web page(s) that displays the default information (example shown).

· The initial page and related outputs should look like the examples shown below.

· Create your page(s) using “richard ricardo’s secret calculator” as the page title(s). (1 point)

· Save the first page as index.php. (1 point)

· Create a css file named main.css to format all pages by creating your own layout (no two students should have the same layout). You should use the same css file to format all questions. (6 points)

· index.php (5 points)

o The submit button will submit to richard_ricardo_dynamic_textbox.php file (Q4).

o This Remove old record link will link to richard_ricardo_clear_table.php file (Q3).


Question 3 – Delete: PHP Chapter 4, eg008/9 and SQL (15 points) Estimated time: 1 hour

Save question 3 files in folder “lastname_firstname_final_exam”. (2 points)

o richard_ricardo_clear_table.php

o richard_ricardo_database.php

o richard_ricardo_database_error.php

· The initial page and related outputs should look like the examples shown below.

· Create your page(s) using “richard ricardo’s secret calculator” as the page title(s). (2 points)

· When a user click on a “Remove old records” link on index.php (), (11 points)

o the user should be directed to richard_ricardo_clear_table.php.

o richard_ricardo_clear_table.php uses richard_ricardo_database.php to connect to the database.

o all records will be deleted from the database table “coordinate3d”.

o number of records removed will be shown.

o user can follow a link to go back to index.php.


Example: richard_ricardo_clear_table.php (if there are records) Example: richard_ricardo_clear_table.php (if there is no record) Example: richard_ricardo_database.php (shows nothing)


Question 4 – Dynamic Textbox, Database, Calculation (55 points) Estimated time: 4 hours

· Save question 4 files in folder “lastname_firstname_final_exam”. (2 points)

o richard_ricardo_dynamic_textbox.php o richard_ricardo_dynamic_process.php o richard_ricardo_calculate.php

· The initial page and related outputs should look like the examples shown below.

· Create your page(s) using “richard ricardo’s secret calculator” as the page title(s). (2 points)

· When a user clicks on “submit” button on index.php, (6 points)

o the user should be directed to richard_ricardo_dynamic_textbox.php.

§ user can enter n sets of coordinates

· When a user clicks on “submit” button on richard_ricardo_dynamic_textbox.php,

o the user should be directed to richard_ricardo_dynamic_process.php (15 points)

§ the n sets of coordinates input are to be saved to the database table “coordinate3d”.

§ use richard_ricardo_database.php file from Question 3 to connect to database.

§ If the coordinates are NOT saved to the database, 0 points will be awarded to Question 4.

· When a user click on “Retrieve records for calculation” link on richard_ricardo_dynamic_process.php

o the user should be directed to richard_ricardo_calculate.php (15 points)

§ the n sets of saved coordinated must be retrieved from the database table “coordinate3d”.

§ use richard_ricardo_database.php file from Question 3 to connect to database.

§ If the coordinates are NOT retrieved from the database, 0 points will be awarded to

Question 4.

o A function is applied to each set of coordinate, calculation is done and steps are shown. (15 points)


1. If you do not put <your name / <your first name in the above mentioned fields (as shown in the examples), you will get 0 points for the question(s).

2. No two students should submit webpages with exactly the same code, content, layout, or color combination. If found, both students will get 0 points.

3. Before adding PHP code, all html files must pass html validation at http://validator.w3.org/ without any

error (and with only 1 warning). Use the validator’s “File Upload” tab to check each file.

a. If you want to validate a PHP file after adding PHP code, you can temporarily rename the *.php file to *.htm file.

b. When you view page source in a web browser, <!DOCTYPE html must be at the top of every page (except php only pages). In other words, all pages must be written in HTML5. (-20 points if not)

c. If any html error is found, 2 points will be deducted for each error. Please validate the files before adding PHP code.

4. All css files must pass css validation at http://jigsaw.w3.org/css-validator/ without any error.

5. If your files do not pass the html and css validations, 2 points will be deducted for each html or css error found (no deduction for php error at html validation).

6. Document (comment) your HTML files (<!-- --), CSS files (/* */), and PHP files (/* */ OR

//). Points will be taken off for insufficient comments (<!-- --, /* */, //).

Submission instructions:

· You need to test all document(s).

· Do screen capture(s) of the input and the related output(s). Use any graphic editing software (e.g.

Microsoft Paint, Adobe Fireworks, GIMP, or Microsoft Expression Design etc) to cut out the browser output (from the screen capture), paste them into a word document.

· Provide 2 different test cases.

· Provide the same screen captures as the examples shown above.

· Do NOT need to do screen capture(s) of html validation results and css validation results for this assignment.

· Save the word document as a pdf file.



You need to submit the following:

1. A pdf file containing the screen capture(s) of the web browser input and output pages, name the file

lastname_firstname_final_exam.pdf.

2. All html file(s), php file(s), css file(s), and other related files (e.g. image files). Zip your file folder

(lastname_firstname_final_exam) into a single zip file (or rar file) lastname_firstname_final_exam.zip.

In the above example, the zip file should contain the following files and subfolders. If there is any image, there should be a \images\ subfolder.

· lastname_firstname_final_exam\create_db.sql

· lastname_firstname_final_exam\index.php

· lastname_firstname_final_exam\main.css

· lastname_firstname_final_exam\richard_ricardo_calculate.php

· lastname_firstname_final_exam\richard_ricardo_clear_table.php

· lastname_firstname_final_exam\richard_ricardo_database.php

· lastname_firstname_final_exam\richard_ricardo_database_error.php

· lastname_firstname_final_exam\richard_ricardo_dynamic_process.php

· lastname_firstname_final_exam\richard_ricardo_dynamic_textbox.php

· lastname_firstname_final_exam\*.* (any other files you want to create, not necessary) Please submit the above mentioned two files (.pdf and .zip) to D2L digital dropbox.
Powered by