Location: PHPKode > scripts > PHPwebmail > phpwebmail/iconbar.php
<?php 
/* 
PHPwebmail is a webmail client written in php.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/


   session_start(); 
   require("not_registered.php");

	// get user prefs account from DB
      if ($db_link = mysql_connect($sql_host,$sql_user,$sql_pw)) {
	@mysql_select_db("phpwebmail");
	$sql_query = "SELECT name, folder, textmode FROM prefs WHERE user='$name'";
	$result = mysql_query($sql_query);
        // catch SQL errors
        if (mysql_errno()) echo ("ERROR ".mysql_error());
	$row = mysql_fetch_row($result);
	$username = strip_tags(htmlspecialchars($row[0]));
	$folder_pre = $row[1];
	if ($folder_pre && substr($folder_pre,-1)!="/") $folder_pre .= "/";
	$textmode = $row[2];
      } // if db_link ends
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
</head>
<body bgcolor="<?php echo $bg_color_menu; ?>" text="<?php echo $fg_color; ?>" link="<?php echo $link_color; ?>" vlink="<?php echo $link_color; ?>" alink="<?php echo $alink_color; ?>">

<TABLE width="100%" border=0>
   <TR valign="top"><TD align="left"><nobr><font face="arial" size=3><b>Welcome, <?php echo($username); ?>!</nobr></TD>
<TD align="right">
<?php if ($textmode) echo "<font face=\"arial\" size=3><b>PHPwebmail"; else echo "<img src=images/bmp-php.gif>"; ?>
    </td>
</TR>

</table>
<TABLE width="100%" border=0>
   <TR valign="top"><TD width="20%">
       <FORM ACTION="mail_index.php?<?=SID?>" target="message_index" METHOD="POST">
<?php if (!$textmode) echo "<img src=images/folder.gif>"; ?>
	  <font face="arial" size=2><b>mail folder:</b><br>
          <SELECT NAME="select_folder" size=1 onChange="parent.frames[1].location.href='mail_index.php?<?=SID?>&folder_new=' + this.options[this.selectedIndex].value">
          <?php
          $mailbox = imap_open("{".$imap_server.":143}$folder", $name, $passwd);
          if ($mailbox) {
             $mailboxes = imap_lsub($mailbox, "{".$imap_server.":143}", "*");
             if (count($mailboxes) > 0) {
                for ($index = 0; $index < count($mailboxes); $index++) {
			$folder1 = substr(stristr($mailboxes[$index],"}"),1);
			$the_folder = $folder1;
			$has_pre = strstr($the_folder,$folder_pre);
			if ($has_pre) $the_folder = substr($has_pre,strlen($folder_pre));
                   print("<OPTION VALUE=\"".urlencode($folder1)."\"");
                   if (strtolower($the_folder) == strtolower($folder)) print(" SELECTED ");
                   print(">".$the_folder."\n");
                }
             } else {
                 print("<OPTION VALUE=\"INBOX\">INBOX");
             }
             imap_close($mailbox);
          } else {
                print("<OPTION VALUE=\"Error\">Error");
          }
          ?>
             </SELECT>
      </FORM>
   </TD>
<TD align="right" width="80%"><font face="arial" size=2><br>
<?php if (!$textmode) { ?>
    <A HREF="mail_index.php?<?=SID?>" target="message_index"><img src="images/_check.gif" ALT="check mail" border=0 align="center"></A><img src="images/_div.gif" align="center"><A HREF="send_mail.php?<?=SID?>" target="message_text"><img src="images/_new.gif"  ALT="new message" border=0 align="center"></A><img src="images/_div.gif" align="center"><A HREF="mail_index.php?<?=SID?>&action=expunge" target="message_index"><img src="images/_expunge.gif" ALT="empty trash" border=0 align="center"></A><img src="images/_div.gif" align="center"><A HREF="history.php?<?=SID?>" target="message_text"><img src="images/_sent.gif" ALT="sent messages" border=0 align="center"></A><img src="images/_div.gif" align="center"><A HREF="address.php?<?=SID?>" target="message_text"><img src="images/_address.gif" ALT="address book" border=0 align="center"></A><img src="images/_div.gif" align="center"><A HREF="folder_ops.php?<?=SID?>" target="message_text"><img src="images/_folders.gif" ALT="mail folders" border=0 align="center"></A><img src="images/_div.gif" align="center"><A HREF="prefs.php?<?=SID?>" target="message_text"><img src="images/_prefs.gif" ALT="preferences" border=0 align="center"></A><img src="images/_div.gif" align="center"><A HREF="logout.php" target="_top"><img src="images/_logout.gif" ALT="logout" border=0 align="center"></A><img src="images/_div.gif" align="center"><A HREF="help.php?<?=SID?>" target="message_text"><img src="images/_help.gif" ALT="help" border=0 align="center"></A>
<?php } else { ?>
    <A HREF="mail_index.php?<?=SID?>" target="message_index">check mail</A> | <A HREF="send_mail.php?<?=SID?>" target="message_text">new message</A> | <A HREF="mail_index.php?<?=SID?>&action=expunge" target="message_index">empty trash</A> | <A HREF="history.php?<?=SID?>" target="message_text">sent messages</A> | <A HREF="address.php?<?=SID?>" target="message_text">address book</A> | <A HREF="folder_ops.php?<?=SID?>" target="message_text">mail folders</A> | <A HREF="prefs.php?<?=SID?>" target="message_text">preferences</A> | <A HREF="logout.php" target="_top">logout</A> | <A HREF="help.php?<?=SID?>" target="message_text">help</A>
<?php } ?>
</TD></TR></TABLE>

</body>
</html>
Return current item: PHPwebmail