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