| |
| |
Introduction | |
| |
| |
| |
An Introduction to CGI | |
| |
| |
| |
Overview of CGI Programming | |
| |
| |
Types of Web Applications | |
| |
| |
A History of CGI | |
| |
| |
What Is a CGI Program? | |
| |
| |
How CGI Programs Work | |
| |
| |
Pros and Cons of CGI | |
| |
| |
CGI Programming Languages | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Setting Up Your CGI Environment | |
| |
| |
The Web Server Itself | |
| |
| |
Web-Server Operating Systems | |
| |
| |
The CGI Environment | |
| |
| |
Web Servers | |
| |
| |
Setting Up Your CGI Development Environment | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Downloading, Installing, and Debugging CGI Scripts | |
| |
| |
Downloading Scripts From the Internet | |
| |
| |
Installing a Downloaded Script | |
| |
| |
Example: Downloading and Installing a Guestbook Script | |
| |
| |
Debugging CGI Scripts | |
| |
| |
Tools and Techniques for Debugging Your Program Code | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Writing Your First CGI Program | |
| |
| |
Parts of CGI Programs | |
| |
| |
A URL-Redirection Program | |
| |
| |
Working With Files in Perl | |
| |
| |
Loops in Perl | |
| |
| |
The if Statement | |
| |
| |
Perl Expressions | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Capturing User Input | |
| |
| |
| |
Creating HTML Forms | |
| |
| |
The [FORM] Tag | |
| |
| |
The [INPUT] Tag | |
| |
| |
Other Form Fields | |
| |
| |
Workshop: Building an Entire Form | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Processing Input | |
| |
| |
A Little Bit About HTTP | |
| |
| |
Handling Script Arguments | |
| |
| |
Processing Form Data | |
| |
| |
Using CGI.pm to Decode Form Data | |
| |
| |
Sending Input to CGI programs via Extra Path Information | |
| |
| |
CGI Environment Variables | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Validating User Input | |
| |
| |
Using JavaScript for Form Validation | |
| |
| |
Designing Easily Validated Forms | |
| |
| |
Incorporating Validation into the Form-Processing Code | |
| |
| |
An Example of Form Processing | |
| |
| |
Validating Values | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Creating an Email Feedback Form | |
| |
| |
What Kinds of Applications Entail Sending Email? | |
| |
| |
How Email Works | |
| |
| |
Example: Sending Email from a CGI Script | |
| |
| |
Using Blat | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
CGI Programming Languages and Tools | |
| |
| |
| |
CGI and Simple Shell Scripting | |
| |
| |
Writing Shell Scripts | |
| |
| |
Decoding Form Data | |
| |
| |
Working with Query Strings | |
| |
| |
Un-CGI | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Perl--The Big Kahuna of CGI Programming | |
| |
| |
CGI.pm | |
| |
| |
Accessing CGI.pm from Your Program | |
| |
| |
Decoding Form Data via CGI.pm | |
| |
| |
Generating HTTP Headers and HTML Tags via CGI.pm | |
| |
| |
cgi-lib.pl | |
| |
| |
Handling Errors with CGI::Carp | |
| |
| |
Resources for Perl Programmers | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Other Popular CGI Programming Languages | |
| |
| |
Will My Favorite Language Work for CGI? | |
| |
| |
Writing CGI Programs in C | |
| |
| |
The cgic Library | |
| |
| |
A C Example | |
| |
| |
Writing CGI Programs in Python | |
| |
| |
A Python Example | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Pros and Cons of Alternate Technologies | |
| |
| |
Looking Back | |
| |
| |
Types of CGI Alternatives | |
| |
| |
Active Server Pages | |
| |
| |
Allaire ColdFusion | |
| |
| |
The Apache mod_per1 Module | |
| |
| |
PHP | |
| |
| |
Server-Side Java | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Building Basic CGI Applications | |
| |
| |
| |
Using Flat Files for Data Storage | |
| |
| |
What Is a Database? | |
| |
| |
Flat-File Databases | |
| |
| |
File Operations | |
| |
| |
Building a Database Application | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Creating a CGI-Based Message Board | |
| |
| |
The Structure of the Application | |
| |
| |
The File Format | |
| |
| |
The Display Script | |
| |
| |
The Posting Script | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Session (State) Management | |
| |
| |
Why Use Session Management? | |
| |
| |
Basic Authentication | |
| |
| |
Hidden Fields in Forms | |
| |
| |
Hidden Form Fields Example | |
| |
| |
Using Cookies | |
| |
| |
Session Management with Cookies | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Building a Simple Shopping Cart | |
| |
| |
How the Sample Shopping Cart Works | |
| |
| |
The Catalog | |
| |
| |
The Contents of the Shopping Cart | |
| |
| |
Checkout | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Content Publishing with CGI | |
| |
| |
Why Content Publishing? | |
| |
| |
Types of Content Publishing Systems | |
| |
| |
Data Storage for Content Publishing Systems | |
| |
| |
A Content Publishing Example | |
| |
| |
Third-Party Content Management Systems | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Integrating Databases and CGI | |
| |
| |
| |
Working with Relational Databases | |
| |
| |
The Relational Database Model | |
| |
| |
Structured Query Language | |
| |
| |
Database Design | |
| |
| |
Relational Data Types | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
How to Use the Structured Query Language | |
| |
| |
Structured Query Language | |
| |
| |
Database Interfaces | |
| |
| |
ODBC | |
| |
| |
DBI and DBD | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Creating an Online Store | |
| |
| |
The Database Design | |
| |
| |
The Catalog Script | |
| |
| |
The Shopping Cart Script | |
| |
| |
The Checkout Script | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Additional CGI Tips and Tricks | |
| |
| |
| |
Working with HTTP | |
| |
| |
HTTP Basics | |
| |
| |
What Takes Place During an HTTP Session | |
| |
| |
Server Response Codes | |
| |
| |
Response Headers | |
| |
| |
NPH Scripts | |
| |
| |
Content Types | |
| |
| |
Secure Connections | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Securing CGI Scripts | |
| |
| |
Why Security? | |
| |
| |
Securing Your Web Server | |
| |
| |
Common CGI Security Holes | |
| |
| |
Safe Programming | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Creating Custom Error Documents | |
| |
| |
What Is an Error Document? | |
| |
| |
Configuring Your Web Server for Custom Error Documents | |
| |
| |
Using HTML to Create a Basic Error Document | |
| |
| |
Using CGI to Create an Advanced Error Document | |
| |
| |
Handling an "Unauthorized" Error | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
| |
Server Side Includes | |
| |
| |
How Server Side Includes Work | |
| |
| |
Setting Up Your Web Server for SSI | |
| |
| |
Using SSI Directives | |
| |
| |
Designing Pages Using SSI | |
| |
| |
XSSI | |
| |
| |
Summary | |
| |
| |
QandA | |
| |
| |
Workshop | |
| |
| |
Appendixes | |
| |
| |
| |
Answers | |
| |
| |
| |
MIME Types | |
| |
| |
| |
Response Codes and Reason Phrases | |
| |
| |
| |
Environment Variables and Request Headers | |
| |
| |
| |
Summary of Regular Expressions | |
| |
| |
| |
The ASCII Character Table | |
| |
| |
Index | |