} if (isset($_GET['logout'])) { login_do_logout(); $_username = ""; $uid = ""; $loggedIn = false; redirect("/index.php"); } // moved login views to allow key checking require_once "login.views.php"; if (isset($_SESSION['Output']) && $_SESSION['Output']) { echo "<script type=\"text/javascript\">setTimeout(\"document.getElementById(\\\"loginOutput\\\").style.display=\\\"none\\\"\",5000)</script><span id=\"loginOutput\" class=\"loginOutput\">" . $_SESSION['Output'] . "<br></span>"; $_SESSION['Output'] = null; } if (isset($_GET["register"])) { handle_registration($Db); exit; } elseif (isset($_GET["resetPassword"])) { if (isset($_POST['email'])) { $user->resetPassword($_POST['email']); redirect("/" . $_SESSION['redirect']); } else { echo resetPasswordForm(); insert_header("Jackknife Password Reset"); echo "<a class=\"smalllink\" href=\"index.php\">[api input]</a> </body></html>"; } } if (isset($_GET['login'])) { if (isset($_POST["user"]) && isset($_POST["pass"]) && isset($_GET['login'])) { if ($user->checkLogin($_POST["user"], $_POST["pass"])) { redirect("/" . $_SESSION['redirect']);
function registration_model_helper($bid, $pin) { // Make sure that the passport has not already been registered. If it has // already been registered, then we can go straight to the stats. If not, // we try to submit the user's registration. if (is_registered($bid)) { return handle_stats($bid, $pin); } else { $registration = sanitized_registration(); // Make sure that the entered registration fields are valid. $badRegistrationFields = validate_registration($registration); if (count($badRegistrationFields) == 0) { register_user($bid, $registration); $user = get_user($bid); log_entry(LOG_MODE_USER, LOG_USER_ACTION_REGISTER, array("actorUid" => $user["uid"], "actorBid" => $bid, "targetUid" => $user["uid"], "targetBid" => $bid, "comment" => addslashes(serialize($registration)))); return handle_stats($bid, $pin, array("justRegistered" => true)); } else { return handle_registration($bid, $pin, $registration, array("badRegistration" => $badRegistrationFields)); } } }