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
Also, any user viewing this document can post comments by clicking on the Post Comments link, which shows a Web form as shown in Figure 8-12. Figure 8-12: Adding feedback comments to published documents. The posted comments appear along with document. Any other user can view the posted comment by clicking on the comment title shown in the Feedback section of the document, as shown in Figure 8-13. Figure 8-13: A document with posted user feedback comments. Chapter 8: Intranet Simple Document Publisher 291 11 549669 ch08.qxd 4/4/03 9:25 AM Page 291 When you add a new category, the category name appears in the horizontal nav- igation bar. The number of categories shown per row is controlled in ld.conf using define(‘CAT_PER_LINE’, 5) settings. To show more than five categories per nav- igation line in the horizontal top navigation, modify this setting. Figure 8-14 shows how multiple categories are shown in the user’s home page using the horizontal navigation bar. When you delete a category, the navigation file is automatically updated. Also, deleting a category deletes all the documents in that category. Figure 8-14: The user’s home page with multiple document categories. Summary In this chapter, you learned to create a simple document publishing system for your intranet. This system enables you to create categories and store documents within each category. The categories and documents are all stored in a database. You can extend this basic document publishing system to incorporate fancy features such as images, attachments, and so on. 292 Part II: Developing Intranet Solutions 11 549669 ch08.qxd 4/4/03 9:25 AM Page 292 Chapter 9 Intranet Contact Manager IN THIS CHAPTER ◆ Developing an intranet contact manager ◆ Installing an intranet contact manager ◆ Using an intranet contact manager EVERY OFFICE HAS A LIST OF contacts for vendors, customers, news/print/trade media, and so forth. These contacts are often managed in individual address books or in personal digital assistants (PDAs). In this chapter, you’ll develop an intranet contact manager system that enables administrative users in the office to store any type of contact in a central contact database. All users can search the contact data- base without needing to move from their desk. Functionality Requirements The contact manager will have the following features: ◆ Central contact database: The database stores all contacts in a central back-end database, which can be backed up at any time by the system administrator. ◆ Contact category hierarchy: Each contact must be stored in a subcategory of a category. Only one-level subcategories are allowed. For example, a category called Vendors can have multiple one-level subcategories such as Telecommunication Vendors, Office Suppliers, Hardware Vendors, Food Suppliers, and so forth. In this version of the contact manager, a contact can only belong to a single category. ◆ Contact management by administrative staff only: The contact manager allows administrative users to add, modify, and delete contacts and categories. ◆ Search interface for everyone: Each administrative or regular user must be allowed to search the contacts stored in the database. 293 12 549669 ch09.qxd 4/4/03 9:25 AM Page 293 ◆ Automatic reminders: When adding or modifying a contact, the adminis- trator can set up reminders for future meeting/calls with the contact that will be shown via the intranet messaging interface when appropriate. ◆ Easy e-mail interface: Administrative users should be able to send e-mails to contacts by clicking on the contact e-mail address. The e-mail sent to the contact should be stored in the contact manager system, so that later the user can review the messages she sent to a contact. This is a good feature for lead management. For example, a user can add a new lead to the contact database, send an e-mail, and then pull up the e-mail from the contact database later when the lead calls or responses via email. Because the e-mail sent is stored with the central contact database, which can be very useful if a lead should call while the original user is unavail- able, another administrator could easily pull up the lead’s information and cover the situation (and the lead will feel very important because “everyone” in the company happens to know about the previous communications). Understanding Prerequisites This intranet contact manager system builds on the intranet classes discussed in Chapters 5, 6, and 7. The applications that we develop here require the intranet central login/logout, user management, and home applications discussed in those earlier chapters. Administrative intranet users, who are defined in the intranet user table discussed in Chapter 6, are given full access to all aspects of the contact management tool. Let’s look at the database design and implementation needed for creating this intranet contact management system. The Database Figure 9-1 shows the database diagram for the contact manager. The central table in this database is the CONTACT_INFO table, which stores the contact data. The CONTACT_CATEGORY table, which stores category information, has a one to many relationship with CONTACT_INFO since a category can have many contacts. Similarly the CONTACT_INFO table has a one to many relationship with the CONTACT_KEYWORD table. The latter stores one or more keywords per contact. The CONTACT_INFO table also has a one to many relationship with the CONTACT_ REMINDER table, which stores reminders, and with the CONTACT_MAIL table, which stores emails sent to contacts. 294 Part II: Developing Intranet Solutions 12 549669 ch09.qxd 4/4/03 9:25 AM Page 294 Figure 9-1: Contact manager database diagram. Table 9-1 describes the details of the database tables. TABLE 9-1 [NAME OF DATABASE] DATABASE TABLES Table Description CONTACT_CATEGORY This table holds the category ID (CAT_ID), category name ( CAT_NAME), category description (CAT_DESC), and category parent ( CAT_PARENT). The category number ( CAT_ID) is automatically generated by the database. CONTACT_INFO Contains the contact information: the contact ID ( CONTACT_ID), category ID (CAT_ID), contact first name ( CONTACT_FIRST), contact middle initial ( CONTACT_INITIAL), contact last name ( CONTACT_LAST), contact e-mail (EMAIL), phone number ( PHONE), fax (FAX), Web site URL (URL), company name ( COMPANY_NAME), company address ( COMPANY_ADDRESS), home address (HOME_ADDRESS), source ( SOURCE), reference (REFERENCE), and a check flag ( FLAG). The contact ID (CONTACT_ID) is automatically generated by the database. Since we are not allowing company or home address to be searchable in this version of contact manager, these fields are kept as text fields. Also, the source field is used to identify who provided the contact and reference field is used to identify who referred the contact. Continued Chapter 9: Intranet Contact Manager 295 12 549669 ch09.qxd 4/4/03 9:25 AM Page 295