From ce1d4661e076f8c4a0e0e80b3edc66a8a621201a Mon Sep 17 00:00:00 2001 From: squirrel Date: Mon, 22 Nov 1999 01:47:31 +0000 Subject: [PATCH] Verifies if the login was correct or not. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@8 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- mailboxMessageList.php3 | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/mailboxMessageList.php3 b/mailboxMessageList.php3 index 7ba540fc..6db6c1a5 100644 --- a/mailboxMessageList.php3 +++ b/mailboxMessageList.php3 @@ -190,7 +190,34 @@ // $key pass // ///////////////////////////////////////////////////////////////////////////////// - + + + // open a connection on the imap port (143) + $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString); + if (!$imapConnection) { + echo "Error connecting to IMAP Server.
"; + echo "$errorNumber : $errorString
"; + exit; + } + $serverInfo = fgets($imapConnection, 256); + + // login + fputs($imapConnection, "1 login $username $key\n"); + $read = fgets($imapConnection, 1024); + if (strpos($read, "NO")) { + echo "
"; + echo ""; + echo " "; + echo " "; + echo "
"; + echo "
ERROR
"; + echo "
"; + echo "

Unknown user or password incorrect.
Click here to try again.
"; + echo "
"; + echo ""; + exit; + } + // If the page has been loaded without a specific mailbox, // just show a page of general info. @@ -225,18 +252,6 @@ exit; } - // open a connection on the imap port (143) - $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString); - if (!$imapConnection) { - echo "Error connecting to IMAP Server.
"; - echo "$errorNumber : $errorString
"; - exit; - } - $serverInfo = fgets($imapConnection, 256); - - // login - fputs($imapConnection, "1 login $username $key\n"); - $read = fgets($imapConnection, 1024); // switch to the mailbox, and get the number of messages in it. selectMailbox($imapConnection, $mailbox, $numMessages); -- 2.25.1