Location: PHPKode > scripts > txtSQL MailBox > txtsql-mailbox/mailbox.php
<?php
 /*************************************************************************/
 # txtSQL MailBox 0.1 by Nexami Engeo (http://www.n-e-x.co.uk)     #
 # txtSQL MailBox is based on phpMailBox 1.1     #
 # Lasy Modified : 5th April, 2005  22:50 GMT     #
 # txtSQL MailBox 0.1 is Copyright (C) by John Urquhart Ferguson     #
 # All previous licensing applies     #
 #
 # More information on the txtSQL project can be found at: http://txtsql.sourceforge.net)
 #
 #  phpMailbox 1.1   by Sivaprasad R.L (http://netlogger.net/phpmailbox)  #
 #                                                                        #
 #          --  A php pop3 client --              			  #
 #                                                                        #
 # This program is distributed in the hope that it will be useful,        #
 # but WITHOUT ANY WARRANTY; without even the implied warranty of         #
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          #
 # GNU General Public License for more details.                           #
 #                                                                        #
 # You should have received a copy of the GNU General Public License      #
 # along with this program; if not, write to the Free Software            #
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.              #
 #                                                                        #
 #             phpMailBox 1.1 is Copyright (C) by Sivaprasad R.L                            #
 #                                                                        #
/*************************************************************************/

    include "mailheader.php";
    include "mailbox.inc";

	//I have added the parameter $sql to the constructor of MailBox in order
	//to allow txtSQL access within the object.
    $mb = new MailBox($sql); 
   
    $mb->Initialize();

    $accounts = $mb->getAccountIds();

    if(is_array($accounts)) {		
        $numacc = count($accounts);
    }

    if($numacc < 1) {
        echo "<br><BR><table width=95% border=1 class=\"bgrowcolor1\" align=center>
          <tr><Td  class=\"bgrowcolor1\" width=10%>Welcome</td><td>&nbsp;</td></tr>
          <tr><td colspan=2><br>
          Please click on <a class=\"ahref\" href=\"settings.php\">settings</a> to configure your mailbox.
          <br><br>
          By setting up new accounts, you can download mail from as many servers (pop3) as you want
          without ever logging in to each of them manually. Checking email is now made a lot easier
          for you. Click <a href=emailhelp.php>here</a>, for help in
          setting up new accounts.
          </td></tr>
          </table>
          ";
        include "mailfooter.php";
        exit;
    }

    foreach($accounts as $account_id) {
        if(!$mb->OpenConnection($account_id)) 
	    continue;
	$accname = $mb->getAccountName($account_id);
        $count   = $mb->getNumMails($account_id);
        $size    = $mb->getAccountSize($account_id);	
	
	$mb->CloseConnection($account_id);

        echo "<br><br>
              <table align=center width=50%>
              <tr class=\"bgrowcolor4\">
                 <td width=40% align=center><b>Account</b></td>
                 <td align=center width=40%><b>Number of Emails</b></td>
                 <td align=center width=20%><b>Size</b></td>
             </tr>
              <tr class=\"bgrowcolor1\">
                 <td align=center><A class=\"ahref\" href=\"inbox.php?id=$account_id\">$accname</a></td>
                 <td align=center>$count</td>
                 <td align=center>$size</td>
             </tr>
             </table>";
   }


    
include "mailfooter.php";
?>
Return current item: txtSQL MailBox