df3988ea |
1 | <?PHP // $Id$ |
2 | // Authentication by looking up a POP3 server |
3 | |
4 | // This code is completely untested so far - IT NEEDS TESTERS! |
5 | // Looks like it should work though ... |
6 | |
df3988ea |
7 | function auth_user_login ($username, $password) { |
8 | // Returns true if the username and password work |
9 | // and false if they are wrong or don't exist. |
10 | |
11 | global $CFG; |
12 | |
13 | switch ($CFG->auth_pop3type) { |
14 | case "pop3": |
817c698e |
15 | $host = "{".$CFG->auth_pop3host.":$CFG->auth_pop3port/pop3}INBOX"; |
df3988ea |
16 | break; |
17 | case "pop3cert": |
817c698e |
18 | $host = "{".$CFG->auth_pop3host.":$CFG->auth_pop3port/pop3/ssl/novalidate-cert}INBOX"; |
df3988ea |
19 | break; |
20 | } |
21 | |
35a48c9a |
22 | error_reporting(0); |
23 | $connection = imap_open($host, $username, $password, OP_HALFOPEN); |
24 | error_reporting(7); |
25 | |
26 | if ($connection) { |
df3988ea |
27 | imap_close($connection); |
28 | return true; |
29 | |
30 | } else { |
31 | return false; |
32 | } |
33 | } |
34 | |
35 | |
36 | ?> |