]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | /* | |
3 | (c) 2005 Joe Presbrey | |
4 | */ | |
5 | ||
6 | require_once('mitsql.cfg.php'); | |
7 | require_once('mitsql.lib.php'); | |
8 | ||
9 | if (isSSL()) { | |
10 | if (is_null($SSLCred)) { | |
11 | $err[] = 'Please install a valid certificate.'; | |
12 | } | |
13 | } | |
14 | ||
15 | if (isPost() && empty($err)) { | |
16 | ||
17 | if (isSSL()) { | |
18 | $Login = $LoginSSL; | |
19 | } else { | |
20 | $Login = new Login($i_u, $i_p); | |
21 | } | |
22 | ||
23 | if ($Login->exists() && !$Login->isEnabled()) { | |
24 | $err[] = 'Account not active. <a href="do/signup">Did you signup yet?</a>.'; | |
25 | } elseif (!$Login->exists()) { | |
26 | $err[] = 'Nonexistant account or invalid password.'; | |
27 | } elseif (!$Login->canLogin()) { | |
28 | $err[] = 'That account is no longer valid. Please contact the staff (sql@mit.edu).'; | |
29 | } | |
30 | ||
31 | if (empty($err)) { | |
32 | sess('UserId', $Login->getUserId()); | |
33 | redirect('main?refresh'); | |
34 | } | |
35 | ||
36 | } | |
37 | ||
38 | isLoggedIn() && redirect('main'); | |
39 | ||
40 | include 'tpl/login.php'; | |
41 | ||
42 | ?> |