Example #1
0
function handle_registration($Db)
{
    global $user;
    if (isset($_POST['username']) && isset($_POST['password']) && $_POST['password'] == $_POST['password2'] && isset($_POST['email'])) {
        if ($user->registerUser($_POST['username'], $_POST['password'], $_POST['email'])) {
            if (isset($_POST['import'])) {
                require_once 'manage.php';
                add_api_key($Db, $user->uid, $_POST['usid'], $_POST['apik'], "", $notes = "");
            }
            redirect("/" . $_SESSION['redirect']);
        } else {
            echo show_registration($Db) . "<a class=\"smalllink\" href=\"index.php\">[api input]</a>&nbsp;</body></html>";
            insert_header("Register");
        }
    } else {
        echo show_registration($Db) . "<a class=\"smalllink\" href=\"index.php\">[api input]</a>&nbsp;</body></html>";
    }
    insert_header("Register");
}
function get_form_divs()
{
    global $Db;
    $infobar = "";
    if (!LOGGED_IN) {
        $infobar .= makeDiv("register", show_registration($Db));
        $infobar .= makediv("login", get_login_form());
        $infobar .= makediv("reset", resetPasswordForm());
    } else {
        if (!(isset($_GET['key']) && !isset($_GET['chid'])) && defined("API_KEY")) {
            $infobar .= makediv("api", add_key_form());
        }
    }
    return $infobar;
}