2 if(!isset($username)) {
3 echo "You need a valid user and password to access this page!";
9 <SCRIPT LANGUAGE
="JavaScript">
10 function DeleteCookie (name
) {
12 exp
.setTime (exp
.getTime() - 1);
13 // This cookie is history
14 var cval
= GetCookie (name
);
15 document
.cookie
= name +
"=" + cval +
"; expires=" + exp
.toGMTString();
18 function unSetCookies() {
19 DeleteCookie('username');
21 DeleteCookie('logged_in');
22 alert(document
.cookie
);
26 <BODY BGCOLOR
=A0B8C8 TEXT
="#000000" LINK
="#0000EE" VLINK
="#0000EE" ALINK
="#0000EE" onUnLoad
="unSetCookies()">
27 <FONT FACE
="Arial,Helvetica">
29 include("config/config.php3");
30 include("functions/strings.php3");
31 include("functions/imap.php3");
33 // *****************************************
34 // Parse the incoming mailbox name and return a string that is the FOLDER.MAILBOX
35 // *****************************************
36 function findMailboxName($mailbox) {
37 // start at -2 so that we skip the initial quote at the end of the mailbox name
39 $char = substr($mailbox, $i, 1);
40 while ($char != "\"") {
43 $char = substr($mailbox, $i, 1);
48 // open a connection on the imap port (143)
49 $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString);
50 if (!$imapConnection) {
51 echo "Error connecting to IMAP Server.<br>";
52 echo "$errorNumber : $errorString<br>";
55 $serverInfo = fgets($imapConnection, 256);
57 fputs($imapConnection, "1 login $username $key\n");
58 $read = fgets($imapConnection, 1024);
60 fputs($imapConnection, "1 list \"\" *\n");
61 $str = imapReadData($imapConnection);
63 echo "<FONT FACE=\"Arial,Helvetica\"><B>";
64 echo "<CENTER>$org_name</B><BR>";
65 echo "Folders</CENTER>";
66 echo "</B><BR></FONT>";
67 echo "<code><FONT FACE=\"Arial,Helvetica\">\n";
68 for ($i = 0;$i < count($str); $i++
) {
69 $mailbox = Chop($str[$i]);
70 // find the quote at the begining of the mailbox name.
71 // i subtract 1 from the strlen so it doesn't find the quote at the end of the mailbox name.
72 $mailbox = findMailboxName($mailbox);
73 $periodCount = countCharInString($mailbox, ".");
75 // indent the correct number of spaces.
76 for ($j = 0;$j < $periodCount;$j++
)
79 $mailboxURL = urlencode($mailbox);
80 echo "<a href=\"mailboxMessageList.php3?sort=0&startMessage=0&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\"><FONT FACE=\"Arial,Helvetica\">";
81 echo readShortMailboxName($mailbox, ".");
82 echo "</FONT></a><br>\n";
84 echo "</code></FONT>";
86 fclose($imapConnection);