X-Git-Url: http://andersk.mit.edu/gitweb/sql-web.git/blobdiff_plain/3ebfe9a36acba9515fadc37791a8931749a5bd51..1b2f1c8d8d2802291feb23e002bf4cb6a8487884:/login.php
diff --git a/login.php b/login.php
index f11e80e..5e2d310 100644
--- a/login.php
+++ b/login.php
@@ -9,23 +9,25 @@ if (isSSL()) {
}
}
-if (empty($err) && isPost()) {
-
+if (isPost() && empty($err)) {
+
if (isSSL()) {
- $Login = new Login($SSLUsername);
- $Login->update($SSLCred['Name'],$SSLCred['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');
}
}