Listing 3: register-form.html
<!-- -*- mmm-classes: mason -*- -->
<H1>Register as a new user</H1>
% if ($user_info) {
<P>You are currently logged in as <b><% $user_info->{username} %></b>. Do
you really want to register?</P>
% } else {
<P>You are not logged in. Go ahead and register!</P>
% }
<Form action="register.html" method="POST">
<table>
<tr>
<td>
Username:
</td>
<td>
<input type="text" name="username" size="20" maxlength="20">
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" name="password" size="20" maxlength="20">
</td>
</tr>
<tr>
<td>
Password hint:
</td>
<td>
<input type="text" name="password_hint"
size="50" maxlength="100">
</td>
</tr>
<tr>
<td>
E-mail address:
</td>
<td>
<input type="text" name="email_address" size="30"
maxlength="50">
</td>
</tr>
</table>
<input type="submit" value="Register a new
user">
</Form>
<%once>
my $dbh;
</%once>
<%init>
$dbh = $m->comp("database-connect.comp");
my $user_info = $m->comp("get-user-info.comp", user_id => $session{user_id});
</%init>