2002-11-16 03:49:32 +00:00
|
|
|
<?PHP // $Id$
|
2002-11-16 03:56:00 +00:00
|
|
|
// Authentication by looking up an NNTP server
|
2002-11-16 03:49:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2004-01-16 09:17:20 +00:00
|
|
|
$hosts = split(';', $CFG->auth_nntphost); // Could be multiple hosts
|
2002-11-16 03:49:32 +00:00
|
|
|
|
2004-01-16 09:17:20 +00:00
|
|
|
foreach ($hosts as $host) { // Try each host in turn
|
|
|
|
$host = '{'.trim($host).":$CFG->auth_nntpport/nntp}";
|
2002-11-19 08:51:33 +00:00
|
|
|
|
2004-01-16 09:17:20 +00:00
|
|
|
error_reporting(0);
|
|
|
|
$connection = imap_open($host, $username, $password, OP_HALFOPEN);
|
|
|
|
error_reporting($CFG->debug);
|
2002-11-16 03:49:32 +00:00
|
|
|
|
2004-01-16 09:17:20 +00:00
|
|
|
if ($connection) {
|
|
|
|
imap_close($connection);
|
|
|
|
return true;
|
|
|
|
}
|
2002-11-16 03:49:32 +00:00
|
|
|
}
|
2004-01-16 09:17:20 +00:00
|
|
|
|
|
|
|
return false; // No match
|
2002-11-16 03:49:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|