whoops.. forgot to add these files
[squirrelmail.git] / src / right_main.php
index cbc699f9820bde98009b6514d08366e124b07afb..3071e422e3105839f113bf4c2f66a75c0dbd52b8 100644 (file)
 
 
    // open a connection on the imap port (143)
-   $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString);
-   if (!$imapConnection) {
-      echo "Error connecting to IMAP Server.<br>";
-      echo "$errorNumber : $errorString<br>";
-      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;
-   }
+   $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
 
    // If the page has been loaded without a specific mailbox,
    //    just show a page of general info.
@@ -81,6 +67,7 @@
    showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort);
 
    // close the connection
+   fputs($imapConnection, "1 logout\n");
    fclose($imapConnection);
 ?>
 </FONT>