Chapter 2: Understanding and Avoiding Security Risks
Identifying the Sources of Risk
Minimizing User-Input Risks
Not Revealing Sensitive Information
Summary
Chapter 3: PHP Best Practices
Best Practices for Naming Variables and Functions
Best Practices for Function/Method
Best Practices for Database
Best Practices for User Interface
Best Practices for Documentation
Best Practices for Web Security
Best Practices for Source Configuration Management
Summary
Part II
Chapter 4: Architecture of an Intranet Application
Understanding Intranet Requirements
Building an Intranet Application Framework
Creating a Database Abstraction Class
Creating an Error Handler Class
Creating a Built-In Debugger Class
Creating an Abstract Application Class
Creating a Sample Application
Summary
Chapter 5: Central Authentication System
How the System Works
Creating an Authentication Class
Creating the Central Login Application
Creating the Central Logout Application
Creating the Central Authentication Database
Testing Central Login and Logout
Making Persistent Logins in Web Server Farms
Summary
Chapter 6: Central User Management System
Identifying the Functionality Requirements
Creating a User Class
User Interface Templates
Creating a User Administration Application
Creating a User Password Application
Creating a Forgotten-Password Recovery Application
Summary
Chapter 7: Intranet System
Identifying Functionality Requirements
Designing the Database
Designing and Implementing the Intranet Classes
Setting Up Application Configuration Files
Setting Up the Application Templates
Intranet Home Application
Installing Intranet Applications from the CD- ROM
Testing the Intranet Home Application
Summary
Chapter 8: Intranet Simple Document Publisher
Identifying the Functionality Requirements
The Prerequisites
Designing the Database
The Intranet Document Application Classes
Setting up Application Configuration Files
Setting Up the Application Templates
The Document Publisher Application
Installing Intranet Document Application
Testing Intranet Document Application
Summary
Chapter 9: Intranet Contact Manager
Functionality Requirements
Understanding Prerequisites
The Database
The Intranet Contact Manager Application Classes
The Application Configuration Files
The Application Templates
The Contact Category Manager Application
The Contact Manager Application
Installing Intranet Contract Manager
Testing Contract Manager
Summary
Chapter 10: Intranet Calendar Manager
Identifying Functionality Requirements
Understanding Prerequisites
Designing the Database
The Intranet Calendar Application Event Class
The Application Configuration Files
The Application Templates
The Calendar Manager Application
The Calendar Event Manager Application
Installing the Event Calendar on Your Intranet
Testing the Event Calendar
Summary
Chapter 11: Internet Resource Manager
Functionality Requirements
Understanding the Prerequisites
Designing the Database
Designing and Implementing the Internet Resource Manager Application Classes
Creating Application Configuration Files
Creating Application Templates
Creating a Category Manager Application
Creating a Resource Manager Application
Creating a Resource Tracking Application
Creating a Search Manager Application
Installing an IRM on Your Intranet
Testing IRM
Security Concerns
Summary
Chapter 12: Online Help System
Functionality Requirements
Understanding the Prerequisites
Designing and Implementing the Help Application Classes
Creating Application Configuration Files
Creating Application Templates
Creating the Help Indexing Application
Creating the Help Application
Installing Help Applications
Testing the Help System
Security Considerations
Summary
Part III
Chapter 13: Tell-a-Friend System
Functionality Requirements
Understanding Prerequisites
Designing the Database
Designing and Implementing the Tell- a- Friend Application Classes
Creating Application Configuration Files
Creating Application Templates
Creating the Tell-a-Friend Main Menu Manager Application
Creating a Tell-a-Friend Form Manager Application
Creating a Tell-a-Friend Message Manager Application
Creating a Tell-a-Friend Form Processor Application
Creating a Tell-a-Friend Subscriber Application
Creating a Tell-a-Friend Reporter Application
Installing a Tell-a-Friend System
Testing the Tell-a-Friend System
Security Considerations
Summary
Chapter 14: E-mail Survey System
Functionality Requirements
Architecture of the Survey System
Designing the Database
Designing and Implementing the Survey Classes
Designing and Implementing the Survey Applications
Developing Survey Execution Manager
Setting Up the Central Survey Configuration File
Setting Up the Interface Template Files
Testing the Survey System
Security Considerations
Summary
Chapter 15: E-campaign System
Features of an E-campaign System
Architecting an E-campaign System
Designing an E-campaign Database
Understanding Customer Database Requirements
Designing E-campaign Classes
Creating Common Configuration and Resource Files
Creating Interface Template Files
Creating an E-campaign User Interface Application
Creating a List Manager Application
Creating a URL Manager Application
Creating a Message Manager Application
Creating a Campaign Manager Application
Creating a Campaign Execution Application
Creating a URL Tracking and Redirection Application
Creating an Unsubscription Tracking Application
Creating a Campaign Reporting Application
Testing the E-Campaign System
Security Considerations
Summary
Part IV
Chapter 16: Command-Line PHP Utilities
Working with the Command-Line Interpreter
Building a Simple Reminder Tool
Building a Geo Location Finder Tool for IP
Building a Hard Disk Usage Monitoring Utility
Building a CPU Load Monitoring Utility
Summary
Chapter 17: Apache Virtual Host Maker
Understanding an Apache Virtual Host
Defining Configuration Tasks
Creating a Configuration Script
Developing makesite
Installing makesite on Your System
Testing makesite
Summary
Chapter 18: BIND Domain Manager
Features of makezone
Creating the Configuration File
Understanding makezone
Installing makezone
Testing makezone
Summary
Part V
Chapter 19: Web Forms Manager
Functionality Requirements
Understanding Prerequisites
Designing the Database
Designing and Implementing the Web Forms Manager Application Classes
Creating the Application Configuration Files
Creating Application Templates
Creating the Web Forms Submission Manager Application
Creating the Web Forms Reporter Application
Creating the CSV Data Exporter Application
Installing the Web Forms Manager
Testing the Web Forms Manager
Security Considerations
Summary
Chapter 20: Web Site Tools
Functionality Requirements
Understanding Prerequisites
Designing the Database
Designing and Implementing the Voting Tool Application Class
Creating the Application Configuration Files
Creating the Application Templates
Creating the Vote Application
Installing the Voting Tool
Testing the Voting Tool
Summary
Part VI
Chapter 21: Speeding Up PHP Applications
Benchmarking Your PHP Application
Buffering Your PHP Application Output
Compressing Your PHP Application Output
Caching Your PHP Applications
Summary
Chapter 22: Securing PHP Applications
Controlling Access to Your PHP Applications
Securely Uploading Files
Using Safe Database Access
Recommended php.ini Settings for a Production Environment
Limiting File System Access for PHP Scripts
Running PHP Applications in Safe Mode
Summary
Part VII
Appendix A: What's on the CD-ROM
System Requirements
What's on the CD
Troubleshooting
Appendix B: PHP Primer
Object-Oriented PHP
Appendix C: MySQL Primer
Using MySQL from the Command- Line
Using phpMyAdmin to Manage MySQL Database
Appendix D: Linux Primer
Installing and Configuring Apache 2.0
Installing and Configuring MySQL Server
Installing and Configuring PHP for Apache 2.0
Common File/Directory Commands
Index
Wiley Publishing, Inc. End-User License Agreement
Nội dung
Security Concerns Now you have a set of intranet applications that allow you to add/modify/delete Internet site resources. Since these applications are run from your intranet they are only accessible to your intranet users who must authenticate using the central authentication system developed in Chapter 5. However, if you needed to restrict access to these applications even further using some other special schema such as IP subnet or time, you can incorporate such custom authorization requirements in the authorize() methods for each of these applications. Summary In this chapter, you learned to create an Internet Resource Manager for your intranet. This application allows users to organize the resources on a shareable and searchable central database. Chapter 11: Internet Resource Manager 401 14 549669 ch11.qxd 4/4/03 9:25 AM Page 401 14 549669 ch11.qxd 4/4/03 9:25 AM Page 402 Chapter 12 Online Help System IN THIS CHAPTER ◆ Developing an online help system ◆ Installing an online help system ◆ Using an online help system HAVING ONLINE HELP with your Web or intranet applications can be a great blessing, because it may reduce user support calls and, therefore, cost. In this chapter, you’ll develop an online help system that can be used for any of the Web or intranet appli- cations developed in this book. First, let’s look at the functionality you want the help system to offer. Functionality Requirements The help system will offer the following features. ◆ Structured help contents: The system will assume a structured help con- tent design where help for an application will be divided into sections. Each section will be represented with one or more HTML pages, which may or may not have embedded images. Each section will have a number like x.y.z where x is the section number, y is the second level subsection number, and z is the third level subsection number. For example, 1.0.0.html, 1.1.0.html, and 1.1.1.html are pages for section 1. The images for all the help contents will be stored in an images directory. ◆ Automatic table of contents page: The system should generate the table of contents page automatically. This feature is very good to have because you can then add or remove sections. ◆ Automatic navigation: The system should generate automatic navigation links from section to section and also have a link to the table of contents from each page. 403 15 549669 ch12.qxd 4/4/03 9:26 AM Page 403 ◆ Keyword search: The system will allow keyword-based searches using the logic operators AND and OR. ◆ Template-based interface: The system should support a central help tem- plate to display help pages but also allow individual sections to have their own templates to alter the look and feel of the help as needed. Understanding the Prerequisites The help system requires the application framework classes that were discussed in Chapter 4. You must have the application framework classes along with PHPLIB and PEAR packages installed. Designing and Implementing the Help Application Classes As shown in the system diagram, Figure 12-1, there is one new object, Help object, which is needed to implement the online help system. Figure 12-1: The help system diagram. Here you will develop the class that will provide the help object for the online help applications. Designing and implementing the Help class The Help class is used by all help applications. It allows help applications to display, search, and index help contents. The ch12/apps/class/class.Help.php file on the CD-ROM implements this class. This class implements the following methods. Help Application Make Index Application PHP Application Framework Help Applications Help Object class.Help.php 404 Part II: Developing Intranet Solutions 15 549669 ch12.qxd 4/4/03 9:26 AM Page 404 Help() This is the constructor method. It works as follows: ◆ It sets the object variable _APP to the given application name. The name of the application for which help will be displayed is passed to this method using the $params[‘app’] parameter. ◆ It sets the object variable _MAP to the given application’s map file name. The name of the map file that will be used to locate help contents for the current application is passed to this method using the $params[‘map’] parameter. ◆ The object variable _FORCE is set using the $params[‘force’] parameter, which indicates if the help index should be forcefully created again even if the current index is up to date. ◆ The object variable _OPERATORS is set to an array of two logical operators: OR and AND. These are the logical operators that are supported in keyword search operations. ◆ The object variable _LOADED is set to false, which indicates that the object has not yet loaded the help map information from the named map file. ◆ If the application for which help contents is to be displayed, searched, indexed is named (that is, $this->_APP is set) and the map file name is given (that is, $this->_MAP is set), then the method calls the loadMap() method to load the map information for the named application. The map file contains help contents information for the named application. getApp() This method returns the value of the _APP object variable, which is the name of the application for which the help object is to display, search, or index the help contents. getRelHelpDir() This method returns the relative help directory path stored in the _REL_HELP_DIR object variable, which is set in the loadMap() method. getSectionContents() This method returns the contents of a section of the help contents. The section num- ber is passed as a parameter ($section) to this method. The contents are stored in a hash called $contents. It works as follows: ◆ The $contents[‘output’] is set to show_section, which indicates to the help display application (help.php) that it needs to show the help content for a given section. ◆ A local variable called $tocLink is created to store the table of contents link. The table of contents link is simply the path to the help application Chapter 12: Online Help System 405 15 549669 ch12.qxd 4/4/03 9:26 AM Page 405 . The ch12/apps/class/class.Help .php file on the CD-ROM implements this class. This class implements the following methods. Help Application Make Index Application PHP Application Framework Help. classes that were discussed in Chapter 4. You must have the application framework classes along with PHPLIB and PEAR packages installed. Designing and Implementing the Help Application Classes As shown. Application Make Index Application PHP Application Framework Help Applications Help Object class.Help .php 404 Part II: Developing Intranet Solutions 15 549669 ch12.qxd 4/4/03 9:26 AM Page 404 Help() This