tailieunhanh - Phát triển web với PHP và MySQL - p 74

Building a Mailing List Manager CHAPTER 28 705 LISTING Continued } else if (mysql_num_rows($result)==0) { echo “There is nobody subscribed to list number $listid”; return false; } else { include(‘’); $mail = new html_mime_mail(); // read in the text version $filename = “archive/$listid/$mailid/”; $fp = fopen ($filename, “r”); $text = fread($fp, filesize($filename)); fclose ($fp); // read in the HTML version $filename = “archive/$listid/$mailid/”; $fp = fopen ($filename, “r”); $html = fread($fp, filesize($filename)); fclose ($fp); // get the list of images that relate to this message $query = “select path, mimetype from images where mailid = $mailid”; if(db_connect()) { $result = mysql_query($query); if(!$result) {. | Building a Mailing List Manager 705 Chapter 28 Listing Continued else if mysql_num_rows result 0 echo There is nobody subscribed to list number listid return false else include mail new html_mime_mail read in the text version filename archive listid mailid fp fopen filename r text fread fp filesize filename fclose fp read in the HTML version filename archive listid mailid fp fopen filename r html fread fp filesize filename fclose fp get the list of images that relate to this message query select path mimetype from images where mailid mailid if db_connect result mysql_query query if result echo p Unable to get image list from database. return false num mysql_numrows result for i 0 i num i load each image from disk filename archive listid mailid .mysql_result result i 0 fp fopen filename r image fread fp filesize filename fclose fp add images to the mimemail object mail- add_html_image image mysql_result result i 0 28 Building a Mailing List Manager Building Practical PHP and MySQL Projects 706 Part V Listing Continued mysql_result result i 1 add HTML and text to the mimemail object mail- add_html html text note that we build and encode the message here outside the loop not repeatedly inside the loop mail- build_message if status STORED send the HTML version of the message to administrator mail- send get_real_name admin_user admin_user from_name from_address subject send the text version of the message to administrator mail get_real_name admin_user . . admin_user. subject text From from_name from_address echo Mail sent to admin_user query update mail set status TESTED where mailid mailid if db_connect result mysql_query query echo p Press send again to send mail to whole list. center display_button send id mailid echo center else if status TESTED send to whole list query select from sub_lists subscribers where listid listid and .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.