Beginning PHP5, Apache, and MySQL Web Development.
2005.
Over the course of this book, you will develop two complete Web sites:
- Movie Review Web site. Developing this site introduces you to writing a PHP program, making your pages look professional, working with variables and includes, and integrating PHP with MySQL to make your site truly dynamic as pages are created on the fly for your Web site visitor. You will also get experience in error handling and data validation while working on this site.
- Comic Book Fan Web site. The creation of this Web site takes you through the steps of building databases from scratch, manipulating images and sending out e-mails using PHP, authenticating users, managing content through CMS, creating a mailing list, setting up an e-commerce section, and developing and customizing a discussion forum.
Finally, this book covers how to learn about your visitors through the use of log files and how to troubleshoot common mistakes or problems. The appendixes in this book provide you with the necessary reference materials you’ll need to assist you in your Web site development journey and offer tools to make you more efficient. After reading this book, you will be able to create a well-designed, dynamic Web site using tools available for free. Although this book is not intended to be a detailed analysis of Apache, PHP, and MySQL, it points you in the right direction to explore further issues you may wish to delve into.
Authors:Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass
Contents
Part I: Getting Started 1
Chapter 1: Configuring Your Installation 3
Projects in This Book 3
Brief Intro to PHP, Apache, MySQL, and Open Source 4
A Brief History of Open Source Initiatives 4
Why Open Source Rocks 4
How the Pieces of the AMP Module Work Together 5
Apache 6
PHP 6
MySQL 7
AMP Installers 8
Foxserv 8
PHPTriad 8
XAMPP 8
Configuring Your Apache Installation 8
Testing Your Installation 9
Customizing Your Installation 10
Adding PHP to the Equation 10
Document Root 11
Configuring Your PHP Installation 13
Testing Your Installation 13
Customizing Your Installation 14
Configuring PHP5 to Use MySQL 16
Configuring Your MySQL Installation 17
Testing Your Installation 17
Configuring Your Installation 19
The my.cnf File 21
Setting Up Users and Privileges 24
Where to Go for Help and Other Valuable Resources 25
Help within the Programs 25
Source Web Sites 25
Summary 26
Part II: Movie Review Web Site 27
Chapter 2: Creating PHP Pages Using PHP5 29
Overview of PHP Structure and Syntax 30
How PHP Fits with HTML 30
The Rules of PHP Syntax 30
The Importance of Coding Practices 31
What Makes a Great Program? 32
Why Should You Care about What Your Code Looks Like? 32
Creating Your First Program 33
Using HTML to Spice Up Your Pages 34
Integrating HTML with PHP 34
Considerations with HTML Inside PHP 36
Using Constants and Variables to Add Functionality 37
Overview of Constants 37
Overview of Variables 38
Passing Variables between Pages 40
A Word about register_globals 41
Passing Variables through a URL 42
Special Characters in URLs 45
Passing Variables with Sessions 47
Passing Variables with Cookies 49
Passing Information with Forms 53
Fast Primer on Forms 53
Using if/else Arguments 57
Using if Statements 57
Operators 57
Special Syntax Considerations 58
Using if and else Together 59
Using Includes for Efficient Code 60
Using Functions for Efficient Code 62
All About Arrays 67
Array Syntax 67
Sorting Arrays 69
foreach Constructs 69
While You’re Here . . . 74
Alternate Syntax for PHP 78
Alternates to the Tags 78
Alternates to the echo Command 78
Alternates to Logical Operators 79
Alternates to Double Quotes: Using heredoc 79
Alternates to Incrementing/Decrementing Values 79
OOP Dreams 79
A Brief OOP Example 80
Why Use OOP? 82
Summary 82
Exercises 82
Chapter 3: Using PHP5 with MySQL 85
Overview of MySQL Structure and Syntax 85
MySQL Structure 86
Field Types 86
Choosing the Right Field Type 88
null/not null 89
Indexes 90
Unique 90
Auto Increment 90
Other Parameters 91
Types of MySQL Tables and Storage Engines 91
MySQL Syntax and Commands 92
How PHP Fits with MySQL 92
Connecting to the MySQL Server 93
Looking at a Ready-Made Database 94
Querying the Database 99
WHERE, oh WHERE 99
Working with PHP and Arrays of Data: foreach 102
A Tale of Two Tables 104
Referencing Two Tables 105
Joining Two Tables 107
Helpful Tips and Suggestions 109
Documentation 109
Using PHPMyAdmin 109
Summary 110
Exercises 110
Chapter 4: Using Tables to Display Data 111
Creating a Table 111
Populating the Table 114
Who’s the Master? 120
A Lasting Relationship 128
Summary 134
Exercises 134
Chapter 5: Form Elements: Letting the User Work with Data 135
Your First Form 136
FORM Element 138
INPUT Element 139
Processing the Form 140
Driving the User Input 141
INPUT Checkbox Type 143
One Form, Multiple Processing 144
Radio INPUT Element 148
Multiple Submit Buttons 149
Basic Input Testing 149
Dynamic Page Title 149
Manipulating a String as an Array to Change the Case of the First Character 150
Ternary Operator 150
Using Form Elements Together 150
The Skeleton Script 159
Default Response 159
Adding Items 159
Summary 160
Exercises 161
Chapter 6: Letting the User Edit the Database 163
Preparing the Battlefield 163
Inserting a Simple Record from phpMyAdmin 166
Inserting a Record in a Relational Database 170
Deleting a Record 178
Editing Data in a Record 183
Summary 191
Exercise 191
Chapter 7: Manipulating and Creating Images with PHP 193
Working with the GD Library 193
What File Types Can I Use with GD and PHP? 194
Compiling PHP with GD 194
Allowing Users to Upload Images 196
Converting Image File Types 203
Black and White 208
Adding Captions 214
Adding Watermarks and Merging Images 218
Creating Thumbnails 220
Summary 225
Exercises 225
Chapter 8: Validating User Input 227
Users Are Users Are Users . . . 227
Incorporating Validation into the Movie Site 228
Forgot Something? 229
Checking for Format Errors 239
Summary 250
Exercise 250
Chapter 9: Handling and Avoiding Errors 251
How the Apache Web Server Deals with Errors 251
Apache’s ErrorDocument Directive 252
Apache’s ErrorDocument: Advanced Custom Error Page 256
Error Handling and Creating Error Handling Pages with PHP 260
Error Types in PHP 260
Generating PHP Errors 261
Other Methods of Error Handling 269
Exceptions 269
Not Meeting Conditions 271
Parse Errors 272
Summary 272
Exercises 272
Part III: Comic Book Fan Site 273
Chapter 10: Building Databases 275
Getting Started 275
What Is a Relational Database? 276
Keys 277
Relationships 277
Referential Integrity 278
Normalization 278
Designing Your Database 279
Creating the First Table 279
What’s So Normal About These Forms? 283
Standardization 283
Finalizing the Database Design 284
Creating a Database in MySQL 285
Creating the Comic Character Application 290
charlist.php 316
charedit.php 320
Summary 323
Exercises 324
Chapter 11: Sending E-mail 325
Setting Up PHP to Use E-mail 325
Sending an E-mail 326
Dressing Up Your E-mails with HTML 331
Multipart Messages 334
Storing Images 337
Getting Confirmation 339
Creating a Reusable Mail Class 355
Summary 362
Exercises 363
Chapter 12: User Logins, Profiles, and Personalization 365
The Easiest Way to Protect Your Files 365
Friendlier Logins Using PHP’s Session and Cookie Functions 370
Using Database-Driven Information 375
Using Cookies in PHP 399
Administrator Registration 402
Summary 413
Exercises 413
Chapter 13: Building a Content Management System 415
Getting Your Users to Return 415
Content 415
Management 416
System 416
Putting It All Together 416
Preparing the Database 417
Coding for Reusability 422
outputfunctions.php 426
header.php 429
http.php 431
Transaction Pages 431
User Interface 444
General Functionality 444
User Management 454
Article Publishing 458
Additional CMS Features 472
Summary 479
Exercises 479
Chapter 14: Mailing Lists 481
What Do You Want to Send Today? 481
Coding the Administration Application 482
Sign Me Up! 497
user.php 504
user_transact.php 505
thanks.php 509
Mailing List Ethics 514
A Word About Spam 514
Opt-In versus Opt-Out 514
Summary 515
Exercises 515
Chapter 15: Online Stores 517
Adding E-Commerce to the Comic Book Fan Site 518
Something to Sell 518
A Shopping Cart 519
Shopping Cart Software 519
Your Own Cart Software Code 519
E-Commerce, Any Way You Slice It 559
Information Is Everything 560
Importance of Trust 560
Privacy Policy 561
Return Policy 561
Warm Bodies 561
Secure Credit Card Processing 561
Professional Look 562
Easy Navigation 562
Common Links 562
Search Function 562
Typical Design 562
Competitive Pricing 562
Appropriate Merchandise 563
Timely Delivery 563
Communication 563
Customer Feedback 563
Summary 564
Exercises 564
Chapter 16: Creating a Bulletin Board System 567
Your Bulletin Board 567
Preparing the Database 569
Reusable Code 577
Pagination 586
Breadcrumbs 590
A Last Look at User Authentication 592
Transaction Pages 593
Account Functionality 604
User Administration 617
Forum Functionality 618
Board Administration 622
Forum Administration 623
BBcode Administration 624
Regular Expressions 624
The Two Types of regex Functions 624
How to Write a PCRE regex 625
Searching 636
Afterthoughts 638
Summary 639
Exercises 639
Chapter 17: Using Log Files to Improve Your Site 641
Locating Your Logs 642
Apache 642
PHP 644
MySQL 644
Analyzing Your Log Data 646
Webalizer 646
Analog 647
WebTrends 648
AWStats 649
HTTP Analyze 650
Putting the Analysis to Work 651
Site Health 651
User Preferences and Information 651
Number of Hits and Page Views 651
Trends over Time 652
Referring Sites 652
Summary 652
Chapter 18: Troubleshooting 653
Installation Troubleshooting 653
Parse Errors 653
Cleanup on Line 26 . . . Oops, I Mean 94 654
Elementary, My Dear Watson! 654
Empty Variables 655
The Ultimate Bait-and-Switch 655
Consistent and Valid Variable Names 656
Open a New Browser 656
“Headers Already Sent” Error 657
General Debugging Tips 658
Using echo 658
Divide and Conquer 659
Test, Test, Test! 659
Where to Go for Help 659
www.wrox.com 659
PHPBuilder.com 659
Source Web Sites 660
Search and Rescue 660
IRC Channels 660
Summary 660
Appendix A: Answers to Exercises 661
Appendix B: PHP Quick Reference 703
Appendix C: PHP5 Functions 707
Appendix D: MySQL Data Types 747
Appendix E: MySQL Quick Reference 751
Appendix F: Comparison of Text Editors 755
Appendix G: Choosing a Third-Party Host 759
Appendix H: An Introduction to PEAR 763
Appendix I: AMP Installation 771
Index 777
Бесплатно скачать электронную книгу в удобном формате, смотреть и читать:
Скачать книгу Beginning PHP5, Apache, and MySQL Web Development - fileskachat.com, быстрое и бесплатное скачивание.
Скачать pdf
Ниже можно купить эту книгу по лучшей цене со скидкой с доставкой по всей России.Купить эту книгу
Скачать книгу Beginning PHP5, Apache, and MySQL Web Development - depositfiles
Скачать книгу Beginning PHP5, Apache, and MySQL Web Development - rapidshare
Дата публикации:
Теги: программирование :: PHP :: PHP5 :: beginning PHP5 :: apache :: web development :: web sites :: movie review web site :: comic book fan web site :: Gerner :: Glass :: обучение PHP :: самоучитель по PHP :: Хольцнер :: самоучитель PHP :: обучение на примерах :: основы PHP :: PHP для начинающих :: язык программирования PHP :: программирование на PHP :: примеры программирования на PHP :: CGI-сценарии :: сервер Apache :: РНР-функции :: cookie :: сеансы :: FTP :: e-mail :: базы данных :: MySQL :: ООП :: Web-приложения :: строки :: массивы :: книга :: операторы :: скачать
Смотрите также учебники, книги и учебные материалы:
Следующие учебники и книги:
- Web Application Development with PHP 4.0, Ratschiller T., Gerken T.
- MySQL and Java Developer’s Guide, Matthews M., Cole J., Gradecki D.D.
- Secure PHP Development, Building 50 Practical Applications, Kabir M.J.
- Beginning MySQL, Sheldon R., Moes G.
Предыдущие статьи:
- Си Шарп, Создание приложений для Windows, Лабор В.В.
- PHP for the World Wide Web, Visual QuickStart Guide, Ullman L.
- PHP Hacks, Herrington J.
- Web Database Application with PHP and MySQL, Lane D., Williams H.E.