X-Git-Url: http://andersk.mit.edu/gitweb/sql-web.git/blobdiff_plain/dc478ec893c32ad501d678f9f82506de091e6b0b..8ed5cf0132d45b10a72923502677333626a359e5:/login.php
diff --git a/login.php b/login.php
index 441c778..98a59a5 100644
--- a/login.php
+++ b/login.php
@@ -6,32 +6,28 @@ require_once('mitsql.lib.php');
if (isSSL()) {
if (is_null($SSLCred)) {
$err[] = 'Please install a valid certificate.';
- } else {
- $Login2 = new Login($SSLUsername);
- if (!(empty($SSLUsername) || $Login2->exists())) {
- addUser($cred);
- $Login = new Login($SSLUsername);
- }
}
}
-if (empty($err) && isPost()) {
-
+if (isPost() && empty($err)) {
+
if (isSSL()) {
- $Login = new Login($SSLUsername);
- $Login->update($cred['Name'],$cred['Email']);
- sess('Login', $Login);
+ $Login = $LoginSSL;
} else {
$Login = new Login($i_u, $i_p);
- if ($Login->exists() && !$Login->isEnabled()) {
- $err[] = 'Account not active. Did you signup yet?.';
- } elseif (!$Login->exists()) {
- $err[] = 'Nonexistant account or invalid password.';
- } elseif (!$Login->canLogin()) {
- $err[] = 'That account is no longer valid. Please contact the staff.';
- } else {
- sess('Login', $Login);
- }
+ }
+
+ if ($Login->exists() && !$Login->isEnabled()) {
+ $err[] = 'Account not active. Did you signup yet?.';
+ } elseif (!$Login->exists()) {
+ $err[] = 'Nonexistant account or invalid password.';
+ } elseif (!$Login->canLogin()) {
+ $err[] = 'That account is no longer valid. Please contact the staff.';
+ }
+
+ if (empty($err)) {
+ sess('UserId', $Login->getUserId());
+ redirect('main');
}
}