Exemplo n.º 1
0
            continue;
        }
        $set .= ', ';
        $User->{$SQLName} = $SQLVars[$SQLName];
        $set .= $SQLName . " = '" . $SQLVars[$SQLName] . "'";
    }
    if (count($errors)) {
        throw new Exception(implode('. ', $errors));
    }
    $set .= ', timeJoined = ' . time() . ', timeLastSessionEnded = ' . time();
    if (User::findUsername($SQLVars['username'])) {
        throw new Exception(l_t("The username '%s' is already in use. Please choose another.", $SQLVars['username']));
    } elseif (User::findEmail($SQLVars['email'])) {
        throw new Exception(l_t("The e-mail address '%s', is already in use. Please choose another.", $SQLVars['email']));
    }
    $DB->sql_put("INSERT INTO wD_Users SET " . $set);
    $DB->sql_put("COMMIT");
    // Re-authenticate with the new password, to create a new session ID
    $key = libAuth::userPass_Key($SQLVars['username'], $_REQUEST['userForm']['password']);
    $NewUser = libAuth::key_User($key);
    $NewUser->sendNotice('No', 'No', l_t("Welcome! This area displays your notices, which let you catch " . "up with what has happened since you were last here"));
    // libHTML does not like letting registered users access the registration page
    $User = new User(GUESTID);
    print libHTML::pageTitle(l_t('Register a webDiplomacy account'), l_t('Validate your e-mail address -&gt; Enter your account settings -&gt; <strong>Play webDiplomacy!</strong>'));
    print "<h3>" . l_t("Welcome to webDiplomacy!") . "</h3>\r\n\t\t\t<p>" . l_t("Welcome, %s!", $SQLVars['username']) . "<br /><br />\r\n\r\n\t\t\t\t" . l_t("You can now post in the <a href='forum.php' class='light'>forum</a>, " . "look for <a href='gamelistings.php' class='light'>a game to join</a>, " . "create a <a href='gamecreate.php' class='light'>new game</a>, " . "or get some <a href='help.php' class='light'>help/info</a>.") . "<br /> " . l_t("Be sure to bookmark the <a href='index.php' class='light'>home page</a>, " . "which displays a summary of your games and forum activity.") . "<br /><br />\r\n\r\n\t\t\t\t" . l_t("If you don't know what Diplomacy is about yet check out the quick\r\n\t\t\t\t<a href='intro.php' light='class'>graphical intro to webDiplomacy</a>,\r\n\t\t\t\tso you can get going faster.") . "\r\n\t\t\t</p>";
    print '</div>';
    libHTML::footer();
} catch (Exception $e) {
    $formOutput .= $e->getMessage();
}
print '<div class="content"><p class="notice">' . $formOutput . '</p></div>';