Specifications
CONTENTS
Using Encryption in PHP ..................................................................338
Further Reading ..................................................................................347
Next ....................................................................................................347
PART IV Advanced PHP Techniques 349
16 Interacting with the File System and the Server 351
Introduction to File Upload ................................................................352
HTML for File Upload ..................................................................353
Writing the PHP to Deal with the File ..........................................354
Common Problems ........................................................................358
Using Directory Functions ..................................................................358
Reading from Directories ..............................................................358
Getting Info About the Current Directory ....................................360
Creating and Deleting Directories ................................................360
Interacting with the File System ........................................................361
Get File Info ..................................................................................361
Changing File Properties ..............................................................364
Creating, Deleting, and Moving Files ..........................................364
Using Program Execution Functions ..................................................365
Interacting with the Environment: getenv() and putenv() ..................367
Further Reading ..................................................................................368
Next ....................................................................................................368
17 Using Network and Protocol Functions 369
Overview of Protocols ........................................................................370
Sending and Reading Email ..............................................................371
Using Other Web Services ..................................................................371
Using Network Lookup Functions ....................................................374
Using FTP ..........................................................................................378
Using FTP to Back Up or Mirror a File ........................................378
Uploading Files ............................................................................385
Avoiding Timeouts ........................................................................385
Using Other FTP Functions ..........................................................386
Generic Network Communications with cURL ................................387
Further Reading ..................................................................................389
Next ....................................................................................................390
18 Managing the Date and Time 391
Getting the Date and Time from PHP ................................................392
Using the date() Function ..............................................................392
Dealing with UNIX Time Stamps ................................................394
Using the getdate() Function ........................................................395
Validating Dates ............................................................................396
xv
00 7842 FM 3/6/01 3:38 PM Page xv