tailieunhanh - PHP and MySQL Web Development - P139

PHP and MySQL Web Development - P139: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | 662 Chapter 28 Building a Mailing List Manager Listing Continued list HTTP_POST_VARS list subject HTTP_POST_VARS subject if db_connect echo p Could not connect to db p do_html_footer exit add mail details to the DB query insert into mail values NULL . HTTP_SESSION_VARS admin_user . . subject. . list. STORED NULL NULL result mysql_query query if result do_html_footer exit get the id MySQL assigned to this mail mailid mysql_insert_id if mailid do_html_footer exit creating directory will fail if this is not the first message archived that s ok @ mkdir archive . list 0700 it is a problem if creating the specific directory for this mail fails if mkdir archive . list. mailid 0700 do_html_footer exit iterate through the array of uploaded files i 0 Implementing Administrative Functions 663 Listing Continued while HTTP_POST_FILES userfile name i HTTP_POST_FILES userfile name i none echo p Uploading . HTTP_POST_FILES userfile name i . - echo HTTP_POST_FILES userfile size i . bytes. p if HTTP_POST_FILES userfile size i 0 echo Problem . HTTP_POST_FILES userfile name i . is zero length i continue if HTTP_POST_FILES userfile size i max_size echo Problem . HTTP_POST_FILES userfile name i . is over . max_size. bytes i continue we would like to check that the uploaded image is an image if getimagesize can work out its size it probably is. if i 1 getimagesize HTTP_POST_FILES userfile tmp_name i echo Problem . HTTP_POST_FILES userfile name i . is corrupt or not a gif jpeg or png i continue file 0 the text message and file 1 the html message are special cases if i 0 destination archive list mailid else if i 1 destination archive list mailid else destination archive list mailid . HTTP_POST_FILES userfile name i query insert into images values mailid . HTTP_POST_FILES userfile name i . . HTTP_POST_FILES userfile type i . result mysql_query query 664 Chapter 28 Building a Mailing List Manager Listing Continued if we are using PHP version if .

TỪ KHÓA LIÊN QUAN