login first."; exit; } if(!isset($username) || !isset($key)) { echo "You need a valid user and password to access this page!"; exit; } ?> "; echo "$errorNumber : $errorString
"; exit; } $serverInfo = fgets($imapConnection, 256); // login fputs($imapConnection, "1 login $username $key\n"); $read = fgets($imapConnection, 1024); if (strpos($read, "NO")) { error_username_password_incorrect(); exit; } // If the page has been loaded without a specific mailbox, // just show a page of general info. if (!isset($mailbox)) { displayPageHeader("None"); general_info($motd, $org_logo, $version, $org_name); exit; } // switch to the mailbox, and get the number of messages in it. selectMailbox($imapConnection, $mailbox, $numMessages); // make a URL safe $mailbox for use in the links $urlMailbox = urlencode($mailbox); displayPageHeader($mailbox); $i = 1; while ($i <= $numMessages) { getMessageHeaders($imapConnection, $i, $from, $subject, $date); $messages[$i]["DATE"] = getTimeStamp(explode(" ", trim($date))); $messages[$i]["ID"] = $i; $messages[$i]["FROM"] = $from; $messages[$i]["SUBJECT"] = $subject; $i++; } if ($sort == 0) $msgs = ary_sort($messages, "DATE", -1); else $msgs = ary_sort($messages, "DATE", 1); if ($endMessage > 24) { echo "Next   "; $endMessage = 24; } /** Display "Next, Previous" on top */ /** This is the beginning of the message list table. It wraps around all messages */ echo ""; echo "
"; echo ""; echo ""; echo " "; echo " "; echo " \n"; else echo " \n"; echo " \n"; echo ""; // loop through and display the info for each message. for ($i = $startMessage;$i <= $endMessage; $i++) { printMessageInfo($imapConnection, $msgs[$i]["ID"], $msgs[$i]["FROM"], $msgs[$i]["SUBJECT"], $msgs[$i]["DATE"]); } echo "
NumFromDate"; if ($sort == 0) echo " Subject
\n"; echo "
"; /** End of message-list table */ /** Display "Next, Previous" on bottom */ fclose($imapConnection); ?>