if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["password"])) { $pw_error = "Password is required"; } else { $password = test_input($_POST["password"]); $password = hash(sha512, $password); } } if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($pw_error == "" and $username_error == "") { $response = $userCreate->createUser($username, $password); } } if ($_SERVER["REQUEST_METHOD"] == "POST") { if (isset($response->success->message)) { $response = $userLogin->loginUser($username, $password); } } if (isset($response->success->user->id)) { $_SESSION['logged_in_user_id'] = $response->success->user->id; $_SESSION['logged_in_user_username'] = $response->success->user->username; } $page_title = "Register"; $page_file_name = "create.php"; exit; ?> <div class="text">Create User</div> <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?> ">