}
}
-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. <a href="signup">Did you signup yet?</a>.';
- } 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. <a href="do/signup">Did you signup yet?</a>.';
+ } 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');
}
}