This chapter covered a number of very powerful PHP techniques: cookies, sessions, FTP, email, and more. These are all advanced PHP techniques that can really beef up your PHP arsenal. Here are some of this chapter's salient points:
You can set a cookie with the setcookie function.
To check if a cookie has been set, use the isset function.
To recover the data in a cookie, use the $_COOKIE array with the cookie name, like this: $_COOKIE['message'].
To connect to an FTP server, you use ftp_connect.
After you connect with ftp_connect, you log in with ftp_login.
There are many FTP functions in PHP, such as ftp_nlist to get a directory listing, ftp_chdir to change directories, ftp_get to get a file, ftp_put to upload a file, and so on.
To enable email, you need to edit php.ini.
To actually send email, use the mail function.
You can start a session with the session_start function to preserve user data.
To store data in the session, you use the $_SESSION array.