PHP
  Home arrow PHP arrow Page 7 - Building A PHP-Based Mail Client (part...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Building A PHP-Based Mail Client (part 1)
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 37
    2002-01-02

    Table of Contents:
  • Building A PHP-Based Mail Client (part 1)
  • Requiring Immediate Attention
  • Start Me Up
  • Fully Function-al
  • Opening Up
  • Calling The Exterminator
  • Back To Square One

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Building A PHP-Based Mail Client (part 1) - Back To Square One


    (Page 7 of 7 )

    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:

    <? // logout.php - destroy session // destroy session variables and send back to login page session_start(); session_unregister("SESSION"); session_unregister("SESSION_USER_NAME"); session_unregister("SESSION_USER_PASS"); session_unregister("SESSION_MAIL_HOST"); header("Location:index.php"); ?>
    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!
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

       

    PHP ARTICLES

    - Validating Web Forms with the Code Igniter P...
    - Output Buffering
    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway