1. Trang chủ
  2. » Công Nghệ Thông Tin

Secure PHP Development- P111 docx

5 156 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Cấu trúc

  • Secure PHP Development

    • Front Matter

      • Preface

        • Is This Book for You?

        • How This Book Is Organized

        • Tell Us What You Think

      • Acknowledgments

      • Contents at a Glance

      • Contents

    • Part I

      • Chapter 1: Features of Practical PHP Applications

        • Features of a Practical PHP Application

        • Employing the Features in Applications

        • Summary

      • 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

Creating a Campaign class The purpose of this class is to provide the Campaign object, which is needed to manipulate the campaign. An implementation of this class can be found in ch15/ apps/class/class.EcampaignCampaign.php file in the CDROM. This class imple- ments the methods discussed in the following sections. EcampaignCampaign() This method sets the member variable, ecampaign_tbl, to the $ECAMPAIGN_TBL configuration variable. The member variable, dbi, is set to $dbi, which is passed from the application. This method also sets the current campaign ID using the setCampaignID() method. setCampaignID() This method sets the current campaign ID to the campaign ID supplied. If no cam- paign ID is supplied as a parameter, the current campaign ID is returned. getCampaignInfo() This method returns campaign information about a given campaign or the current campaign. getAvailableCampaigns() This method returns the list of campaigns from the e-campaign database. The returned associative array is keyed with the campaign ID (CAMPAIGN_ID), and the values are set to campaign name (NAME). addCampaign() This method adds a campaign in the e-campaign database. deleteCampaign() This method deletes a campaign from the e-campaign database. modifyCampaign() This method updates a campaign in the e-campaign database. Creating a URL Tracking class The purpose of this class is to provide the URL Track object, which is needed to manipulate the URL track information. An implementation of this class can be found in ch15/apps/class/class.EcampaignTrack.php file in the CDROM. This class implements the methods discussed in the following sections. Chapter 15: E-campaign System 521 19 549669 ch15.qxd 4/4/03 9:26 AM Page 521 EcampaignTrack() This is the constructor method that sets a member variable, track_tbl, to e-campaign configuration variable $ECAMPAIGN_TRACK_TBL, which holds the URL track table name. This method also sets another member variable, dbi, to the DBI ($dbi) object, which is passed from the application. storeTrack() This method stores a URL track record in the URL track table. Creating an Unsubscription Tracking class The purpose of this class is to provide the Unsubscription Track object, which is needed to manipulate the unsubscription track information. An implementation of this class can be found in ch15/apps/class/class.EcampaignUnsub.php. This class implements the methods discussed in the following sections. EcampaignUnsub() This is the constructor method that sets a member variable, unsub_tbl, to $ECAMPAIGN_UNSUB_TBL, which is an ecampaign.conf configuration variable set to hold the unsubscription table name. This method also sets another member vari- able, dbi, to the DBI ($dbi) object, which is passed from the application. storeUnsub() This method stores an unsubscription record in the unsubscription track table. Creating a Report class The purpose of this class is to provide the Report object, which is needed to manip- ulate the report information. An implementation of this class can be found in ch15/apps/class/class.EcampaignReport.php file in the CDROM. This class implements the methods discussed in the following sections. EcampaignReport() This constructor method sets member variables ecampaign_tbl, track_tbl, unsub_tbl, and bounced_tbl to e-campaign configuration variables $ECAMPAIGN_ TBL , $ECAMPAIGN_TRACK_TBL, $ECAMPAIGN_UNSUB_TBL, and $ECAMPAIGN_BOUNCED_ TBL , respectively. The member variable, dbi, is set to the DBI object ($dbi), which is passed as a parameter from an application. Another member variable, campaign_id, is set to the campaign ID passed as a parameter from an application creating the report object. 522 Part III: Developing E-mail Solutions 19 549669 ch15.qxd 4/4/03 9:26 AM Page 522 setEcampaignCampaignID() This method sets the current campaign ID to the campaign ID parameter if it is not null and returns the current campaign ID. getURLResponse() This method returns URL click-through count for each tracked URL in a campaign. getUnsubResponse() This method returns the total unsubscription track for a campaign. getBounceResponse() This method returns the total number of immediate bounces for a given campaign. Creating Common Configuration and Resource Files Like all other applications you’ve developed in this book, the e-campaign applica- tions also use a standard set of configuration, message, and error files. These files are discussed in the following sections. Creating an e-campaign configuration file The primary configuration file for the entire e-campaign system is called ecampaign.conf, which can be found in ch15/apps directory in the CDROM. Table 15-2 discusses each configuration variable. TABLE 15-2 ecampaign.conf VARIABLES Configuration Variable Purpose $PEAR_DIR Set to the directory containing the PEAR package; specifically the DB module needed for class.DBI.php in the application framework. $PHPLIB_DIR Set to the PHPLIB directory, which contains the PHPLIB packages; specifically the template.inc package needed for template manipulation. $APP_FRAMEWORK_DIR Set to the application framework directory. Continued Chapter 15: E-campaign System 523 19 549669 ch15.qxd 4/4/03 9:26 AM Page 523 TABLE 15-2 ecampaign.conf VARIABLES (Continued) Configuration Variable Purpose $PATH Set to the combined directory path consisting of the $PEAR_DIR, the $PHPLIB_DIR, and the $APP_FRAMEWORK_DIR. This path is used with the ini_set() method to redefine the php.ini entry for include_path to include $PATH ahead of the default path. This allows PHP to find the application framework, PHPLIB, and PEAR-related files. $AUTHENTICATION_URL Set to the central login application URL. $LOGOUT_URL Set to the central logout application URL. $HOME_URL Set to the topmost URL of the site. If the URL redirection application does not find a valid URL in the e-campaign database to redirect to for a valid request, it uses this URL as a default. $APPLICATION_NAME Internal name of the application. $XMAILER_ID This is the X-Mailer mail header sent with each mail to identify what program was used to send mail. $DEFAULT_LANGUAGE Set to the default (two- digit) language code. $ROOT_PATH Set to the default (two-digit) language code. $REL_ROOT_PATH Relative path to the root directory. $REL_APP_PATH Relative application path as seen from the Web browser. $ECAMPAIGN_MENU_URL Relative URL path to the campaign manager interface application. $TEMPLATE_DIR Set to the template directory containing the ihtml template files needed for the user-management applications. $CLASS_DIR Set to the class directory where user-management- related class files are stored. $ECAMPAIGN_LIST_CLASS Name of the List class. $ECAMPAIGN_URL_CLASS Name of the URL class. 524 Part III: Developing E-mail Solutions 19 549669 ch15.qxd 4/4/03 9:26 AM Page 524 Configuration Variable Purpose $ECAMPAIGN_TRACK_CLASS Name of the URL Track class. $ECAMPAIGN_UNSUB_CLASS Name of the Unsubscription class. $ECAMPAIGN_CAMPAIGN_CLASS Name of the Campaign class. $ECAMPAIGN_MESSAGE_CLASS Name of the Message class. $ECAMPAIGN_REPORT_CLASS Name of the Report class. $ECAMPAIGN_MNGR Name of the campaign manager interface application. This application displays the primary user interface. $ECAMPAIGN_URL_MNGR Name of the URL manager application. $ECAMPAIGN_CAMPAIGN_MNGR Name of the campaign manager application. $ECAMPAIGN_LIST_MNGR Name of the list manager application. $ECAMPAIGN_MESSAGE_MNGR Name of the message manager application. $ECAMPAIGN_EXEC_MNGR Name of the campaign execution application. $ECAMPAIGN_REPORT_MNGR Name of the report manager application. $ECAMPAIGN_REDIR_MNGR Name of the URL redirection application. $ECAMPAIGN_UNSUB_MNGR Name of the unsubscription application. $REL_TEMPLATE_DIR Set to relative template directory. $ECAMPAIGN_DB_URL Set to campaign database URL. $MAX_DELIVERY_AT_A_TIME Set to maximum e-mail delivery count per run. Because the execution application cannot run the entire campaign in one shot due to browser timeout issues, it executes this number of e-mails at a time. The execution application calls itself after each run using the meta refresh method. $MAX_WAIT_PER_DELIVERY The number of seconds the campaign execution application waits before it restarts via the meta refresh tag. $SECRET A random number used in the checksum algorithm. $ECAMPAIGN_LIST_TBL Name of the list table. $ECAMPAIGN_URL_TBL Name of the URL table. Continued Chapter 15: E-campaign System 525 19 549669 ch15.qxd 4/4/03 9:26 AM Page 525 . package; specifically the DB module needed for class.DBI .php in the application framework. $PHPLIB_DIR Set to the PHPLIB directory, which contains the PHPLIB packages; specifically the template.inc package. $PHPLIB_DIR, and the $APP_FRAMEWORK_DIR. This path is used with the ini_set() method to redefine the php. ini entry for include_path to include $PATH ahead of the default path. This allows PHP. information. An implementation of this class can be found in ch15/apps/class/class.EcampaignUnsub .php. This class implements the methods discussed in the following sections. EcampaignUnsub() This

Ngày đăng: 07/07/2014, 07:20

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN