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

Secure PHP Development- P93 pps

5 150 0
Tài liệu đã được kiểm tra trùng lặp

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

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 110,04 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Functionality Requirements The Tell-a-Friend that we will build in this chapter will have the following features: ◆ Central Tell-a-Friend database: A single database will be used to stor

Trang 1

Chapter 13 Tell-a-Friend System

IN THIS CHAPTER

◆ Developing a tell-a-friend system

◆ Installing a tell-a-friend system

◆ Using a tell-a-friend system

S ENDING E - MAILS TO EXISTINGcustomers or prospective customers has become stan-dard business practice among modern companies After all, e-mail is cheap and more reliable than direct mail, especially when you consider the entire world as your market Marketing departments have been coming up with creative ways of using e-mail to increase companies’ exposure and customer base via e-mail In this process, the Tell-a-Friend concept was invented This process involves embedding a small HTML form within HTML messages that are sent out to customers or leads and encouraging them to tell their friends about the company’s product and/or services This viral marketing technique is widely used to increase Web site visits and even sell new products and services

In this chapter, you’ll develop a Tell-a-Friend system that you can use with your in-house or outsourced e-mail campaign solution

Let’s look at the functionality requirements of this system

Functionality Requirements

The Tell-a-Friend that we will build in this chapter will have the following features:

Central Tell-a-Friend database: A single database will be used to store all

Tell-a-Friend information The database will store Tell-a-Friend forms, a friends list (name, e-mail) submitted per form by each user who fills out the forms, and subscription information (each friend who subscribes via a link embedded in the e-mail sent by the system)

431

Trang 2

Central Tell-a-Form form management application: The system will

have a form-management application that will allow valid users (who make requests from a set of given IP addresses, which is configured in a central configuration file) to register an HTML form name to a form ID and a message ID along with other information, such as maximum indi-vidual submissions, score per friend’s e-mail, and score per subscription

by a friend The user will also define which message to send to friends and which message to send to the submission originator (that is, the friend forwarder)

Central Tell-a-Friend form processor application: A single application

will process all registered forms The form data will be stored in the cen-tral Tell-a-Friend database Each submission will also track the request IP, time stamp, and user agent (that is, the web browser) preferences

Central message editor: The user can add, modify, and delete HTML

mes-sages that can be used as automatic responses to a Tell-a-Friend submis-sion request or Tell-a-Friend introductory/forward message (that is, a message sent to a friend)

Friend subscription application: Each friend receiving an e-mail due to

another friend’s submission of her name in the Tell-a-Friend database has

a choice to subscribe or not subscribe for future mailing She will be given

a link embedded in the automatic e-mail she received that allows her to say yes or no to the future mailing When she clicks this link, she’ll be shown an interface where she will select yes or no for future e-mailing along with other information such as the frequency of e-mail she prefers and the type of mail she prefers (HTML or Text)

Easy reporting: For each Tell-a-Friend form, there will be a report

show-ing how many e-mail recipients have submitted their friends’ names and e-mail addresses This report can only be accessed by IP addresses listed in central configuration files

Score-card reporting: Each person who signs up friends using the

Tell-a-Friend receives a thank-you mail whenever a new friend is added to the database This thank-you message includes a link that allows the user to view her total score per form In other words, she’ll know how many of her forms she has submitted via the Tell-a-Friend form, as well as how many of her friends have actually subscribed There are two scores: the score related to each friend submission (which is limited to a maximum value set per form) and the score related to each friend subscription The report also tells her where she stands among other users who have sub-mitted friends using this same form

Trang 3

Understanding Prerequisites

This is an Internet application and does not require central authentication tech-niques Therefore, it is not dependent on intranet tools discussed in earlier chapters

However, it does require the application framework classes that are discussed in Chapter 4 You must have the application framework classes installed, along with PHPLIB and PEAR packages

Designing the Database

Figure 13-1 shows the database diagram for the Tell-a-Friend system Here I will describe each table in detail

Figure 13-1: Tell-a-Friend database diagram.

TAF_FORM Table

This table is the integral part of this application It holds the form number (FRM_ID), form name (FRM_NAME), form activation time stamp (ACTIVATION_TS), form termi-nation time stamp (TERMINATION_TS), ID of the message to be sent to the friends (FRIENDS_MSG_ID), ID of the message to be sent to the user (ORIGIN_MSG_ID), ID

of the message to be sent to the friend who subscribes (SUBSCRIBER_MSG_ID),

Trang 4

maximum number of friends allowed per user (MAX_FRIEND_PER_ORIGIN), score per friend submission (SCORE_PER_FRIEND_SUBMISSION), and score per friend sub-scription (SCORE_PER_FRIEND_SUBSCRIPTION) The form number (FRM_ID) is the primary key for this table

TAF_FRM_BANNED_IP Table

This table is used to store the IP addresses that are banned from viewing a form report or modifying a form configuration This has two attributes: the form number (FRM_ID) and the banned IP address (BANNED_IP) Both the attributes are used as primary keys

TAF_FRM_OWNER_IP Table

This table is used to store the IP addresses that are authorized to view a form report

or modify a form configuration This has two attributes: the form number (FRM_ID) and the authorized IP address (OWNER_IP) Both the attributes are used as primary keys because we want to allow multiple IP addresses to be allowed for a single form

TAF_MESSAGE Table

This is the table that stores all kinds of message needed to operate the Tell-a-Friend application This holds the message number (MSG_ID), message name (MSG_NAME), message content (BODY), from address (FROM), reply-to address (REPLY_TO), and mes-sage subject (SUBJECT) The message number (MSG_ID) is the primary key in this table

TAF_MSG_OWNER_IP Table

This table contains the IP addresses that are allowed to modify a message The mes-sage number (MSG_ID) and the authorized IP (OWNER_IP) are the two attributes of this table Both of them are also the primary keys of the table

TAF_SUBMISSION Table

This table holds information about friend submission It has friend number (FRND_ID), friend e-mail (FRND_EMAIL), friend name (FRND_NAME), form number (FRM_ID), originator e-mail (ORIGIN_EMAIL), originator IP Address (ORIGIN_IP), and submission time stamp (SUBMIT_TS) The friend number (FRND_ID) is the pri-mary key and the friend’s e-mail (FRND_EMAIL) and form number (FRM_ID) are the unique fields for this table

TAF_SUBSCRIPTION Table

This table contains information about the friend subscription It has the form num-ber (FRM_ID), friend e-mail (FRND_EMAIL), originator e-mail (ORIGIN_EMAIL), sub-scription type (SUBSCRIPTION), and subscription time stamp (TS) The form number (FRM_ID) and friend e-mail (FRND_EMAIL) are the primary keys for the table

Trang 5

The taf.sqlfile in the ch13/sqldirectory of the CD-ROM shows an implemen-tation of the Tell-a-Friend database in MySQL To implement this Tell-a-Friend database in MySQL, you can create a database called TELL_A_FRIENDin your data-base server and run the following command:

mysql -u root -p -D TELL_A_FRIEND < taf.sql

Make sure you change the user name (root) to whatever is appropriate for your system

Designing and Implementing the Tell-a-Friend Application Classes

As shown in the system diagram, Figure 13-2, there are three new objects that are needed to implement the Tell-a-Friend application

Figure 13-2: Tell-a-Friend system diagram.

Here you will develop some classes that will provide these objects for your Tell-a-Friend applications

Menu Manager Form Manager

PHP Application Framework

Tell-a-Friend Applications

Form Object class.Form.php Access Control Object class.AccessControl.php

Message Object class.Message.php

Message Manager

Form Processor

Subscription Processor

Reporter

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