1. Trang chủ
  2. » Công Nghệ Thông Tin

Secure PHP Development- P2 docx

5 355 0

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

THÔNG TIN TÀI LIỆU

Cấu trúc

  • Secure PHP Development

    • Front Matter

      • Preface

        • Is This Book for You?

        • How This Book Is Organized

        • Tell Us What You Think

      • Acknowledgments

      • Contents at a Glance

      • Contents

    • Part I

      • Chapter 1: Features of Practical PHP Applications

        • Features of a Practical PHP Application

        • Employing the Features in Applications

        • Summary

      • Chapter 2: Understanding and Avoiding Security Risks

        • Identifying the Sources of Risk

        • Minimizing User-Input Risks

        • Not Revealing Sensitive Information

        • Summary

      • Chapter 3: PHP Best Practices

        • Best Practices for Naming Variables and Functions

        • Best Practices for Function/Method

        • Best Practices for Database

        • Best Practices for User Interface

        • Best Practices for Documentation

        • Best Practices for Web Security

        • Best Practices for Source Configuration Management

        • Summary

    • Part II

      • Chapter 4: Architecture of an Intranet Application

        • Understanding Intranet Requirements

        • Building an Intranet Application Framework

        • Creating a Database Abstraction Class

        • Creating an Error Handler Class

        • Creating a Built-In Debugger Class

        • Creating an Abstract Application Class

        • Creating a Sample Application

        • Summary

      • Chapter 5: Central Authentication System

        • How the System Works

        • Creating an Authentication Class

        • Creating the Central Login Application

        • Creating the Central Logout Application

        • Creating the Central Authentication Database

        • Testing Central Login and Logout

        • Making Persistent Logins in Web Server Farms

        • Summary

      • Chapter 6: Central User Management System

        • Identifying the Functionality Requirements

        • Creating a User Class

        • User Interface Templates

        • Creating a User Administration Application

        • Creating a User Password Application

        • Creating a Forgotten-Password Recovery Application

        • Summary

      • Chapter 7: Intranet System

        • Identifying Functionality Requirements

        • Designing the Database

        • Designing and Implementing the Intranet Classes

        • Setting Up Application Configuration Files

        • Setting Up the Application Templates

        • Intranet Home Application

        • Installing Intranet Applications from the CD- ROM

        • Testing the Intranet Home Application

        • Summary

      • Chapter 8: Intranet Simple Document Publisher

        • Identifying the Functionality Requirements

        • The Prerequisites

        • Designing the Database

        • The Intranet Document Application Classes

        • Setting up Application Configuration Files

        • Setting Up the Application Templates

        • The Document Publisher Application

        • Installing Intranet Document Application

        • Testing Intranet Document Application

        • Summary

      • Chapter 9: Intranet Contact Manager

        • Functionality Requirements

        • Understanding Prerequisites

        • The Database

        • The Intranet Contact Manager Application Classes

        • The Application Configuration Files

        • The Application Templates

        • The Contact Category Manager Application

        • The Contact Manager Application

        • Installing Intranet Contract Manager

        • Testing Contract Manager

        • Summary

      • Chapter 10: Intranet Calendar Manager

        • Identifying Functionality Requirements

        • Understanding Prerequisites

        • Designing the Database

        • The Intranet Calendar Application Event Class

        • The Application Configuration Files

        • The Application Templates

        • The Calendar Manager Application

        • The Calendar Event Manager Application

        • Installing the Event Calendar on Your Intranet

        • Testing the Event Calendar

        • Summary

      • Chapter 11: Internet Resource Manager

        • Functionality Requirements

        • Understanding the Prerequisites

        • Designing the Database

        • Designing and Implementing the Internet Resource Manager Application Classes

        • Creating Application Configuration Files

        • Creating Application Templates

        • Creating a Category Manager Application

        • Creating a Resource Manager Application

        • Creating a Resource Tracking Application

        • Creating a Search Manager Application

        • Installing an IRM on Your Intranet

        • Testing IRM

        • Security Concerns

        • Summary

      • Chapter 12: Online Help System

        • Functionality Requirements

        • Understanding the Prerequisites

        • Designing and Implementing the Help Application Classes

        • Creating Application Configuration Files

        • Creating Application Templates

        • Creating the Help Indexing Application

        • Creating the Help Application

        • Installing Help Applications

        • Testing the Help System

        • Security Considerations

        • Summary

    • Part III

      • Chapter 13: Tell-a-Friend System

        • Functionality Requirements

        • Understanding Prerequisites

        • Designing the Database

        • Designing and Implementing the Tell- a- Friend Application Classes

        • Creating Application Configuration Files

        • Creating Application Templates

        • Creating the Tell-a-Friend Main Menu Manager Application

        • Creating a Tell-a-Friend Form Manager Application

        • Creating a Tell-a-Friend Message Manager Application

        • Creating a Tell-a-Friend Form Processor Application

        • Creating a Tell-a-Friend Subscriber Application

        • Creating a Tell-a-Friend Reporter Application

        • Installing a Tell-a-Friend System

        • Testing the Tell-a-Friend System

        • Security Considerations

        • Summary

      • Chapter 14: E-mail Survey System

        • Functionality Requirements

        • Architecture of the Survey System

        • Designing the Database

        • Designing and Implementing the Survey Classes

        • Designing and Implementing the Survey Applications

        • Developing Survey Execution Manager

        • Setting Up the Central Survey Configuration File

        • Setting Up the Interface Template Files

        • Testing the Survey System

        • Security Considerations

        • Summary

      • Chapter 15: E-campaign System

        • Features of an E-campaign System

        • Architecting an E-campaign System

        • Designing an E-campaign Database

        • Understanding Customer Database Requirements

        • Designing E-campaign Classes

        • Creating Common Configuration and Resource Files

        • Creating Interface Template Files

        • Creating an E-campaign User Interface Application

        • Creating a List Manager Application

        • Creating a URL Manager Application

        • Creating a Message Manager Application

        • Creating a Campaign Manager Application

        • Creating a Campaign Execution Application

        • Creating a URL Tracking and Redirection Application

        • Creating an Unsubscription Tracking Application

        • Creating a Campaign Reporting Application

        • Testing the E-Campaign System

        • Security Considerations

        • Summary

    • Part IV

      • Chapter 16: Command-Line PHP Utilities

        • Working with the Command-Line Interpreter

        • Building a Simple Reminder Tool

        • Building a Geo Location Finder Tool for IP

        • Building a Hard Disk Usage Monitoring Utility

        • Building a CPU Load Monitoring Utility

        • Summary

      • Chapter 17: Apache Virtual Host Maker

        • Understanding an Apache Virtual Host

        • Defining Configuration Tasks

        • Creating a Configuration Script

        • Developing makesite

        • Installing makesite on Your System

        • Testing makesite

        • Summary

      • Chapter 18: BIND Domain Manager

        • Features of makezone

        • Creating the Configuration File

        • Understanding makezone

        • Installing makezone

        • Testing makezone

        • Summary

    • Part V

      • Chapter 19: Web Forms Manager

        • Functionality Requirements

        • Understanding Prerequisites

        • Designing the Database

        • Designing and Implementing the Web Forms Manager Application Classes

        • Creating the Application Configuration Files

        • Creating Application Templates

        • Creating the Web Forms Submission Manager Application

        • Creating the Web Forms Reporter Application

        • Creating the CSV Data Exporter Application

        • Installing the Web Forms Manager

        • Testing the Web Forms Manager

        • Security Considerations

        • Summary

      • Chapter 20: Web Site Tools

        • Functionality Requirements

        • Understanding Prerequisites

        • Designing the Database

        • Designing and Implementing the Voting Tool Application Class

        • Creating the Application Configuration Files

        • Creating the Application Templates

        • Creating the Vote Application

        • Installing the Voting Tool

        • Testing the Voting Tool

        • Summary

    • Part VI

      • Chapter 21: Speeding Up PHP Applications

        • Benchmarking Your PHP Application

        • Buffering Your PHP Application Output

        • Compressing Your PHP Application Output

        • Caching Your PHP Applications

        • Summary

      • Chapter 22: Securing PHP Applications

        • Controlling Access to Your PHP Applications

        • Securely Uploading Files

        • Using Safe Database Access

        • Recommended php.ini Settings for a Production Environment

        • Limiting File System Access for PHP Scripts

        • Running PHP Applications in Safe Mode

        • Summary

    • Part VII

      • Appendix A: What's on the CD-ROM

        • System Requirements

        • What's on the CD

        • Troubleshooting

      • Appendix B: PHP Primer

        • Object-Oriented PHP

      • Appendix C: MySQL Primer

        • Using MySQL from the Command- Line

        • Using phpMyAdmin to Manage MySQL Database

      • Appendix D: Linux Primer

        • Installing and Configuring Apache 2.0

        • Installing and Configuring MySQL Server

        • Installing and Configuring PHP for Apache 2.0

        • Common File/Directory Commands

        • Index

        • Wiley Publishing, Inc. End-User License Agreement

Nội dung

Secure PHP Development: Building 50 Practical Applications Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2003 by Wiley Publishing, Inc., Indianapolis, Indiana Published by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 0-7645-4966-9 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 1B/SU/QU/QT/IN No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8700. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4447, E-Mail: permcoordinator@wiley.com. is a trademark of Wiley Publishing, Inc. LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: WHILE THE PUBLISHER AND AUTHOR HAVE USED THEIR BEST EFFORTS IN PREPARING THIS BOOK, THEY MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS BOOK AND SPECIFICALLY DISCLAIM ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES REPRESENTATIVES OR WRITTEN SALES MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR YOUR SITUATION. YOU SHOULD CONSULT WITH A PROFESSIONAL WHERE APPROPRIATE. NEITHER THE PUBLISHER NOR AUTHOR SHALL BE LIABLE FOR ANY LOSS OF PROFIT OR ANY OTHER COMMERCIAL DAMAGES, INCLUDING BUT NOT LIMITED TO SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR OTHER DAMAGES. For general information on our other products and services or to obtain technical support, please contact our Customer Care Department within the U.S. at (800) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. Library of Congress Cataloging-in-Publication Data Library of Congress Control Number: 2003101844 Trademarks: Wiley, the Wiley Publishing logo, and related trade dress are trademarks or registered trademarks of Wiley Publishing, Inc., in the United States and other countries, and may not be used without written permission. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. 01549669 FM.qxd 4/4/03 9:23 AM Page iv Credits SENIOR ACQUISITIONS EDITOR Sharon Cox ACQUISITIONS EDITOR Debra Williams Cauley PROJECT EDITOR Sharon Nash DEVELOPMENT EDITORS Rosemarie Graham Maryann Steinhart TECHNICAL EDITORS Richard Lynch Bill Patterson COPY EDITORS Elizabeth Kuball Luann Rouff EDITORIAL MANAGER Mary Beth Wakefield VICE PRESIDENT & EXECUTIVE GROUP PUBLISHER Richard Swadley VICE PRESIDENT AND EXECUTIVE PUBLISHER Bob Ipsen VICE PRESIDENT AND PUBLISHER Joseph B. Wikert EXECUTIVE EDITORIAL DIRECTOR Mary Bednarek PROJECT COORDINATOR Dale White GRAPHICS AND PRODUCTION SPECIALISTS Beth Brooks Kristin McMullan Heather Pope QUALITY CONTROL TECHNICIANS Tyler Connoley David Faust Andy Hollandbeck PROOFREADING AND INDEXING TECHBOOKS Production Services 01549669 FM.qxd 4/4/03 9:23 AM Page v About the Author Mohammed J. Kabir is CEO and founder of EVOKNOW, Inc. His company (www.evoknow.com) develops software using LAMP (Linux, Apache, MySQL, and PHP), Java, and C++. It specializes in custom software development and offers security consulting services to many companies around the globe. When he is not busy managing software projects or writing books, Kabir enjoys riding mountain bikes and watching sci-fi movies. Kabir studied computer engi- neering at California State University, Sacramento, and is also the author of Apache Server 2 Bible, Apache Server Administrator’s Handbook, and Red Hat Server 8. You can contact Kabir via e-mail at kabir@evoknow.com or visit the book’s Web site at http://www.evoknow.com/publications/books/phpbook.php. 01549669 FM.qxd 4/4/03 9:23 AM Page vi Preface Welcome to Secure PHP Development: Building 50 Practical Applications. PHP has come a long way since its first incarnation as a Perl script. Now PHP is a pow- erful Web scripting language with object-oriented programming support. Slowly but steadily it has entered the non-Web scripting arena often reserved for Perl and other shell scripting languages. Arguably, PHP is one of the most popular Web plat- forms. In this book you will learn about how to secure PHP applications, how to develop and use an application framework to develop many useful applications for both Internet and intranet Web sites. Is This Book for You? This is not a PHP language book for use as reference. There are many good PHP language books out there. This book is designed for intermediate- to advanced- level PHP developers who can review the fifty PHP applications developed for this book and deploy them as is or customize them as needed. However, it is entirely possible for someone with very little PHP background to deploy the applications developed for this book. Therefore, even if you are not currently a PHP developer, you can make use of all the applications with very little configuration changes. If you are looking for example applications that have defined features and implementation requirements, and you want to learn how applications are devel- oped by professional developers, this book a great starting point. Here you will find numerous examples of applications that have been designed from the ground up using a central application framework, which was designed from scratch for this book. The book shows developers how PHP applications can be developed by keeping security considerations in focus and by taking advantage of an object-oriented approach to PHP programming whenever possible to develop highly maintainable, extensible applications for Web and intranet use. How This Book Is Organized The book is organized into seven parts. Part I: Designing PHP Applications Part I is all about designing practical PHP applications while understanding and avoiding security risks. In this part, you learn about practical design and imple- mentation considerations, best practices, and security risks and the techniques you can take to avoid them. vii 01549669 FM.qxd 4/4/03 9:23 AM Page vii Part II: Developing Intranet Solutions Part II introduces you to the central application framework upon which almost all the Web and intranet applications designed and developed for this book are based. The central application framework is written as a set of object-oriented PHP classes. Using this framework of classes, you are shown how to develop a set of intranet applications to provide central authentication, user management, simple document publishing, contact management, shared calendar, and online help for your intranet users. Because all of the applications in this part of the book are based on the core classes discussed in the beginning of the book, you will see how that architecture works very well for developing most common applications used in modern intranets. Part III: Developing E-mail Solutions Part III deals with e-mail applications. These chapters describe a suite of e-mail applications such as Tell-a-Friend applications, e-mail-based survey applications, and a MySQL database-driven e-mail campaign system that sends, tracks, and reports e-mail campaigns. Part IV: Using PHP for Sysadmin Tasks Part IV focuses on demonstrating how PHP can become a command-line scripting platform for managing many system administration tasks. In these chapters, you learn to work with many command-line scripts that are designed for small, specific tasks and can be run automatically via Cron or other scheduling facilities. Applications developed in this part include the Apache virtual host configuration generator, the BIND zone generator, a multi-user e-mail reminder tool, a POP3 spam filtering tool, a hard disk partition monitoring tool, a system load monitoring tool, and more. Part V: Internet Applications In Part V, you learn how to develop a generic Web form management application suite and a voting (poll) application for your Web site. Because Web form manage- ment is the most common task PHP performs, you will learn a general-purpose design that shows you how PHP can be used to centralize data collection from Web visitors, a critical purpose of most Web sites. Part VI: Tuning and Securing PHP Applications In this part, you learn ways to fine-tune your PHP applications for speed and secu- rity. You will learn how to benchmark your applications, and cache your applica- tion output and even application opcode. You will also learn to protect your applications using various security measures involving PHP development and the Apache Web server platform. viii Preface 01549669 FM.qxd 4/4/03 9:23 AM Page viii . at http://www.evoknow.com/publications/books/phpbook .php. 01549669 FM.qxd 4/4/03 9:23 AM Page vi Preface Welcome to Secure PHP Development: Building 50 Practical Applications. PHP has come a long way since. a PHP language book for use as reference. There are many good PHP language books out there. This book is designed for intermediate- to advanced- level PHP developers who can review the fifty PHP. and other shell scripting languages. Arguably, PHP is one of the most popular Web plat- forms. In this book you will learn about how to secure PHP applications, how to develop and use an application

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

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN