Small change to allow the same user (by email) be deleted more than
[moodle.git] / auth / pop3 / lib.php
CommitLineData
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
7$CFG->auth_pop3host = "127.0.0.1"; // Should be IP number
8$CFG->auth_pop3type = "pop3"; // pop3, pop3cert
98bc913c 9$CFG->auth_pop3port = "110"; // 110 is most common
817c698e 10$CFG->auth_instructions = "Use the same username and password as your school email account"; // Instructions
df3988ea 11
12
13function auth_user_login ($username, $password) {
14// Returns true if the username and password work
15// and false if they are wrong or don't exist.
16
17 global $CFG;
18
19 switch ($CFG->auth_pop3type) {
20 case "pop3":
817c698e 21 $host = "{".$CFG->auth_pop3host.":$CFG->auth_pop3port/pop3}INBOX";
df3988ea 22 break;
23 case "pop3cert":
817c698e 24 $host = "{".$CFG->auth_pop3host.":$CFG->auth_pop3port/pop3/ssl/novalidate-cert}INBOX";
df3988ea 25 break;
26 }
27
28 if ($connection = imap_open($host, $username, $password, OP_HALFOPEN)) {
29 imap_close($connection);
30 return true;
31
32 } else {
33 return false;
34 }
35}
36
37
38?>