PHP
  Home arrow PHP arrow Page 7 - Building A PHP-Based Mail Client (part 3)
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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? 
Google.com  
PHP

Building A PHP-Based Mail Client (part 3)
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 8
    2002-01-23


    Table of Contents:
  • Building A PHP-Based Mail Client (part 3)
  • Composing Yourself
  • Return To Sender
  • Coming Forward
  • Setting Boundaries
  • Under Construction
  • When Things Go Wrong...
  • Game Over

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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 3) - When Things Go Wrong...
    ( Page 7 of 8 )

    The last script - an extremely simple one - is the error handler, "error.php". If you look at the source code, you'll notice many links to this script, each one passing it a cryptic error code via the $ec variable. Very simply, "error.php" intercepts the variable and converts it to a human-readable error message, which is then displayed to the user.

    <? // error.php - error handler switch($ec) { // login failure case 1: $message = "An error occurred while logging you in. Please verify your account information and <a href=logout.php>log in again</a>."; break; // session authentication failure case 2: $message = "An error occurred while performing your request. Please <a href=logout.php>log in again</a>."; break; // POP3 connection problem case 3: $message = "A connection could not be opened to the mail server. Please verify your account information and <a href=logout.php>log in again</a>."; break; // missing variable case 4: $message = "An error occurred while performing your request. Please <a href=logout.php>log in again</a>."; break; // email addresses absent case 6: $message = "Your message could not be processed, as it contained no valid recipient addresses. Please <a href=compose.php>try again</a>."; break; // attachment problem case 7: $message = "An error occurred while uploading the message attachment. Please <a href=compose.php>try again</a>."; break; // email addresses invalid case 8: $message = "Your message could not be processed, as it contained one or more invalid email addresses. Please <a href=compose.php>try again</a>."; break; // everything else default: $message = "An unspecified error occurred while performing your request. Please <a href=logout.php>log in again</a>."; break; } ?> <html> <head> </head> <body bgcolor="White"> <? // page header ?> <font face="Verdana" size="-1"> <? echo $message; ?> </font> </body> </html>
    Here's what it looks like.



    Simple and elegant - not to mention flexible. Found a new error? No problem - assign it an error code and let "error.php" know.

     
     
    >>> More PHP Articles          >>> More By icarus, (c) Melonfire
     

       

    PHP ARTICLES

    - Adding Ordering and Grouping Clauses to the ...
    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek