Archive for February, 2008

522 Part III: Developing E-mail Solutions EcampaignTrack() This (Web server extensions)

Monday, February 25th, 2008

522 Part III: Developing E-mail Solutions 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 variable, 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 manipulate 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.

Zeus web server - Chapter 15: E-campaign System 521 Creating a Campaign

Sunday, February 24th, 2008

Chapter 15: E-campaign System 521 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 implements 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 campaign 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.

520 Part III: Developing E-mail (Web hosting plans) Solutions . Sets

Sunday, February 24th, 2008

520 Part III: Developing E-mail Solutions . Sets msg_fields to an associative array, which contains the message table field names and their types (text or number). This associative array is used in other methods to determine which field value needs to be quoted and protected from embedded slashes using the addslashes() method. . Sets hdr_fields to an associative array, which contains the message header table field names and their types (text or number). This associative array is used in other methods to determine which field value needs to be quoted and protected from embedded slashes using the addslashes() method. . Calls setEcampaignMessageID() to set the campaign ID, which is passed to the constructor method from the application. setEcampaignMessageID() This method sets the message ID. getEcampaignMessageInfo() This method returns the message information for a given message ID or the current message ID. getEcampaignHeaderInfo() This method returns message header information for a given message ID or the current message ID. addNewEcampaignMessage() This method adds a new message in the message table and its headers in the header table. getAvailableMessages() This returns a list of messages in the current e-campaign database. The returned list is an associative array with the message ID (MSG_ID) being the key and the message name (NAME) as the value. deleteMessage() This method deletes a message and its header. UpdateEcampaignMessage() This method updates a message. UpdateEcampaignMessageHdr() This method updates headers of a message.

Chapter 15: E-campaign System (Free web hosts) 519 . Sets the

Sunday, February 24th, 2008

Chapter 15: E-campaign System 519 . Sets the home_url variable to configuration variable called $HOME_URL, which holds the home URL. . Sets the dbi variable to the DBI object, which is passed to the URL object from the caller application. addURL() This method inserts a new URL in the URL table within the e-campaign database. getURL() This method gets the URL for a given URL ID. getURLInfo() This method returns the name and URL for a given URL ID from the URL table in the e-campaign database. modURL() This method updates an existing URL in the URL table in the e-campaign database. getURLList() This method returns a list of URLs in an associative array (key = URL_ID, value = name) from the URL table in the e-campaign database. getURLLocationList() This method returns a list of URLs in an associative array (key = URL_ID, value = URL) from the URL table in the e-campaign database. deleteURL() This method deletes an existing URL from the URL table in the e-campaign database. Creating a Message class The purpose of this class is to provide the Message object, which is needed to manipulate the message. An implementation of this class can be found in ch15/ apps/class/class.EcampaignMessage.php. This class implements the methods discussed in the following sections. EcampaignMessage() This is the constructor method for the Message class. It does the following: . Sets message_tbl to $ECAMPAIGN_MESSAGE_TBL, which holds the name of the message table. The $ECAMPAIGN_MESSAGE_TBL is set in the ecampaign. conf configuration file. . Sets header_tbl to $MESSAGE_HDRS_TBL, which holds the name of the header table. The $MESSAGE_HDRS_TBL is set in the ecampaign.conf configuration file.

Ipower web hosting - 518 Part III: Developing E-mail Solutions getClientDBURL() This

Saturday, February 23rd, 2008

518 Part III: Developing E-mail Solutions getClientDBURL() This method returns the database URL for a given list. It retrieves the database information from the list record and constructs a database_type://user: password.tabase_hostname/database_name URL, which can be used to retrieve customer data. getTargetData() This method returns a list of row objects from the assembly table and then deletes the records from the assembly table. This method is used to fetch a specific number of rows from the assembly table for mail delivery. The returned array of rows uses REC_ID as the key and the row object as the value. addToBounced() This method inserts a record in the bounce e-mail table. This record is used in the report to determine how many e-mails bounced during delivery. When an e-mail is not bounced during delivery, it can still be bounced later after delivery by the recipient s target mail server, which may try to delivery it to an internal mail server within an organization. Therefore, the bounce tracking done in the e-campaign is not 100-percent accurate. In fact, if e-mail addresses aren t local to the mail server being used, the bounces usually aren t right away. This problem can be avoided in a future version of the e-campaign system. modifyMapList() This method allows you to modify the standard personalization field map for a given list. Creating a URL class The purpose of this class is to provide the URL object, which is needed to manipulate the URL. An implementation of this class can be found in ch15/apps/class/ class.EcampaignURL.php . This class implements the methods discussed in the following sections. EcampaignURL() This is the constructor method. It does the following: . Sets the url_tbl variable to the configuration variable called $ECAMPAIGN_URL_TBL, which holds the name of the URL table in the campaign database.

Chapter 15: E-campaign System 517 (Web host 4 life) getEcampaignListInfo() This method

Saturday, February 23rd, 2008

Chapter 15: E-campaign System 517 getEcampaignListInfo() This method returns all the information about a given list. Information is returned as a standard row object. If no information is found about a list, null is returned. addNewEcampaignList() This method adds a new list to the database. modEcampaignList() This method updates an existing list. addMapping() This method stores standard personalization fields (FIRST, LAST, EMAIL, and so on) mapping information that is used to identify which customer database field matches with which standard personalization fields. getAvailableLists() This method returns a list of available lists. The method returns an associative array where LIST_ID is the key and NAME is the value. deleteList() This method deletes an existing list. prepareLocalList() This method creates a local copy of the list data necessary to execute a campaign. It does the following: . Determines the list of mapped fields. . Makes a SQL statement to get the mapped field data from the customer database table. . Queries the customer database with the prepared statement. . Inserts the data in the assembly table. . Removes the customers who have previously unsubscribed from this list. . Returns the total number of records inserted in the assembly table. pushMappedFields() This is a utility method that pushes a field name into an array if the field name is not null. map() This is a utility method that returns the field name for a given standard contact field name.

516 Part III: Developing E-mail Solutions . Record (Php web hosting)

Friday, February 22nd, 2008

516 Part III: Developing E-mail Solutions . Record ID: A numeric record ID must be in the target list table to identify the customer record. . E-mail field: An e-mail field must be there in the target list table. The field names can be anything. These two fields must be mapped during the list-creation process using the list management application. The e-campaign system allows you to map all the standard personalization fields shown in Table 15-1 during list creation so that you can use them in message personalization. Designing E-campaign Classes Based on the system diagram shown in Figure 15-1, you need to create a set of classes to provide the objects needed to implement the e-campaign system. In the following sections, I discuss the necessary classes in details. Creating a List class The purpose of this class is to provide the List object, which is needed to manipulate the lists. An implementation of this class can be found in the ch15/apps/ class/class.EcampaignList.php file in the CDROM. This class implements the methods discussed in the following sections. EcampaignList() This is the constructor method. It does the following: . Sets member variables list_tbl, list_field_map, assembly_tbl, unsub_tbl, and bounced_tbl to global configuration variables $ECAMPAIGN_LIST_TBL, $LIST_FIELD_MAP_TBL, $ECAMPAIGN_ASSEMBLY_ TBL, $ECAMPAIGN_UNSUB_TBL, and $ECAMPAIGN_BOUNCED_TBL, respectively. . A member variable called dbi is set to $dbi, which is a DBI object passed from the application. . A member variable called std_map_fields is set to an associative array that holds the field and field type for standard personalization fields supported by the e-campaign system. . Finally, this method calls the setEcampaignListID() method to set the list ID, which can also be passed from the application when creating an object. setEcampaignListID() This method sets the current object s list ID to the given list ID, which is passed as a parameter. It always returns the current list ID.

Chapter 15: E-campaign System 515 ID int(11) NOT (Web hosting script)

Friday, February 22nd, 2008

Chapter 15: E-campaign System 515 ID int(11) NOT NULL auto_increment, USER_ID int(11) NOT NULL default 0 , CAMP_ID int(11) NOT NULL default 0 , URL_ID int(11) NOT NULL default 0 , TRACK_TS bigint(20) NOT NULL default 0 , PRIMARY KEY (ID) ) TYPE=MyISAM; # ——————————————————- # # Table structure for table `UNSUB` # CREATE TABLE UNSUB ( ID int(11) NOT NULL auto_increment, REC_ID int(11) NOT NULL default 0 , LIST_ID int(11) NOT NULL default 0 , CAMPAIGN_ID int(11) NOT NULL default 0 , UNSUB_TS bigint(20) NOT NULL default 0 , PRIMARY KEY (ID,REC_ID,LIST_ID), UNIQUE KEY REC_ID (REC_ID,LIST_ID) ) TYPE=MyISAM; # ——————————————————- # # Table structure for table `URL` # CREATE TABLE URL ( URL_ID int(11) NOT NULL auto_increment, NAME varchar(127) NOT NULL default , URL varchar(255) NOT NULL default , PRIMARY KEY (URL_ID), UNIQUE KEY NAME (NAME) ) TYPE=MyISAM; Understanding Customer Database Requirements Each customer database that you want to use in e-campaigns must have the following data fields:

514 Part III: Developing E-mail (Hosting your own web site) Solutions Listing 15-1

Thursday, February 21st, 2008

514 Part III: Developing E-mail Solutions Listing 15-1 (Continued) LIST_ID int(11) NOT NULL default 0 , REC_ID varchar(127) NOT NULL default , FIRST varchar(127) default NULL, LAST varchar(127) default NULL, EMAIL varchar(127) NOT NULL default , AGE varchar(127) default NULL, INCOME varchar(127) default NULL, SEX varchar(127) default NULL, PRIMARY KEY (LIST_ID) ) TYPE=MyISAM; # ——————————————————- # # Table structure for table `MESSAGE` # CREATE TABLE MESSAGE ( MSG_ID tinyint(4) NOT NULL auto_increment, NAME varchar(127) NOT NULL default , BODY text NOT NULL, CREATE_TS bigint(20) NOT NULL default 0 , CREATOR_ID int(11) NOT NULL default 0 , PRIMARY KEY (MSG_ID), UNIQUE KEY NAME (NAME) ) TYPE=MyISAM; # ——————————————————- # # Table structure for table `MESSAGE_HDRS` # CREATE TABLE MESSAGE_HDRS ( MSG_ID int(11) NOT NULL default 0 , HDR_ID int(11) NOT NULL default 0 , HDR_VALUE varchar(127) NOT NULL default ) TYPE=MyISAM; # ——————————————————- # # Table structure for table `TRACK` # CREATE TABLE TRACK (

Chapter 15: E-campaign System 513 # ——————————————————- # (Best web design)

Thursday, February 21st, 2008

Chapter 15: E-campaign System 513 # ——————————————————- # # Table structure for table `ECAMPAIGN_EXECUTION` # CREATE TABLE ECAMPAIGN_EXECUTION ( EXEC_ID int(11) NOT NULL auto_increment, CAMPAIGN_ID int(11) NOT NULL default 0 , CAMPAIGN_TS timestamp(14) NOT NULL, PRIMARY KEY (EXEC_ID), UNIQUE KEY CAMPAIGN_TS (CAMPAIGN_TS) ) TYPE=MyISAM; # ——————————————————- # # Table structure for table `LIST` # CREATE TABLE LIST ( LIST_ID int(11) NOT NULL auto_increment, NAME varchar(127) NOT NULL default , DB_HOST varchar(127) NOT NULL default , DB_USER varchar(127) NOT NULL default , DB_PASSWD varchar(127) NOT NULL default , DB_TYPE varchar(127) NOT NULL default , DB_NAME varchar(127) NOT NULL default , DB_TABLE varchar(127) NOT NULL default , LIMIT_CONDITION varchar(255) default NULL, CREATE_TS bigint(20) NOT NULL default 0 , CREATOR_ID int(11) NOT NULL default 0 , CHECK_FLAG bigint(20) NOT NULL default 0 , PRIMARY KEY (LIST_ID), UNIQUE KEY CHECK_FLAG (CHECK_FLAG), UNIQUE KEY NAME (NAME) ) TYPE=MyISAM; # ——————————————————- # # Table structure for table `LIST_FIELD_MAP` # CREATE TABLE LIST_FIELD_MAP ( Continued