Monday, 30 April 2012 18:23

CIS 214 Final Exam Study Guide

Written by Robert Gallegos
Rate this item
(0 votes)

CIS 214 Final Exam Study Guide

Know the following:

1.      The ALTER statement is used to change the structure of a MySQL database table, such as adding a new column of data.

2.      With a little help from PHP and MySQL, an HTML <input> tag can be used to upload image files.

3.      The superglobal variable $_FILES is where PHP stores information about an uploaded file.

4.      The standard PHP function move_uploaded_ file() allows you to move files around on the web server and is critical for handling uploaded files.

5.      Most web applications benefit from having an images folder for storing images used by the application, especially those uploaded by users.

6. PHP scripts can use headers to control how the server delivers web content to the browser.

7. The built-in PHP header() function is used to send headers to the browser, which can be used to redirect a page, control the content type of a page, or request the authentication of a page.

8. When headers are sent to the browser using the header() function, calls to the header() function must come before any other content is sent.

9. When a page is protected using HTTP authentication, the user name and password entered by the user are stored in the $_SERVER superglobal.

10. The “basic realm” of an HTTP authentication is a security zone that gets associated with a specific user name and password, allowing multiple pages to be secured together.

11.  The built-in PHP exit() function exits a PHP script, preventing any code following it from being executed or otherwise sent to the browser.

12.  All web forms are at risk of attack from spam bots, but all spam bots are at risk from clever PHP programmers who use techniques such as CAPTCHA to thwart them.

13.  GD is a standard PHP graphics library that allows you to dynamically create images and then draw all kinds of different graphics and text on them.

14.  The createtruecolorimage() GD function is used to create a blank image for drawing.

15.  To output a PNG image to the browser or to a file on the server, call the imagepng() GD function.

16.  When you’re finished working with an image, call imagedestroy() to clean up after it.

17.  preg_match() locates matches for patterns in strings.

18.  preg_replace() changes matching strings.

19.  Quantifiers allow you to control how many times a character or set of characters can appear in a row.

20.  You can specify a set of characters to allow in your pattern using a character class.

21.  In your pattern, \d, \w, and \s are standins for digits, alphanumeric characters, and whitespace, respectively.

22.  checkdnsrr() checks the validity of domain names.

23.    HTTP authentication is handy for restricting access to individual pages, but it doesn’t offer a good way to “log out” a user when they’re finished accessing a page.

24.    Cookies let you store small pieces of data on the client (web browser), such as the log-in data for a user.

25.    All cookies have an expiration date, which can be far into the future or as near as the end of the browser session.

26.    To delete a cookie, you just set its expiration to a time in the past.

27.    Sessions offer similar storage as cookies but are stored on the server and, therefore, aren’t subject to the same browser limitations, such as cookies being disabled.

28.    Session variables have a limited lifespan and are always destroyed once a session is over (for example, when the browser is closed).

  1. A database is a container for storing data in a highly structured manner.
  1. Tables store data in a grid-like pattern of columns and rows within a database.
  1. The CREATE DATABASE SQL command is used to create a new database.
  1.  The CREATE TABLE SQL command creates a table within a database and requires detailed information about the columns of data within the table.
  1. You can delete a table from a database with the DROP TABLE SQL command.
  1. The mysqli_fetch_array() function retrieves a row of data from the results of a database query.
  1.  A while loop repeats a chunk of PHP code while a test condition is met.
  1. Database connections need a location, a username, a password, and a database name.
  1. The mysqli_connect() function creates a connection between your PHP script and the MySQL database server.
  1. The die() function exits the script and returns feedback if your connection fails.
  1. Issuing an SQL query from PHP code involves assembling the query in a string and then executing it with a call to mysqi_query().
  1. Call the mysqli_close() function to close a MySQL database.

Vocabulary words to match:

  1. MySQL
    An application that lets you store data in databases and tables and insert and retrieve information using the SQL language.
  1. SQL
    A query language for interacting with database applications like MySQL.
  1. PHP
    A server-side scripting language that lets you manipulate web page content on the server before a page is delivered to the client browser.
  1. PHP script
    A text file that contains PHP code to carry out tasks on a web server.
  1. array
    A data structure that stores a set of values. Each value has an index that you can use to access it.
  1. echo
    The PHP command for sending output to the browser window.
  1. while
    A PHP looping construct that allows you to repeat a section of code as long as a certain condition remains true. One particularly handy usage of the while loop is in looping through rows of data in an SQL query result.
  1. if, else
    The PHP if statement makes decisions based on whether or not something is true. Give it a true/false test condition and some action code, and an if statement will let you make all kinds of cool decisions. An else clause can be added to an if statement to give it an alternate action.
  1. Image folder
    This folder provides a convenient location to store images for an application, including images that were uploaded by users.

  2. header()
    This built-in PHP function is used to send a header from the server to the browser, allowing you to perform tasks such as redirecting the page, specifying a certain content type, or carrying out HTTP authentication.
  1. Form Validation
    The process of checking all of the data entered by a user into a form to ensure that it is in the expected format. In addition to making forms easier to use, validation can help make web applications more secure by not allowing users to enter bad data.
  1. setcookie()
    This built-in PHP function is used to set a cookie on the browser, including an optional expiration date, after which the cookie is destroyed. If no expiration is provided, the cookie is deleted when the browser is closed.
  1. ASname
    This SQL statement establishes an alias, which is a name used to identify a piece of data within a query. Aliases are often used to simplify queries by shortening long table and column names. They can also be used to rename result data when the original table column isn’t specific enough.
  1. Custom function
    A chunk of PHP code organized into a named, reusable package. The idea is to isolate code that performs a certain task so that it can be reused with minimal effort and code duplication.
  1. Character class
    A set of rules for matching a single character within a regular expression. For example, [A-D] matches the characters A, B, C, or D.
    A program that protects a web site from automated spam bots by using a test of some sort. For example, a CAPTCHA test might involve discerning letters within a distorted pass-phrase, identifying the content of an image, or analyzing an equation to perform a simple mathematical computation.
  1. RSS
    An XML-based language used to store syndicated content, such as news stories. RSS allows web sites to make their data available to other applications and web sites for syndication, and allows you to take advantage of data made available by other sites.
  1. XML
    A generic markup language used to provide a predictable structure to data. There are many different markup languages built from XML, such as XHTML and RSS. The idea is that you create a set of tags specific to whatever data you’re storing as XML.
  1. Namespace
    A way of organizing a set of XML tags into a logical group, sort of like how your last name organizes your family into a named group. A namespace is always associated with a URL, which ensures uniqueness among all other namespaces.
  1. REST
    A means of accessing information on the web purely through URLs. REST allows you to make powerful data requests simply by creating a URL. Such requests are often referred to as “RESTful” requests.

Answer the following question.

  1. Describe how you would use phpMyAdmin (or MySQL terminal) to create/edit MySQL database tables.

    Two popular MySQL tools are the MySQL terminal and phpMyAdmin. Both tools let you issue SQL commands to create databases and tables, insert data, select data, etc., but phpMyAdmin goes a step further by also providing a point-and-click web-based interface.