]> andersk Git - sql-web.git/blame - login.php
bug fix: signup/db-create for class lockers
[sql-web.git] / login.php
CommitLineData
997305cf
JP
1<?php
2
3require_once('mitsql.cfg.php');
4require_once('mitsql.lib.php');
5
dc478ec8
JP
6if (isSSL()) {
7 if (is_null($SSLCred)) {
8 $err[] = 'Please install a valid certificate.';
997305cf 9 }
997305cf
JP
10}
11
377015e0
JP
12if (isPost() && empty($err)) {
13
dc478ec8 14 if (isSSL()) {
377015e0 15 $Login = $LoginSSL;
dc478ec8
JP
16 } else {
17 $Login = new Login($i_u, $i_p);
377015e0
JP
18 }
19
20 if ($Login->exists() && !$Login->isEnabled()) {
b932757d 21 $err[] = 'Account not active. <a href="do/signup">Did you signup yet?</a>.';
377015e0
JP
22 } elseif (!$Login->exists()) {
23 $err[] = 'Nonexistant account or invalid password.';
24 } elseif (!$Login->canLogin()) {
69e08b46 25 $err[] = 'That account is no longer valid. Please contact the staff (sql@mit.edu).';
377015e0
JP
26 }
27
28 if (empty($err)) {
29 sess('UserId', $Login->getUserId());
51722d40 30 redirect('main?refresh');
dc478ec8
JP
31 }
32
33}
34
35isLoggedIn() && redirect('main');
36
37include 'tpl/login.php';
997305cf 38
9840d102 39?>
This page took 0.066172 seconds and 5 git commands to generate.