Now, that entire effort was a pretty major exercise - especially if, like me, you hadn't done it before. And I'm not done yet - I still need to figure out how to handle attachments. But before I go there, I'd like to close up this first part with a look at, appropriately enough, the "logout.php" script. You'll remember, from a couple pages back, that the page header includes some code to display a link to log out of the system. This link points to "logout.php", an extremely simple script which destroys the session created at the time of logging in, and sends the browser back to the application's index page. Take a look: If you look at "login.php" again, you'll see that I'm simply destroying, via session_unregister(), the session variables created at login time. This is necessary to avoid having one user's sensitive account information "inherited" by subsequent users. Once the session has been destroyed, the browser is redirected back to the index page. And so the cycle continues... That's about it for this opening segment. In this article, you learned a little bit about the basics of designing software applications - namely, putting down requirements on paper, separating common elements into a single location, and keeping lots of caffeine handy. You also got an introduction to PHP's IMAP functions, using built-in IMAP constructs to connect to a POP3 server and obtain a detailed message listing from it. Finally, you learned a little about PHP's session management functions, with code illustrations of how to create, use and destroy session variables. I still have a long way to go before this application is complete. My primary problem right now is understanding how to handle attachments, both so that I can display (and download) them, and so that I can attach them to new messages or replies. I plan to bone up on a little theory before attempting this - come back next week and I'll tell you what I find out. Note: All examples in this article have been tested on Linux/i386 with Apache 1.3.12 and PHP 4.0.6. Examples are illustrative only, and are not meant for a production environment. Melonfire provides no warranties or support for the source code described in this article. YMMV!
blog comments powered by Disqus |