View on GitHub

CyberSecurity

A curriculum for a high school cyber security course.

PHP and SQL

Overview

In our last lesson we setup a SQL database, now we would like to access that information in the database on our website. We will create sites using PHP that can display information found in a SQL database.

Purpose

Modern websites use databases to store and manage information. We want to better understand the framework that makes the connection between a webpage and a database possible.

Objectives

Students will be able to:

Preparation

Vocabulary

Teaching Guide

Activity

Follow the guides on code academy for PHP and SQL.

Activity

Upload the ExampleForms.html and ExampleForms.php to your web server.

Verify that the information has been added to the database by logging into the MySQL server and typing select * from names;

Activity

Using a MySQL database in command line is not a very convenient way to see the info in a database. Upload the pullData.html & pullData.php documents to the server. Verify that they can display the contents of the database to a web page.

Discussion

Activity

Add the pullDataAdmin.html & pullDataAdmin.php documents to your project.

Activity

Add the contact.html, contact.php, and messages.php documents to your project.

Add a table to your mySQL database called messages with columns name, subject, message. Test to make sure the contact.html/php will post to the database and that messages.php will read messages.

Now type a message that has some HTML in it. What happens in the message viewing center? What happens if you type a message like < script > alert(“Surprise!”) < /script >?

Now, make this whole thing secure so we can’t do this type of injection and need a secure log in to see our messages.

Wrap-up

Assessment Questions

Extended Learninghttps://derekbabb.github.io/CyberSecurity/