pulled out all the login stuff and error checking from each individual php file
[squirrelmail.git] / src / folders.php
index 5ce49644ae9e93fab82b478f3bff2d34ce588559..0942ddbf19626a718d620892c6365cbee9fd63d3 100644 (file)
    echo "   </TD></TR>\n";
    echo "</TABLE>\n";
 
-   $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString);
-   if (!$imapConnection) {
-      echo "Error connecting to IMAP Server.<br>";
-      echo "$errorNumber : $errorString<br>";
-      exit;
-   }
-   $serverInfo = fgets($imapConnection, 256);
-
-   fputs($imapConnection, "1 login $username $key\n");
-   $read = fgets($imapConnection, 1024);
+   $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
 
    fputs($imapConnection, "1 list \"\" *\n");
    $str = imapReadData($imapConnection);
@@ -91,4 +82,4 @@
    echo "</FORM><BR>\n";
 
 ?>
-</BODY></HTML>
\ No newline at end of file
+</BODY></HTML>