Chapter9.Cookies, Sessions, FTP, Email, and More


Chapter 9. Cookies, Sessions, FTP, Email, and More

This chapter covers some very powerful PHP web programming techniques: working with cookies, FTP (File Transfer Protocol), email, sessions, and more. We'll start by seeing how to set and read cookies, those data strings of text that you can store on the user's computer. Using cookies from PHP, you can store text on someone's computer and access it later, keeping track of his or her purchases, custom web page settings, and much more.

FTP is another powerful tool we're going to see in this chapter. FTP is great for sending files back and forth on the Internet, and you can use FTP from PHP scripts. A good many FTP functions are built into PHP, and we're going to use them to connect to remote servers, upload files, download files, and more in this chapter.

Another handy tool you have access to in PHP is email. You can send email from your scripts, which is great if you want to be notified when something happened in a web page. You can have a script send you email notification of new customer orders, signups for a newsletter, and more. We'll also take a look at handling sessions in this chapter. Normally, when you navigate to a PHP script, all the data in the variables in that script are initialized to their original values. That's usually OK, but what if you have an online shop and want to keep track of customer purchases as the user browses around your site? You could do that with cookies, but sessions give you an easier alternative.



    Spring Into PHP 5
    Spring Into PHP 5
    ISBN: 0131498622
    EAN: 2147483647
    Year: 2006
    Pages: 254

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net