Phát triển web với PHP và MySQL - p 84 pptx

10 309 0
Phát triển web với PHP và MySQL - p 84 pptx

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

Thông tin tài liệu

HotScripts.com—http://www.hotscripts.com—A great categorized selection of scripts. The site has scripts in various languages like PHP, ASP, and Perl. It has an excellent collection of PHP scripts. Updated very frequently. A must see if you are looking for scripts. PHP Base Library—http://phplib.netuse.de—A site used by developers for large-scale PHP 3 projects. Offers a library with a lot of tools for session management, which now comes built-in with PHP 4, as well as templating and database abstraction. The site is also a good site for people seeking tutorials and knowledge. PHP Center—http://www.php-center.de—Another German portal site used for tutorials, scripts, tips, tricks, advertising, and more. PHPInfo.net—http://www.phpinfo.net—This French site contains a lot of information about PHP and MySQL. It has many links, tips, articles, a FAQ, a Code download area, and much more. PHP Homepage—http://www.php-homepage.de—Another German site about PHP with scripts, articles, news, and much more. Has a quick reference section. PHPIndex.com—http://www.phpindex.com—A nice French PHP portal with tons of PHP- related content. Site contains news, FAQs, articles, job listings, and much more. WebMonkey.com—http://www.webmonkey.com—A portal with lots of Web resources, real world tutorials, sample code, and so on. The site covers design, programming, back end, multi- media stuff, and much more. The PHP Club—http://www.phpclub.net—The PHP Club offers many resources for PHP beginners. The site has news, book reviews, sample code, forums, FAQs, and many tutorials for beginners. The PHP Classes Repository—http://phpclasses.upperdesign.com—A site that targets the distribution of freely available classes written in PHP. A must-see if you are developing code or your project will be composed of classes. Nice search functionality, so you can find stuff easily. The PHP Resource Index— http://php.resourceindex.com—Portal site for scripts, classes, and documentation. The cool thing about this site is that everything is nicely categorized, which can save you some time. PHP Developer— http://www.phpdeveloper.org—Yet another PHP portal that provides PHP news, articles, and tutorials. Evil Walrus—http://www.evilwalrus.com—A cool-looking portal for PHP scripts. Oodie.com—http://www.oodie.com—Provides lists of free PHP hosting service providers and scripts. Web Resources A PPENDIX B B WEB RESOURCES 805 39 7842 App B 3/6/01 3:38 PM Page 805 e-gineer—http://www.e-gineer.com—Articles, scripts, and a knowledge base of common questions and answers. Source Forge—http://sourceforge.net—Extensive open source resources. Source Forge not only lets you find code that can be useful, but it also provides access to CVS, mailing lists, and machines for Open Source developers. MySQL and SQL Specific Resources The MySQL site—http://www.mysql.com—The official MySQL Web site. Provides excellent documentation, support, and information. A must-see if you are using MySQL. Provides sources for the MySQL DB server. SQL Tutorial— http://w3.one.net/~jhoffman/sqltut.htm—Comprehensive SQL tutorial with example and exercises. The SQL Course— http://sqlcourse.com—Provides an introductory SQL tutorial with easy- to-understand instructions. Allows you to practice what you learn on an online SQL interpreter. Advance version is provided at http://www.sqlcourse2.com. DatabaseCentral.com—http://databasecentral.com—Nice portal with lots of useful infor- mation on DBS. Provides excellent tutorials, tips, white papers, FAQs, reviews, and so on. A must-see! The SQL Pro—http://www.inquiry.com/techtips/thesqlpro—Have programming questions? Ask the pros! Search database of questions and answers about database development and SQL. Apache Resources Apache Software—http://www.apache.org—The place to start if you need to download the sources or binaries. The site provides online documentation. Apache Week— http://www.apacheweek.com—Online weekly magazine that provides essential information for anyone running an Apache Server or anyone running Apache services. A must! Apache Today— http://www.apachetoday.com—A daily source of news and information about Apache. Users must subscribe to post questions. Web Development Philip and Alex’s Guide to Web Publishing—http://www.arsdigita.com/books/panda/—A witty, irreverent guide to software engineering as it applies to the Web. One of the few books on the topic coauthored by a Samoyed. Appendixes P ART VI 806 39 7842 App B 3/6/01 3:38 PM Page 806 INDEX SYMBOLS + (addition operator), 26 = (assignment operator), 27 @ (at symbol), 56 \ (back slashes), 263, 448 ^ (bitwise operator), 31 | (bitwise operator), 31 & (bitwise operator), 31 << (bitwise operator), 31 ^ (caret symbol), regular expressions, 112 %= (combined assignment operator), 28 *= (combined assignment operator), 28 += (combined assignment operator), 28 -= (combined assignment operator), 28 .= (combined assignment operator), 28 /= (combined assignment operator), 28 , (comma operator), 32 != (comparison operator), 30 < (comparison operator), 30 <= (comparison operator), 30 == (comparison operator), 29-30 {} (curly braces, regular expressions) — (decrement operator), 28 / (division operator), 26 @ (error suppression operator), 32 `` (execution operator), 32 ++ (increment operator), 28 ! (logical operator), 31 && (logical operator), 31 || (logical operator), 31 % (modulus operator), 26 * (multiplication operator), 26 \n (newline) control sequence, 58 40 7842 index 3/6/01 4:22 PM Page 807 + (plus symbol) 808 + (plus symbol), Web forum articles, 719 ’ (quote symbol) ” (quotes) & (reference operator), 29 * (regular expressions), 111 + (regular expressions), 111 ; (semicolons), MySQL, 185 - (subtraction operator), 26 \t (tab) control sequence, 58 % (wildcard character), 250 401 errors (HTTP), 317 A a file mode, 54 a+ file mode, 54 access control (authenti- cation) implementing, 305-312 multiple pages, protecting, 312 passwords encrypting, 310-311 storing, 308-310 accessing associative array contents, 73 numerically indexed array contents, 72 two-dimensional array contents, 76 accessor functions, 153-154 account settings (MLM), 689 Account Settings button, 689 accounts, creating, 673-675 accounts (Warm Mail application) creating, 634-636 deleting, 636-637 modifying, 636 selecting (reading email), 637-640 setting up, 632-637 modifying existing accounts, 636 new accounts, 634-636 Acrobat Web site, 750 actions MLM, 670-672 script architecture, 663 add bm() function, 528 ADD INDEX [index] (col- umn, ) syntax, 224 addslashes() function, 254 ADD PRIMARY KEY (col- umn, ) syntax, 224 ADD UNIQUE [index] (col- umn, ) syntax, 224 ADD [COLUMN] (col- umn_description, col- umn_description, ) syntax, 224 ADD [COLUMN] column_description [FIRST | AFTER column] syntax, 224 adding bookmarks, 526-529 addition operator, 26 addslashes() function, 233, 254, 336 add_bms.php, 501 add_bm_form.php, 501 add_quoting() function, 737 AddSlashes() function, 101 admin.php script (Shopping Cart applica- tion), 575-577 administration interface (Shopping Cart applica- tion), 575-584 administration menu (admin.php), 575-577 edit_book_form.php script, 580 insert_book.php script, 578-579 insert_book_form.php script, 578 show_book.php script, 579 administrative functions (MLM), 692 administrative users privileges, 191 setting up, 192 administrator interface (Shopping Cart applica- tion), 542 administrator view (Shopping Cart applica- tion), 542-543 Adobe (FDF Web site), 763 Adobe Acrobat Web site, 750 Adobe PostScript, 747-748 Advanced Maryland Automated Network Disk Archiver (AMANDA), 301 aggregate functions (MySQL), 221 aggregating data, 220-222 40 7842 index 3/6/01 4:22 PM Page 808 architecture 809 aliases for tables, 218-219 ALL privilege, 191 ALTER privilege, 190 ALTER TABLE statement, 223 syntaxes, 224 ALTER [COLUMN] column {SET DEFAULT value | DROP DEFAULT} syntax, 224 altering tables, 223-225 AMANDA (Advanced Maryland Automated Network Disk Archiver), 301 Amazon.com, 278 ampersand (&) reference operator, 29 Analog Web site, 271 and operator, 31 anomalies, avoiding (Web databases), 177-178 anonymous login (FTP), 381 ANSI Web site (SQL stan- dard), 226 anti-aliasing text, 408 Apache for UNIX, 798-799 for Windows, 798-799 installing, 787-789 UNIX environment, 787-789 Windows environment, 795-796 parameters, MaxClients, 235 resources, 806 running, 790, 796 as services, 797-798 from console window, 797 Windows environment, 796 Apache Software Web site, 806 Apache Today Web site, 806 Apache Web server basic authentication (HTTP) in PHP, 314-315 with .htaccess files, 316-319 htpasswd program, 318-319 mod_auth module, 316 mod_auth_mysql module, 322-324 documentation Web sites, 324 installing, 322-323 Apache Web site, 784 Apache Week Web site, 806 applications content management sys- tems, files, 595-596 Shopping Cart. See Shopping Cart applica- tion application architectures, Warm Mail application (email client), 621 application layer proto- cols, 333 application projects content, 471 separating from logic, 472 development environment, 469 documentation, 470 logic, 471 separating from content, 472 optimizations, 472-473 Zend Optimizer, 473 planning, 461-462 prototypes, 471 rewriting code, 462-463 software engineering, 460 testing code, 474-475 version control, 467-468 writing maintainable code, 463 coding standards, 463-467 directory structures, 467 functions, 467 applications Bob’s Auto Parts applica- tion, 11-13 Book-O-Rama application, 173 Database Search page, 229 designing, 176-180 schema, 184, 194 Web database architec- ture, 180-181 content management systems files, 596-598 PHPBookmark, 498-500 files, 501-502 Smart Form Mail, 94-96 Smart Form Mail applica- tion, regular expressions, 113-114 Warm Mail. See Warm Mail application Web forum application. See Web forum applica- tion architecture script, 663-672 footers, 663 headers, 663 40 7842 index 3/6/01 4:22 PM Page 809 architecture 810 performing actions, 663 preprocessing, 663 Web databases, 180-181 arcs, ImageArc() function, 428 arithmetic operators, 26 array push() function, 683 array() language construct, 71 arrays, 70-71 associative arrays, 73-75 contents, accessing, 73 each() function, 74-75 initializing, 73 list() function, 74-75 looping through arrays, 74-75 sorting, 79-80 bounding boxes, contents, 416-417 converting to scalar vari- ables, 91-92 elements, 71 applying functions, 89-90 counting, 90-91 indexes, 71 loading from files, 85-87 multidimensional arrays, 75-79 sorting, 80 three-dimensional arrays, 77-79 two-dimensional arrays, 75-77 navigating within an array, 88-89 numerically indexed arrays, 71-73 accessing with loops, 73 contents, accessing, 72 initializing, 71-72 reordering, 83-85 array_reverse() function, 84-85 shuffle() function, 83-84 two-dimensional arrays, 77 array_count_values() function, 90 array_reverse() function, 84-85 array_walk() function, 89-90 arsort() function, 80 article list (Web forum application), 718-731 adding new articles, 734-741 displaying articles, 724 plus symbols, 719 threads collapsing, 719-723 expanding, 719-723 treenode class, 725-731 viewing individual articles, 731-734 ASCII, 745 asort() function, 79-80 ASP style (PHP tags), 15 assignment operators, 22, 27-29 combination assignment operators, 28 decrement operators, 28-29 increment operators, 28-29 reference operator, 29 returning values, 27 associative arrays, 73-75 contents, accessing, 73 each() function, 74-75 initializing, 73 list() function, 74-75 looping through arrays, 74-75 sorting, 79-80 asort() function, 79-80 ksort() function, 79-80 reverse sort functions, 80 sort() function, 79 associativity, operators, 34-35 asterisk symbol (*), regu- lar expressions, 111 at symbol (@), 56 attachments, online newsletters, 658 attributes (object- oriented development), 148 class attributes, 152-154 creating, 151, 159-160 attributes (tables), 173 authentication, 284, 291-293, 304-325 access control encrypting passwords, 310-311 implementing, 305-312 multiple pages, protect- ing, 312 storing passwords, 308-310 basic authentication (HTTP), 312-313 in PHP, 314-315 with Apache .htaccess files, 316-319 with IIS, 319-321 digest authentication (HTTP), 313 identifying users, 304-305 40 7842 index 3/6/01 4:22 PM Page 810 Boutell Web site 811 mod_auth_mysql module, 322-324 documentation Web sites, 324 installing, 322-323 passwords, 291-292 session control, 438-445 authmain.php script, 438-443 logout.php script, 444-445 members_only.php script, 443-444 user, 506 input data, validating, 510 logging in, 513-517 logging out, 518 passwords, resetting, 521-526 passwords, setting, 519-521 registering, 507-511 Web sites, 324 authmain.php script (authentication), 438-443 auto append file, 593 auto prepend file, 593 automatic generation of images, 410 auto_append_file (php.ini file), 126-127 AUTO_INCREMENT keyword, 196 auto_prepend_file (php.ini file), 126-127 AVG(column) function, 221 B b file mode, 54 back slashes (\), 263, 448 backing up data, 301 backing up files (FTP functions), 379-385 closing connections, 385 connecting to remote FTP server, 382 downloading files, 384-385 file update times, check- ing, 383-384 logging in to FTP server, 382 backticks, 366 bar charts, 428 base canvas, setting up, 414-415 baselines, descenders, 417 basename($path) function, 360 basename() function, 363 basic authentication (HTTP), 312-313 in PHP, 314-315 with Apache .htaccess files, 316-319 with IIS, 319-321 BDB table, 263 Bill Gates Wealth Clock Web site, 374 binary large objects (BLOB types), 204-205 bitwise operators, 31 BLOB types (binary large objects), 204-205 blocks (code blocks), 38-39, 142-143 blue-button.png file, 414 Bob’s Auto Parts applica- tion, 11-13 boo.com, 278 book details page (Shopping Cart applica- tion), 549, 555-556, 579 Book-O-Rama (Shopping Cart application). See Shopping Cart applica- tion Book-O-Rama application, 173 Database Search page, 229 designing, 176, 178-180 schema, 184, 194 Web database architecture, 180-181 Book-O-Rama database setting up, 208 tables (SQL code), 210 Book-O-Rama online store (Shopping Cart applica- tion), 541 bookmark.gif, 502 bookmarks, 500 adding, 526-529 deleting, 530-532 displaying, 529-530 recommending, 500 storing, 500 bookmarks.sql, 501 bookmark_fns.php, 501 book_insert.sql file, 210 book_sc database (Shopping Cart applica- tion), 546-548 bounding boxes arrays, contents, 416-417 coordinates, 416 Boutell Web site, 402, 428 40 7842 index 3/6/01 4:22 PM Page 811 boxes 812 boxes, 416. See also bounding boxes branching (regular expressions), 112 break statement, 47 breaking up code, 466- 467 brochureware sites, 269-271 common pitfalls, 269-271 tracking success of sites, 270-271 browsedir.php file, 358 browsers authentication, 292-293 secure transactions, 329- 330 Web database architecture, 180-181 browsing directories, 358 BUGTRAQ archives Web site, exploits, 357 building content management systems, 588 MLM, 656 Burn All Gifs Web sites, 404 buttons Account Settings, 689 base canvas, setting up, 414-415 Change Password, 689 colors, 414 Create Mail, 695 generating with make_ button.php script, 411 Information, 683 Log In, 675 scripts, code to call, 412 Send, 704 submit (users), casting votes, 421 text colors and fonts, 411 fitting onto, 415-418 positioning onto, 418 writing onto, 419 View Mail, 703 C C2Net Web site, 298 CA (Certification Authority), 793 calculate_items() function, 564-565 calculate_price() function, 564 calculating dates in PHP, 398-399 Calendar Conversions Overview Web site, 400 calendar functions, 399 Calendar Conversions Overview Web site, 400 PHP Web site, 400 calling class operations, 154-155 functions, 18 calling functions, 129-132 case sensitivity, 132 parameters, 130 prototypes, 130 undefined functions, 131 calling scripts for buttons, code, 412 canvas images, creating, 405-406 canvases (base), setting up, 414-415 caret symbol (^), regular expressions, 112 Cartesian product (join type), 219 Cartesian product of tables, 215 CAs (Certifying Authorities), 297-298 cascading style sheets (CSS), 472 case, formatting strings, 99-100 case sensitivity, calling functions, 132 casting user votes, 421 code, 420-421 results, drawing, 421 casts (variable types), 23 catalog scripts (Shopping Cart application), 548- 556 index.php, 549-553 show_book.php, 549, 555-556, 579 show_cat.php, 549, 553- 555 catching files (HTML), code, 354-356 category page (Shopping Cart application), 549, 553-555 CERT Advisory Web site, 782 Certificate Signing Request (CSR), 299 Certification Authority (CA), 793 certification project, per- sonalized documents, 752 files, 752 headers, 777-778 index.html, 753-754 PDF, 762-770 PDFlib, 770-777 RTF, 758-762 score.php, 755-757 40 7842 index 3/6/01 4:22 PM Page 812 code 813 Certifying Authorities (CAs), 297-298 CGI Interpreter, 782-783 PHP, running, 782-783 CGI specification Web site, 368 Change Password button, 689 change password() func- tion, 520, 690 CHANGE [COLUMN] column new_column description syntax, 224 change_passwd.php, 501 change_passwd_ form.php, 501 changing file properties, 364 character classes (regular expressions), 110-111 character sets (regular expressions), 109-110 characters, reading, 62-63 charts, bar, 428 check admin user() function, 669 check logged in() function, 669 check normal user() function, 669 check valid user() function, 515 checkdate() function, 396 checkdnsrr() function, 378 checkout.php script (Shopping Cart application), 566-568 check_auth_user() function, 630 chgrp() function, 364 child nodes (Web forum tree structure), 714 chmod() function, 364 choosing development environments, 469 chop() function, 97 chown() function, 364 ciphertext (encryption), 293 classes attributes, 152-154 creating, 151 constructors, 151-152 creating, 150-152 designing, 158-159 inheritance, 150, 155-156 multiple inheritance, 157-158 overriding, 156-157 instantiation, 152 operations calling, 154-155 creating, 151 PHP classes (Snoopy), 389 subclasses, 150, 156-157 superclasses, 150, 156-157 treenode class (Web forum application), 725-731 tree_node class, 713 writing code, 159-168 attributes, 159-160 functions, 160-161 meta tags, 160 operations, 161 Page class code listing, 161-165 ServicesPage class, 166-167 TLA Consulting home page, generating, 165-166 classes (object-oriented development), 149 clauses GROUP BY, 221-222 HAVING, 222 LIMIT, SELECT statement, 222 ORDER BY, SELECT statement, 219 SELECT, 222 WHERE, 212 comparison operators, 212-213 join condition, 215 ClibPDF library Web site, 751 Client URL (cURL) functions, 387-389 curl_init() function, 388 curl_setopt() function, 388 Client URL (cURL) Web site, 390 closeddir() function, 359 closing files, 58-59 code Book-O-Rama database, tables, 210 breaking up, 466-467 buttons, script to call, 412 commenting, 465 content, 471 separating from content, 472 directories, uploaded file listing, 358-359 directory structures, 467 component structures, 467 file status function results, 362, 366-367 function libraries, 467 developing, 467 graphs data, drawing, 424-427 variables, drawing, 423 40 7842 index 3/6/01 4:22 PM Page 813 code 814 HTML file upload, 353 files, catching, 354-356 indenting, 39, 465-466 line graphs, script for outputting, 405 logic, 471 separating from content, 472 naming conventions, 463 function names, 464 modular names, 464 variable names, 463-464 optimizations, 472-473 Zend Optimizer, 473 poll database, setting up, 420-421 prototypes, 471 reusing. See reusing code rewriting, 462-463 standards, 463 testing, 474-475 users, casting votes, 420-421 version control, 467-468 CVS (Concurrent Versions System), 468 multiple programmers, 468 repository, 467-468 vote database retrieving results, 422-423 updating, 422-423 writing, 463 maintainability, 463-467 writing for classes, 159-168 attributes, 159-160 functions, 160-161 meta tags, 160 operations, 161 Page class code listing, 161-165 ServicesPage class, 166-167 TLA Consulting home page, generating, 165-166 code blocks, 38-39, 142- 143 code listings authentication basic authentication with Apache’s .htac- cess files, 316, 318 htaccess file for authenticating users against a MySQL database, 323 PHP and HTTP basic authentication, 314 queries that create auth database, auth table, and sample users, 310 simple authentication mechanism, 306 storing usernames and passwords in data- bases, 308 authentication application authmain.php script, 440 logout.php script, 444 members_only.php script, 443 Book-O-Rama application HTML for Book Entry Page, 238 script that writes new books into database, 239 Book-O-Rama Database Search page, 229 classes Page class, 161, 166 ServicesPage class, 166 directory submission forms, 374 generating Bob’s Freight Table with PHP, 45 HTML for Bob’s Auto Parts order form, 12 HTML for Bob’s Freight Table, 43 HTML form to send encrypted email, 343 HTML that produces TLA Consulting’s home page, 122 loading arrays from files, 85 MySQL database, retriev- ing search results, 230 pages to dump contents of variables for debugging, 487-488 PHP that produces TLA Consulting’s home page, 124 recursion, 143 reordering arrays, 83 script declares custom error handler, 493 script that retrieves stock quote from NASDAQ, 372 script that works out a per- son’s age based on birth- date, 398 script to download new versions of a file from an FTP server, 379 script to email form contents, 94 40 7842 index 3/6/01 4:22 PM Page 814 . Auto Parts applica- tion, 1 1-1 3 boo.com, 278 book details page (Shopping Cart applica- tion), 549, 55 5-5 56, 579 Book-O-Rama (Shopping Cart application). See Shopping Cart applica- tion Book-O-Rama. applica- tion), 57 5-5 84 administration menu (admin .php) , 57 5-5 77 edit_book_form .php script, 580 insert_book .php script, 57 8-5 79 insert_book_form .php script, 578 show_book .php script, 579 administrative. much more. PHP Homepage—http://www .php- homepage.de—Another German site about PHP with scripts, articles, news, and much more. Has a quick reference section. PHPIndex.com—http://www.phpindex.com—A

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

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

Tài liệu liên quan