X-Git-Url: http://andersk.mit.edu/gitweb/sql-web.git/blobdiff_plain/5085530310ff52260aa0c23533ee883f1add85cd..8933592bf33ba067b1de182ace7ab0950d10d9ac:/signup.php diff --git a/signup.php b/signup.php index 0b52815..27d80d5 100644 --- a/signup.php +++ b/signup.php @@ -4,7 +4,7 @@ require_once('mitsql.cfg.php'); require_once('mitsql.lib.php'); if (!isSSL()) - redirect('index',false); + redirect('signup',true); if (isLoggedIn()) { @@ -15,14 +15,22 @@ if (isLoggedIn()) { if (is_null($SSLCred)) { $err[] = 'Please install a valid certificate.'; } else { - $Login2 = new Login($SSLUsername); - if (isPost() && $Login2->canSignup()) { - $u = new User($Login2->getUserId()); - $u->signup($i_p1); - $Login2->refresh(); + if (isPost() && $LoginSSL->canSignup()) { + if (empty($i_p1)) { + $err[] = 'Your password may not be blank.'; + } elseif ($i_p1 != $i_p2) { + $err[] = 'Your confirmation password does not match.'; + } else { + $u = new User($LoginSSL->getUserId()); + $u->signup($i_p1); + $LoginSSL->refresh(); + sess('Login', $LoginSSL); + redirect('login', true); + } + } elseif (isPost()) { + $err[] = 'You may not signup.'; + } } - } - } include 'tpl/signup.php';