Secure PHP Development- P112 pot

5 71 0
Secure PHP Development- P112 pot

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

Thông tin tài liệu

TABLE 15-2 ecampaign.conf VARIABLES (Continued) $LIST_FIELD_MAP_TBL Name of the list map table. $ECAMPAIGN_TBL Name of the campaign table. $ECAMPAIGN_MESSAGE_TBL Name of the message table. $MESSAGE_HDRS_TBL Name of the message header table. $ECAMPAIGN_EXECUTION_TBL Name of the execution table. $ECAMPAIGN_ASSEMBLY_TBL Name of the assembly table. $ECAMPAIGN_TRACK_TBL Name of the URL track table. $ECAMPAIGN_UNSUB_TBL Name of the unsubscription table. $ECAMPAIGN_BOUNCED_TBL Name of the bounced e-mail table. $REPORT_EVEN_ROW_COLOR HTML color code for even rows in a report table. $REPORT_ODD_ROW_COLOR HTML color code for odd rows in a report table. $FROM_HEADER Header ID for the From header. $REPLY_HEADER Header ID for the Reply-to header. $PRIORITY_HEADER Header ID for the Priority header. $SUBJECT_HEADER Header ID for the Subject header. Creating an e-campaign messages file The messages displayed by the e-campaign applications are stored in an e-campaign messages file called ecampaign.messages, which can be found in ch15/apps directory in the CDROM. Creating an e-campaign errors file The error messages displayed by the e-campaign applications are stored in an e-campaign error messages file called ecampaign.errors, which can be found in ch15/apps directory in the CDROM. Creating Interface Template Files The HTML interface templates needed for the e-campaign applications are included on the CD-ROM. These templates contain various template tags to dynamically 526 Part III: Developing E-mail Solutions 19 549669 ch15.qxd 4/4/03 9:26 AM Page 526 display necessary information. Table 15-3 shows which template file is used for what purpose. TABLE 15-3 INTERFACE TEMPLATE FILES Configuration Variable File Name and Purpose $ECAMPAIGN_ADD_TEMPLATE ecampaign_add.ihtml $ECAMPAIGN_MENU_TEMPLATE ecampaign_menu.ihtml $ECAMPAIGN_ADD_URL_TEMPLATE ecampaign_add_url.ihtml $ECAMPAIGN_EXECUTION_TEMPLATE ecampaign_execute.ihtml $ECAMPAIGN_ADD_LIST_TEMPLATE ecampaign_add_list.ihtml $STATUS_TEMPLATE ecampaign_status.ihtml $ECAMPAIGN_MAPPING_TEMPLATE ecampaign_take_map.ihtml $ECAMPAIGN_ADD_CAMPAIGN_TEMPLATE ecampaign_add_campaign.ihtml $ECAMPAIGN_ADD_LABEL_TEMPLATE ecampaign_add_label.ihtml $ECAMPAIGN_REPORT_TEMPLATE ecampaign_report.ihtml $ECAMPAIGN_MOD_URL_TEMPLATE ecampaign_modify_url.ihtml $ECAMPAIGN_ADD_MESSAGE_TEMPLATE ecampaign_add_message.ihtml $ECAMPAIGN_PREVIEW_MESSAGE_TEMPLATE ecampaign_preview_message $ECAMPAIGN_MOD_LIST_TEMPLATE ecampaign_mod_list.ihtml $ECAMPAIGN_UNSUB_TEMPLATE ecampaign_unsub.ihtml $MAIL_TEMPLATE ecampaign_mail.ihtml $ECAMPAIGN_PREVIEW_MESSAGE_ ecampaign_preview_message_ INPUT_TEMPLATE input.ihtml $ECAMPAIGN_PREVIEW_MESSAGE_ ecampaign_preview_message_ SHOW_TEMPLATE show.ihtml $ECAMPAIGN_PREVIEW_MESSAGE_TEMPLATE ecampaign_preview_ message.ihtml $ECAMPAIGN_UNSUB_CONFIRM_TEMPLATE ecampaign_unsub_ confirmation.ihtml Now you’re ready to create the e-campaign applications. Chapter 15: E-campaign System 527 19 549669 ch15.qxd 4/4/03 9:26 AM Page 527 Creating an E-campaign User Interface Application This application displays the main user interface for the e-campaign applications. The main user interface application called ecampaign_mngr.php can be found in ch15/apps directory in the CDROM. The methods implemented by this user inter- face application are discussed in the following sections. run() This method calls the displayMenu() method to display the user interface. displayMenu() This method displays the main user interface. This method creates a List object, a URL object, and a Campaign object to get lists of lists, URLs, and campaigns to dis- play in the interface. authorize() This method returns TRUE since, in the current version everyone is allowed to view the campaign report. If you want to restrict access to the report to a specific user or group of users, you’ll have to modify this method to implement your restrictions. Creating a List Manager Application The list-management application manipulates lists. The list-creation process is shown in Figure 15-3. The ecampaign_list_mngr.php application that can be found in ch15/apps directory in the CDROM, which implements the list creation, modification, and deletion process. This application has the following methods. run() This method uses a form variable called the $cmd variable, which is set in the user interface displayed by ecampaign_mngr.php, to select the appropriate function to implement the list operation. When $cmd is set to add, it calls the addDriver() method to add a list. When $cmd is set to modify, it calls the modDriver() method to modify a list; otherwise, it calls the delList() method to delete a list. 528 Part III: Developing E-mail Solutions 19 549669 ch15.qxd 4/4/03 9:26 AM Page 528 Figure 15-3: How a list is created. addDriver() This method uses $step, a variable set in the add list interface forms, to control which method is called. The $step variable is used to select the appropriate method for the appropriate stage of the list adding process. Here is how the addDriver() works: ◆ If $step is not set, then the first step of the add list process is started by calling displayAddListMenu(), which shows the add list interface. This interface sets the $step to 2, using a hidden HTML field. ◆ If $step is set to 2, then the second step of the add list process is started by calling the addList() method. This method stores the list configura- tion data collected in the previous step and displays the database field mapping interface by calling the takeMap() method. This interface sets the $step value to 3. Start Get list configuration information such as database hostname, database name, username, password, and the table name, which contains the customer data (EMAIL, RECORD ID, etc.) Ask user to give this list a name. End Connect to the given list database and get meta data for the chosen list table. Map table fields with standard campaign fields (used for personalization) Store list access and mapping information in e-campaign database Chapter 15: E-campaign System 529 19 549669 ch15.qxd 4/4/03 9:26 AM Page 529 ◆ If $step is set to 3, then the database field map that maps the standard personalization fields such as REC_ID, FIRST, LAST, AGE, SEX, INCOME, and EMAIL is stored in the database using the addDatabaseFieldMap method. modifyDriver() This method uses $step, a variable set in the modify list interface forms, to control which method is called. The $step variable is used to select the appropriate method for the appropriate stage of the list modification process. Here is how the modifyDriver() method works: ◆ If $step is not set, then the first step of the modify list process is started by calling displayModifyListMenu(), which shows the modify list inter- face. This interface sets the $step to 2, using a hidden HTML field. ◆ If $step is set to 2, then the second step of the modify list process is started by calling the modifyList() method. This method stores the list configuration data collected in the previous step and displays the database field mapping interface by calling the takeMap() method. This interface sets the $step value to 3. ◆ If $step is set to 3, then the database field map that maps the standard personalization fields such as REC_ID, FIRST, LAST, AGE, SEX, INCOME, and EMAIL are stored in the database using the modifyDatabaseFieldMap method. authorize() See the authorize() method in the e-campaign user interface application called ecampaign_mngr.php for details. displayAddListMenu() This method displays the add list interface. displayModListMenu() This method displays the modify list interface. modifyList() This method is called when a user makes changes in the modify interface shown by displayModListMenu(). The modifyList() method creates a list object and calls its modEcampaignList() method to update the list in the database. 530 Part III: Developing E-mail Solutions 19 549669 ch15.qxd 4/4/03 9:26 AM Page 530 . interface for the e-campaign applications. The main user interface application called ecampaign_mngr .php can be found in ch15/apps directory in the CDROM. The methods implemented by this user inter- face. application manipulates lists. The list-creation process is shown in Figure 15-3. The ecampaign_list_mngr .php application that can be found in ch15/apps directory in the CDROM, which implements the list. variable called the $cmd variable, which is set in the user interface displayed by ecampaign_mngr .php, to select the appropriate function to implement the list operation. When $cmd is set to add,

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

Từ khóa liên quan

Mục lụ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

Tài liệu cùng người dùng

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

Tài liệu liên quan