Create a simple navigation menu

Assignment Help PHP Web Programming
Reference no: EM131373548

General Instructions

- Your HTML files must be validated by the W3C validator at https://validator.w3.org
- You must test your web pages in Google Chrome to make sure they work. You should test them in another browser, but this is not a requirement.
- Save all your files (HTML, CSS, images) to your /practicals/prac2 folder on your TWA website.

General Workflow
PHP does not work like HTML or Javascript. You have to upload your files to your TWA site or edit within your TWA site for testing. This means you edit -> upload -> test-> edit -> upload -> test ...
To speed up this process you may want to develop locally using a local installation of the software Apache/MySQL/PHP, such as UwAMP (https://www.uwamp.com/en/), however configuration and/or technical support on how to get it to work will not be provided by your tutor. If you choose to do this, do not substitute it for your actual TWA site for testing. If your site works locally, but does not work on your TWA site, that is not a reason for special consideration when marking. How your work works on your TWA site will be assessed.

PHP Form Processing

Task 1
Within your practical-2.zip after extraction under the task-1 folder you will have the file task1.php. This file contains a HTML form with various inputs. Your task is to echo out the values passed by the form to itself (task1.php) via a GET request. What you are doing is called a callback. You are to display values within the provided section of the task1.php page:

To get full marks in this task the password must be hidden with the use of ‘#'. There is to be the same amount of ‘#' as characters in the password. For example:
Password = ########

Task 2
Within your practical-2.zip under the task-2 folder you have been given a file called task2.php. This file contains a HTML form with various inputs. Your task is to echo out the values passed by the form to itself (task2.php) via a POST request. What you are doing is called a postback. You are to display values within the provided section of the taks2.php page:

Note: notice the name of the checkboxes? sports[] this is to tell PHP to build an array with the data sent within the request for the parameter sports

Primitive Booking System
You will be building a primitive car booking system. This booking system uses a database to store all its information. Once you've completed you will be able to login and add new bookings and list all the bookings for the various cars available.
When working on these tasks all files are to be within the folder task-3-10.

Simple styling is applied to the initial form in task 3, this styling is the level of styling that is required for all your forms. Although the styling may be basic, the structure of your HTML documents should still be well thought out and formed.

Database Operations

The database schema is as follows:

413_figure.jpg

Connecting to the database
You have your own unique database. To log into your database you have to use a username and password. Your database name for Practical 2 is prac2_### with the ### being your TWA site number. For your username, it is your TWA username, however your password is twa###XX. The ### being your TWA site number and
the XX being the first two (2) characters of your TWA site password. For instance, your TWA site is twa999, and your password is abcd7890, this would mean your password would be twa999ab.
For these tasks you are to use the PHP mysqli extension - that is the MySQL Improved, do not confuse it with the general MySQL extension which is deprecated and should not be used! For reference to the mysqli extension and for all its capabilities please refer to https://php.net/manual/en/book.mysqli.php
Here is the sample code to connect to your database (using example user):

Listing data within your database
So you can see what is in the database there is a file in the task-3-10 folder called called listdata.php. This file, after you have placed your database username, password, and database name in the connection string, will list out all the data found within the database. This will allow you to see if you have successfully inserted data into the correct table and in the correct format.

Task 3
Within the task-3-10 you will have a file called adduser.php. This file already has a partial form created for one of the tables (user). Your task is to use this form to insert new users into the database table via PHP.

Be aware the type of user is a dropdown box and it is empty. It is your task to dynamically populate this field via PHP to insert the different types of users available from the user_type table. This drop down box cannot be hard coded as a foreign key to the user_type table is present.

As the page contains no validation initially, you are to provide validation through PHP. This means you will need to handle incorrect data (incorrect type, etc.). There are no specific rules on validation, for instance, the phone number needs to be 9 characters long and contain only numbers, but the form cannot fail if rogue data is entered. To ensure this, it would be best to refer to the database schema for the variable types and lengths needed for the available table fields. If the form is invalid you must present notifications to the user in line with the form element, similar to the error messages for practical set 1, but presented by PHP not Javascript.

You will notice when looking at the previous data that a user's password is very long. This is because it is hashed. Passwords should never be stored as plain text. Therefore, you will have to hash passwords. To do this you pass a string through a hash algorithm. This hashing is important, as it will set up other tasks you will complete. Here is a basic example on how to hash a string:

<?php
// A stored password
$password = 'password';
// PHP Hashing Method
$password = hash('sha256', $password);
echo $password;
// Prints out:
// 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8
?>

The following is an example of how to insert a record for the user_table into the database via PHP. Remember for this task you are not working with the user_table, you are working with the user table! Seeing how it can be done for the user_type table might help you understand how you would do it for the user table.

<?php
// We establish a connection to the database
$connection = new mysqli('localhost', 'root', 'password', 'prac2');
if($connection->connect_error) {
echo "Failed to connect to MySQL" . $connection->connect_error;
}
// Before inserting we should double check everything exists from the form
// The way you do this is up to you
if(isset($_POST['name'])) {
// We sanitise any input to prevent SQL injection
$name = $connection->real_escape_string($_POST['name']);
// We use an INSERT query to insert our data into the database
$result = $connection->query("INSERT INTO user_type (name) VALUES('$name')");
} else {
// Display error message maybe?
}

// Was the insertion successful?
if(!$result) {
echo $connection->error;
}
?>

Task 4
Create the forms for the remaining tables. You can use the format and style of the previous form. As you have created the adduser.php file, it means you have to create 3 more usertype.php, car.php, booking.php.
Hint: You can use a lot of the logic from task 3.

Task 5
As you now have multiple files, create a simple navigation menu somewhere on your pages so a user can navigate between each file.

Task 6
Create a new file called carbookings.php. You are to create a dropdown box of the available cars and when the dropdown box changes the page is updated showing a table of all the bookings for the selected car. It is to be when the dropbox changes not when a button is clicked, therefore there is no submit button on this page. The table is to have headers for each column which include the user's full name, car rego, pickup date time, expected return date time.

Task 7
Not everyone should have access to your site, therefore create a new file called index.php. This file will be your entry page to your booking system. It will welcome a user and have a login form that will consist of a username input, password input, and a login button. The username and password entered must match the username and password in the database. If a user fails to login they are to be presented with an error message regarding their incorrect login. Once matched they will be redirected to the carbookings.php file. For the existing users in the database their username and passwords are as follows:

[email protected] |password1 [email protected] | password2 [email protected] | password3 [email protected] | password4
Hint: This login needs to hash the entered password so that it can be compared to the hashed password in the database

Task 8
For each user listed when a car is selected within your carbookings.php page turn their name into a hyperlink so when clicked will go to the page userlisting.php showing the details of the user clicked. You can style the user details however you like, but they must be styled so they look user friendly.

Task 9
With the userlisting.php page you are to create a table giving a history of all the bookings a user has made. This table is to be presented below the user details and include the model, rego, year, booking pickup and return.

Task 10
A user cannot have access to any page, except index.php, without being logged in. If they arrive at a page and they have not logged in they will be redirected to the index.php page. For this you are to use a PHP session which will be created once they have successfully logged in. The session will be created in the index.php file and basic checking if the user is logged in should be present in all files to ensure the user is logged before they can access a page.

Attachment:- practical-2-files-rev1.zip

Verified Expert

Technologies used: HTML, CSS, Php, MySQL, a Php MySQL required to run this web scripting files.It was regarding how one can use get And post method in Php and how to encode or decode password in Php.How to write database connection code in Php using MySQL DB After creating a connection how Php application is going to interact with the database. Like- a selection of table record, inserting new records to table.Uses of session management.

Reference no: EM131373548

Questions Cloud

Develope a teaching plan for the patient : What are 2 ways tat a sympathomimetic drugs act to produce effects at adrenergic receptors? Give an example of each. You are caring for a 25 year old patient with a new order for epipen as needed for bee sting allergy. Develope a teaching plan for..
Confidence interval for proportion of users of solar energy : If this number was obtained based on a random sample of 8,000 electricity users, give a 95% confidence interval for the proportion of users of solar energy.
Confidence interval for population proportion of suitcase : If in a test of the Helium Fusion Expandable Suiter, 85 suitcases out of a sample of 100 randomly tested survived rough handling at the airport, give a 90% confidence interval for the population proportion of suitcases of this kind that would surv..
Determine the consolidated-undrained friction angle : If a consolidated-drained test is conducted on the clay specimen of Problem 12.17 with the same chamber-confining pressure of 150 kN/m2, what would be the deviator stress at failure?
Create a simple navigation menu : Technologies for Web Applications - create a simple navigation menu somewhere on your pages so a user can navigate between each file.
Which character most offers hope : Which character most offers hope that the feud between the Capulets and Montagues could end? In four to six sentences, explain your answer using examples from the play. Use proper spelling and grammar
Confidence interval for the proportion of defective devices : If a random sample of 52 devices yields 8 defectives, give a 98% confidence interval for the proportion of defective devices made by this machine.
Should more attention be paid to natural disaster management : What are the major issues that the U.S. government is facing in protecting its borders from illegal immigration and its citizens from domestic and foreign terrorist attacks? How have those issues been addressed?
Discuss three potential uses for recycled tires : Discuss three potential uses for recycled tires. From an energy perspective, why is it important that we continue to recycle tires?

Reviews

inf1373548

3/31/2017 5:02:23 AM

I have utilized this site for the most part to see different approaches to do what I have done as of now. It is constantly best quality work! The client administration is quick and very kind. They've made me a rehash client. A+ work. thanks for your support.

len1373548

1/28/2017 12:10:15 AM

Checkpoint 3 marks, consisting of one mark for Task 1, one mark from Task 2, and one mark for completing the dynamic dropdown box for task 3 If you fail to attend your checkpoint practical you will receive zero. At any time during the practical your name may be called out for marking the checkpoint. If you are not there when this happens you receive zero - even if you turn up to the practical late. The checkpoint is a formal assessment item; therefore, it is your responsibility to present your assessment when it is to be assessed for marking.

len1373548

1/28/2017 12:09:37 AM

3 marks, consisting of one mark for Task 1, one mark from Task 2, and one mark for completing the dynamic dropdown box for task 3 If you fail to attend your checkpoint practical you will receive zero. At any time during the practical your name may be called out for marking the checkpoint. If you are not there when this happens you receive zero – even if you turn up to the practical late. The checkpoint is a formal assessment item; therefore, it is your responsibility to present your assessment when it is to be assessed for marking. The marking is as follows: • Task 1: 1 mark if all requirements are implemented, 0 marks if less than 100% complete • Task 2: 1 mark if all requirements are implemented, 0 marks if less than 100% complete • Task 3 Dynamic Dropdown: 1 mark if all requirements for dynamic dropdown of user type are implemented, 0 marks if less than 100% complete

Write a Review

PHP Web Programming Questions & Answers

  Create a data structure containing a list of degree

Create a data structure containing a list of degrees available (i.e. PhD, MS, MA, BS, etc) and a price for each degree.

  Nbspassignment requires the development of a java-based

nbspassignment requires the development of a java-based client-server web application that supports the activities of

  Department of defense responsedepartment of health and

department of defense responsedepartment of health and human service responsedepart of energy responsebp vice president

  Discuss the apache web server in regard to cost

Discuss the Apache Web server in regard to cost, functionality, and compatibility. Are there certain implementations were it may not be suitable?

  Develop a catalogue of all of the stores information

Develop a catalogue of all of the stores' information about pets and accessories. In the first step, you are asked to create a sample catalogue including at least ten (10) different categories of pets and/or accessories using XML technologies.

  How many values are in a hexadecimal

How many values are in a hexadecimal? Hello students. I hope you are all doing well. Today you will practice finding shading and triadic complementaries.

  Create a data structure containing a list of degrees

Create a data structure containing a list of degrees available (i.e. PhD, MS, MA, BS, etc) and a price for each degree.

  Build a mysql database driven xhtml and php website

You are required to build a MySQL database driven XHTML and PHP website to manage online booking for free concerts. People who wish to attend a concert.

  Encryption and hashing

securing a new web server and a new web application, input validation, CSRF attack, SQL injection vulnerability, Cross Site Scripting (XSS) attack, architecture mechanism Linux, Apache, MySQL, and PHP,

  Follow the directions below to demonstrate your ability to

follow the directions below to demonstrate your ability to use one of the basic managerial planning tools swot

  Pastico corporation hears through the grapevine that its

pastico corporation hears through the grapevine that its employees are unhappy with the working conditions and wages

  Design database table required to store children information

Design the database tables required to store children and class information. In addition to the attributes, be sure to check the needed foreign keys and primary keys.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd