CONTENTS
xv
Authenticating Your Users with PHP..............................................................................305
PHP’s Authentication Variables ............................................................................................................ 305
Useful Functions................................................................................................................................... 306
Hard-Coded Authentication .................................................................................................................. 307
File-Based Authentication .................................................................................................................... 308
Database-Based Authentication........................................................................................................... 309
Taking Advantage of PEAR: Auth_HTTP................................................................................................ 311
User Login Administration .............................................................................................313
Testing Password Guessability with the CrackLib Library.................................................................... 313
One-Time URLs and Password Recovery.............................................................................................. 315
Summary .......................................................................................................................318
Chapter 15: Handling File Uploads......................................................................319
Uploading Files via HTTP ...............................................................................................319
Uploading Files with PHP...............................................................................................320
PHP’s File Upload/Resource Directives ................................................................................................ 320
The $_FILES Array ................................................................................................................................ 322
PHP’s File-Upload Functions ................................................................................................................ 322
Upload Error Messages ........................................................................................................................ 324
A Simple Example................................................................................................................................. 325
Taking Advantage of PEAR: HTTP_Upload.....................................................................326
Installing HTTP_Upload......................................................................................................................... 326
Uploading a File.................................................................................................................................... 326
Learning More About an Uploaded File................................................................................................. 327
Uploading Multiple Files ....................................................................................................................... 328
Summary .......................................................................................................................329
Chapter 16: Networking......................................................................................331
DNS, Services, and Servers...........................................................................................331
DNS....................................................................................................................................................... 332