Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Case Study Expert

Lab: LAMP Apps

Overview

This lab walks you through using Linux, Apache, MySQL and PHP (LAMP) to create simple, yet very powerful PHP applications connected to a MySQL database. For developers using Windows, the acronym becomes WAMP (Linux is replaced by Windows). The basics of inserting, updating, deleting and selecting from MySQL using PHP forms will be provided. Some "bad" security practices that lead to SQL injection vulnerabilities will be exposed as well as some techniques to mitigate these issues.

Learning Outcomes:

At the completion of the lab you should be able to:

1. Insert data into a MySQL database using PHP forms
2. Query existing data in a MySQL database using PHP forms
3. Delete data from a MySQL database using PHP forms
4. Update data in a MySQL database using PHP forms

Lab Submission Requirements:

After completing this lab, you will submit a word (or PDF) document that meets all of the requirements in the description at the end of this document. In addition, your LAMP application and all associated files should be submitted.

Virtual Machine Account Information

Your Virtual Machine has been preconfigured with all of the software you will need for this class. The default username and password are:

Username : umucsdev Password: umuc$d8v

MySQL Username: sdev_owner MySQL password: sdev300 MySQL database: sdev

Part 1 - Insert data into a MySQL database using PHP forms

In this exercise we will create a small table in MySQL and then use a PHP form to insert collected from the user into the form. We will first use a technique very susceptible to SQL injection and then a better approach using prepared statements.

1. Assuming you have already launched and logged into your SDEV32Bit Virtual Machine (VM) from the Oracle VirtualBox, pen up the terminal by clicking on the terminal icon.

2. To start the MySQL database type the following the terminal prompt: mysql -u sdev_owner -p

When prompted for the password enter sdev300

3. To display the available databases type the following at the mysql prompt: show databases;

4. The database we will be using for this course is sdev. To use this database, type the following at the mysql prompt:
use sdev;

5. To display the current tables in the sdev database, type the following command at the mysql prompt:
show tables;

You may already have some tables in your database. If so, the names of those tables would be displayed. If not, you would see Empty set as illustrated above.

6. Create a Students table in the SDEV database, if one does not already exist:
use sdev;

// Create a student table CREATE TABLE Students (
tychoName varchar(30) primary key, firstName varchar(30),
lastName varchar(30), eMail varchar(60)
);

7. Next, we will create the PHP code that will provide an HTML form and response for entering data into the database table from the form. Type, or copy and paste from the code examples, the following code into your text editor and save as InsertApp.php. This code has many components including the use of PHP classes, reading parameters from files and other functionality. The code is relative long and may take some experimentation and analysis for full understanding. You should review and tinker with all aspects of the code to become comfortable with the functionality.

8. To run the code place the file in a week7 folder in the appropriate location on your VM and launch it. Note: Be sure to create a parms folder and place the dbparms.txt file in the folder or your application will not connect to the database.

9. Add an entry to verify a student was successfully entered.

10. Note the following code is assuming you have honest users.

11. Replace this with a prepared statements to help mitigate the SQL injection in the insertStudent function:

12. Note the bind statement is using "ssss" representing 4 strings. Other options include i for integer and d for double. We will use the prepared statement in the remaining examples.

Attachment:- Lab_LampApps.pdf

Case Study, Writing

  • Category:- Case Study
  • Reference No.:- M91866845

Have any Question?


Related Questions in Case Study

Factors related to medicationsocial workers are often asked

Factors Related to Medication Social workers are often asked about the role of medications. What are some potential risks and rewards of using medications to treat the problems of living versus mental illness? Think abou ...

Clapham rail disastercritical analysis of disaster

Clapham Rail Disaster Critical analysis of disaster event Critical analysis of disaster response Recommendations for improving the effectiveness of response Linkage of disaster response to professional role

Case analysis approachmethodology objectivesthe purpose of

Case Analysis Approach/Methodology Objectives The purpose of the oral presentation or written case analysis is to demonstrate that you can: Apply the theories and concepts of organizational behavior correctly to the spec ...

Question - a colleague reaches out to you requesting

Question - A colleague reaches out to you requesting information on a client. You do not have a lot of information, as you have only interviewed the client one time. They are working with the client's spouse, who is also ...

Rationalesafety and risk management are critical aspects of

Rationale Safety and Risk Management are critical aspects of a workplace and breaches are punishable under Work Health and Safety Law. This task encourages students to analyse and conceptualise responses to safety breach ...

This paper will consist of an ethical analysis of the bp

This paper will consist of an ethical analysis of the BP oil spill. There is one source provided to start this research, cite at least four other sources. This source has a particular case because it has an interesting a ...

Case study 1case study exxon mobil - stewardship leadership

Case Study 1 Case study: Exxon Mobil - stewardship, leadership, corporate social responsibility (refer to p. 229, Tricker, 2015) Discussion questions 1. Should the company keep its focus on its mission of ‘developing mor ...

Answer the questions using volkswagen group- write on this

Answer the questions using Volkswagen Group- write on this topic Case Assignment Please select a company from among the ones listed below (see Articles for Case Assignment) or else select an organization of choice facing ...

Physiology signature assignmentfor your signature

Physiology: Signature Assignment For your signature assignment, compose a 3- to 4-page case analysis (in addition to a title, abstract, and a reference page) written in APA format with at least 3 references, with one non ...

Fever case study -elena is a 74-year-old hispanic f who was

Fever Case Study - Elena is a 74-year-old Hispanic F who was recently discharged one week ago from a local rehabilitation center after status post left hip replacement (one month ago). Negative for any complications. PMH ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As