Listing 7: login-form.html

<Head><Title>Login form</Title></Head>

<Body>
<H1>Login form</H1>

% if ($user_info) {
<P>You are currently logged in as <b><% $user_info->{username}
%></b>. Do
you really want to log in as someone else?</P>
% }

<Form action="login.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>

</table>

<input type="submit" value="Log in">

</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>