Beginning PHP, Apache, MySQL Web Development (Programmer to Programmer)
معرفی کتاب «Beginning PHP, Apache, MySQL Web Development (Programmer to Programmer)» نوشتهٔ Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner، منتشرشده توسط نشر Wrox; Wiley در سال 2004. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «Beginning PHP, Apache, MySQL Web Development (Programmer to Programmer)» در دستهٔ بدون دستهبندی قرار دارد.
What is this book about? PHP, Apache, and MySQL are the three key open source technologies that form the basis for most active Web servers. This book takes you step-by-step through understanding each — using it and combining it with the other two on both Linux and Windows servers. This book guides you through creating your own sites using the open source AMP model. You discover how to install PHP, Apache, and MySQL. Then you create PHP Web pages, including database management and security. Finally, you discover how to integrate your work with e-commerce and other technologies. By building different types of Web sites, you progress from setting up simple database tables to tapping the full potential of PHP, Apache, and MySQL. When you're finished, you will be able to create well-designed, dynamic Web sites using open source tools. What does this book cover? Here's what you will learn from this book: How PHP server-side scripting language works for connecting HTML-based Web pages to a backend database Syntax, functions, and commands for PHP, Apache, and MySQL Methods and techniques for building user-friendly forms How to easily store, update, and access information using MySQL Ways to allow the user to edit a database E-commerce applications using these three technologies How to set up user logins, profiles, and personalizations Proper protocols for error handling Who is this book for? This book is for beginners who are new to PHP and who need to learn quickly how to create Web sites using open source tools. Some basic HTML knowledge is helpful but not essential. Team DDU Cover 1 Contents 12 Introduction 24 Part I: Getting Started 30 1: Introduction and Installation Configuration 32 Installation Configuration 32 Brief Intro to PHP, Apache, MySQL, and Open Source 33 What Is Open Source? 33 How the Pieces of the AMP Module Work Together 34 Apache 35 PHP 36 MySQL 36 PHP5: The Future of PHP 37 A Brief Overview of PHP5 37 How Changing to PHP5 Affects This Book 37 Installation Configuration of Apache 37 Customizing Your Installation 38 Installation Configuration of PHP 40 Testing Your Installation 41 Customizing Your Installation 42 Installation Configuration of MySQL 43 Testing Your Installation 43 Configuring Your Installation 46 Try It Out: Setting Up Privileges 50 Where to Go for Help and Other Valuable Resources 51 Help within the Programs 51 Source Web Sites 51 AMP Installers 52 Summary 52 Part II: Movie Review Web Site 54 2: Creating PHP Pages 56 Overview of PHP Structure and Syntax 57 How PHP Fits with HTML 57 The Rules of PHP Syntax 57 The Importance of Coding Practices 58 Creating Your First Program 59 Try It Out: Using echo 60 Using HTML to Spice Up Your Pages 61 Integrating HTML with PHP 62 Try It Out: Using PHP within HTML 62 Considerations with HTML Inside PHP 63 Using Constants and Variables to Spice Up Your Pages 64 Overview of Constants 64 Try It Out: Using Constants 65 Overview of Variables 66 Try It Out: Using Variables 66 Passing Variables Between Pages 68 Try It Out: Using URL Variables 70 Try It Out: Passing the Visitor's Username 75 What Is a Cookie? 78 Try It Out: Setting a Cookie 79 Passing Through Forms 81 Try It Out: Using Forms to Get Information 82 Using if/else Arguments 86 Using if Statements 86 Try It Out: Using if 87 Using if and else Together 88 Try It Out: Using if and else 88 Using Includes for Efficient Code 88 Try It Out: Adding a Welcome Message 89 Using Functions for Efficient Code 91 Try It Out: Working with Functions 91 A Word About Arrays 96 Array Syntax 96 Sorting Arrays 96 Try It Out: Sorting Arrays 97 foreach Constructs 97 Try It Out: Adding Arrays 98 While You're Here . . . 102 Try It Out: Using the while Function 103 Alternate Syntax for PHP 106 Alternates to the php Tags 106 Alternates to the echo Command 106 Alternates to Logical Operators 107 Alternates to Double Quotes: Using heredoc 107 Alternates to Incrementing Values 107 Summary 107 Exercises 108 3: Using PHP with MySQL 110 Overview of MySQL Structure and Syntax 110 MySQL Structure 111 MySQL Syntax and Commands 117 How PHP Fits with MySQL 117 Connecting to the MySQL Server 118 Looking at a Ready-Made Database 119 Try It Out: Creating a Database 119 Querying the Database 124 WHERE, oh WHERE 125 Try It Out: Using the SELECT Query 125 Working with PHP and Arrays of Data: foreach 128 Try It Out: Using foreach 128 A Tale of Two Tables 129 Try It Out: Referencing Individual Tables 129 Try It Out: Joining Two Tables 130 Helpful Tips and Suggestions 132 Documentation 132 Using PHPMyAdmin 132 Summary 133 Exercises 133 4: Using Tables to Display Data 134 Creating a Table 134 Try It Out: Defining the Table Headings 134 Populating the Table 137 Try It Out: Filling the Table with Data 137 Try It Out: Putting it All Together 139 Try It Out: Improving Our Table 140 Who's the Master? 143 Try It Out: Adding Links to the Table 143 Try It Out: Adding Data to the Table 145 Try It Out: Calculating Movie Takings 146 Try It Out: Displaying the New Information 147 Try It Out: Displaying Movie Details 149 A Lasting Relationship 151 Try It Out: Creating and Filling a Movie Review Table 151 Try It Out: Querying for the Reviews 152 Try It Out: Displaying the Reviews 154 Summary 156 5: Form Elements: Letting the User Work with Data 158 Your First Form 159 Try It Out: Say My Name 159 FORM Element 161 INPUT Element 162 Processing the Form 163 Driving the User Input 164 Try It Out: Limiting the input choice 164 INPUT Checkbox Type 167 One Form, Multiple Processing 168 Try It Out: Radio Button, Multi-Line List Boxes 168 Radio INPUT Element 172 Multiple Submit Buttons 173 Basic Input Testing 173 Dynamic Page Title 174 Manipulating a String as an Array to Change the Case of the First Character 174 Ternary Operator 174 Using Them All 175 Try It Out: Hidden and password input 175 The Skeleton Script 183 Default Response 183 Adding Items 183 Summary 184 6: Letting the User Edit the Database 186 Preparing the Battlefield 186 Try It Out: Setting Up the Environment 187 Inserting a Simple Record from phpMyAdmin 189 Try It Out: Inserting Simple Data 189 Inserting a Record in a Relational Database 192 Try It Out: Inserting a Movie with Known Movie Type and People 193 Deleting a Record 200 Try It Out: Deleting a Single Record 200 Cascade Delete 200 Try It Out: Cascade Delete 200 Editing Data in a Record 205 Try It Out: Editing a Movie 205 Summary 213 7: Validating User Input 214 Users Are Users Are Users . . . 214 What Now? 215 Forgot Something? 216 Try It Out: Setting Up the Environment 216 Checking for Format Errors 226 Try It Out: Checking Dates and Numbers 226 Summary 237 8: Handling and Avoiding Errors 238 How the Apache Web Server Deals with Errors 238 Apache's ErrorDocument Directive 239 Try It Out: Using Apache's ErrorDocument Method 239 Apache's ErrorDocument: Advanced Custom Error Page 243 Error Handling and Creating Error Handling Pages with PHP 247 Other Methods of Error Handling 255 Summary 256 Exercises 256 Part III: Comic Book Fan Site 258 9: Building Databases 260 Getting Started 260 Nam et Ipsa Scientia Potestas Est! 261 What Is a Relational Database? 261 Keys 262 Relationships 263 Referential Integrity 264 Normalization 264 Designing Your Database 264 Creating the First Table 265 What's So Normal About These Forms? 268 Standardization 269 Finalizing the Database Design 269 Creating a Database in MySQL 270 Try It Out: Create the Table 271 Creating the Comic Character Application 275 Try It Out: The Comic Book Character Site 276 Summary 306 10: E-mailing with PHP 308 Setting Up PHP to Use E-mail 308 Sending an E-mail 309 Try It Out: Sending a Simple E-mail 309 Try It Out: Collecting Data and Sending an E-mail 310 Dressing Up Your E-mails with HTML 314 Try It Out: Sending HTML Code in an E-mail 314 Try It Out: Sending HTML by Using Headers 315 Multipart Messages 317 Try It Out: Multipart Messages 317 Storing Images 320 Try It Out: Storing Images 320 Getting Confirmation 322 Try It Out: Getting Confirmation 323 Summary 338 11: User Logins, Profiles, and Personalization 340 The Easiest Way to Protect Your Files 340 Try It Out: Creating htaccess and htpasswd Files 341 Friendlier Logins Using PHP's Session and Cookie Functions 345 Try It Out: Using PHP for Logins 345 Using Database-Driven Information 348 Try It Out: Session Tracking with PHP and MySQL 350 Try It Out: Cookie Tracking with PHP 368 Try It Out: Administration Section 371 Summary 380 12: Building a Content Management System 382 Getting Your Users to Return 382 Content 382 Management 383 System 383 Putting It All Together 383 Getting Started 384 Try It Out: The Content Management System Application 384 Summary 444 13: Mailing Lists 446 First Things First 446 What Do You Want to Send Today? 447 Coding the Application 447 Try It Out: Mailing List Administration 447 Sign Me Up! 460 Try It Out: Mailing List Signup 460 Mailing List Ethics 477 A Word About Spam (and SPAM) 477 Opt-In vs. Opt-Out 478 Summary 479 14: Online Selling: A Quick Way to E-Commerce 480 Adding E-Commerce to the Comic Book Fan Site 481 Something to Sell 481 A Shopping Cart 482 Try It Out: Defining the Database and Tables 483 Try It Out: Adding Your Products 486 Try It Out: Creating the Store Home Page 490 Try It Out: Viewing the Products 492 Try It Out: Creating a Table for the Shopping Cart 494 Try It Out: Adding Products to the Cart 495 Try It Out: Viewing the Shopping Cart 496 Try It Out: Changing Items in the Cart 500 Try It Out: Checking Out: Step One 501 Try It Out: Checking Out: Step Two 506 Try It Out: Checking Out: Step Three 513 E-Commerce, Any Way You Slice It 520 Information Is Everything 521 Importance of Trust 521 Easy Navigation 523 Competitive Pricing 524 Appropriate Merchandise 524 Timely Delivery 524 Communication 524 Customer Feedback 524 Summary 525 Exercises 525 15: Creating a Bulletin Board System 526 History of the Computer Bulletin Board 526 Your Bulletin Board 527 Try It Out: The Bulletin Board Code 528 Try It Out: The Bulletin Board Application 564 setup.php 573 A Last Look at User Authentication 574 admin.php 575 Searching 582 Pagination 584 Breadcrumbs 588 Going Out in Style 590 Afterthoughts 591 Summary 591 Exercises 592 Part IV: Advanced Users 594 16: Using Log Files to Improve Your Site 596 What Is a Log? 597 Where Are These Logs? 597 Apache 597 PHP 599 MySQL 599 Now That I Know What and Where They Are, What Do I Do with Them? 602 Webalizer 602 Analog 603 WebTrends 603 AWStats 606 HTTP Analyze 606 What Do the Reports Mean? 607 User Preferences and Information 608 Number of Hits and Page Views 608 Trends over Time 608 Referring Sites 609 Summary 609 17: Troubleshooting 610 Installation Troubleshooting 610 Parse Errors 611 Cleanup on Line 26 . . . Oops, I Mean 94 611 Elementary, My Dear Watson! 611 Empty Variables 612 The Ultimate Bait-and-Switch 612 Consistent and Valid Variable Names 613 Open a New Browser 613 "Headers Already Sent" Error 613 General Debugging Tips 614 Using echo 614 Divide and Conquer 615 Test, Test, Test! 615 Where to Go for Help 616 wrox.com 616 PHPBuilder.com 616 Source Web Sites 616 Search and Rescue 616 IRC Channels 617 Summary 617 Appendix A: Answers to Exercises 618 2 618 3 621 8 624 14 625 15 626 Appendix B: PHP Quick Reference 628 PHP Syntax 628 Displaying to Browser 628 Setting a Value to a Variable 628 Passing Variables 629 Through a URL 629 Through Sessions 629 Through a Form 629 if Statements 629 else Statements 630 Nested if Statements 630 Including a File 630 Using Functions 630 Arrays 631 for 631 foreach 632 Appendix C: PHP Functions 634 Apache/PHP Functions 634 Array Functions 635 Date/Time/Calendar Functions 639 Class/Object/Function Handling Functions 642 Directory and File Functions 643 Error Handling and Logging Functions 647 HTTP Functions 647 Image Functions 647 Mail Functions 652 Mathematical Functions 653 Miscellaneous Functions 654 MySQL Functions 655 Network Functions 657 Output Buffer Functions 659 PHP Configuration Information 659 Program Execution Functions 661 Spelling Functions 661 Session Functions 662 String Functions 663 URL Functions 668 Variable Functions 668 Appendix D: MySQL Data Types 670 Appendix E: MySQL Quick Reference 674 Database Manipulation Commands 674 Connecting to the Database 675 Accessing the Database 675 Retrieving Data from the Database 675 Condition Clauses 675 Selecting from Multiple Tables 676 Sorting the Results 676 Limiting the Results 676 Appendix F: Comparison of Text Editors 678 Appendix G: Choosing a Third-Party Host 680 Hosting Options 680 Supported Languages 681 Supported Databases 681 Server Control and Access 681 Administration GUIs 682 Bandwidth and Site Usage 682 Pricing 683 Making the Choice 683 Appendix H: An Introduction to PEAR 684 What Is PEAR? 685 Requirements 685 The Packages 685 PEAR DB 686 Other PEAR Packages 689 HTML 689 Authentication 690 Payment 690 Mail 690 Appendix I: AMP Installation 692 Installing with Windows 692 Install Apache 692 Install PHP 693 Install MySQL 694 Installing with Linux 695 Install MySQL 695 Install Apache 696 Install PHP 697 Index 700 PHP, Apache, and MySQL are the three key open source technologies that form the basis for most active Web servers. This book takes you step by step through understanding each -- using it and combining it with the other two on both Linux and Windows servers. This book will guide you through creating your own sites using the open source AMP model. You'll learn to install PHP, Apache, and MySQL. Then you'll create PHP Web pages, including database management and security. Finally, you'll discover how to integrate your work with e-commerce and other technologies. By building different types of Web sites, you will progress from setting up simple database tables to tapping the full potential of PHP, Apache, and MySQL. When you're finished, you will be able to create well-designed, dynamic Web sites using open source tools. This book is for beginners who are new to PHP and who need to learn quickly how to create Web sites using open source tools. Some basic HTML knowledge is helpful but not essential. * An ideal introduction to the entire process of setting up a Web site using PHP (a scripting language), MySQL (a database management system), and Apache (a Web server)
* Programmers will be up and running in no time, whether they're using Linux or Windows servers
* Shows readers step by step how to create several Web sites that share common themes, enabling readers to use these examples in real-world projects
* Invaluable reading for even the experienced programmer whose current site has outgrown the traditional static structure and who is looking for a way to upgrade to a more efficient, user-friendly site
* The companion Web site features sample PHP scripts, as well as two fully functional working applications from the book. This book guides the reader through the entire process of setting up their own site using the open source AMP model. During the course of the book, several Web sites are created, with common themes, so that the reader may utilize these examples in the real world. The book is multi-platform, and will address installation and usage on both Linux and Windows and can be used as a reference for PHP, MySQL and Apache syntax, functions, and commands
دانلود کتاب Beginning PHP, Apache, MySQL Web Development (Programmer to Programmer)
* Programmers will be up and running in no time, whether they're using Linux or Windows servers
* Shows readers step by step how to create several Web sites that share common themes, enabling readers to use these examples in real-world projects
* Invaluable reading for even the experienced programmer whose current site has outgrown the traditional static structure and who is looking for a way to upgrade to a more efficient, user-friendly site
* The companion Web site features sample PHP scripts, as well as two fully functional working applications from the book. This book guides the reader through the entire process of setting up their own site using the open source AMP model. During the course of the book, several Web sites are created, with common themes, so that the reader may utilize these examples in the real world. The book is multi-platform, and will address installation and usage on both Linux and Windows and can be used as a reference for PHP, MySQL and Apache syntax, functions, and commands