The Winestore Include Files

The winestore include files are shown in Example 10-6, Example 10-7, and Example 10-8. The include file in Example 10-6 and the include file in Example 10-8 are both included in the file in Example 10-7.

Example 10-6 shows the file that lists the DBMS credentials for connecting to the winestore database. The settings must be changed for a local installation of the winestore application.

Example 10-6. The include file

  $hostName = "localhost";
  $databaseName = "winestore";
  $username = "fred"; 
  $password = "shhh";

The include file stores the DBMS and database credentials to access the online winestore. The hostName setting is the server name of the DBMS, the databaseName setting is the winestore database name, and the username and password are those used to access the MySQL DBMS. This file is identical to Example 4-7 and is discussed in Chapter 4.

The file shown in Example 10-7 stores the common function used throughout the winestore application.

Example 10-7. The file

<?php // This file contains functions used in more than // one script in the cart module include ''; include ''; // Untaint user data function clean($input, $maxlength) { $input = substr($input, 0, $maxlength); $input = EscapeShellCmd($input); return ($input); } // Print out the varieties for a wineID function showVarieties($connection, $wineID) { // Find the varieties of the current wine, // ...

Get Web Database Applications with PHP, and MySQL now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.