2002-11-16 03:49:32 +00:00
|
|
|
<?PHP // $Id$
|
|
|
|
// Authentication by looking up a POP3 server
|
|
|
|
|
|
|
|
function auth_user_login ($username, $password) {
|
|
|
|
// Returns true if the username and password work
|
|
|
|
// and false if they are wrong or don't exist.
|
|
|
|
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
switch ($CFG->auth_pop3type) {
|
|
|
|
case "pop3":
|
2002-11-17 09:57:34 +00:00
|
|
|
$host = "{".$CFG->auth_pop3host.":$CFG->auth_pop3port/pop3}INBOX";
|
2002-11-16 03:49:32 +00:00
|
|
|
break;
|
|
|
|
case "pop3cert":
|
2002-11-17 09:57:34 +00:00
|
|
|
$host = "{".$CFG->auth_pop3host.":$CFG->auth_pop3port/pop3/ssl/novalidate-cert}INBOX";
|
2002-11-16 03:49:32 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-11-19 08:51:33 +00:00
|
|
|
error_reporting(0);
|
|
|
|
$connection = imap_open($host, $username, $password, OP_HALFOPEN);
|
2002-12-31 08:50:24 +00:00
|
|
|
error_reporting($CFG->debug);
|
2002-11-19 08:51:33 +00:00
|
|
|
|
|
|
|
if ($connection) {
|
2002-11-16 03:49:32 +00:00
|
|
|
imap_close($connection);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|