Title: Sign In Comment: The login/out page.

Sign In

User Name:

Password:


my $action = $query->{action} || 'index'; if ($action eq 'index') { my $user = $query->{user} || ''; $root->{content} =~ s/%user%/$user/ig; } elsif ($action eq 'dologin') { # Logging in. my $okay = 0; # Process their input. my $user = &normalize($query->{username}); my $pass = md5_hex($query->{password}); my $keep = $query->{remember} || 'no'; # Does this user exist? if (&userExists($user)) { # Read the profile. &readUser($user); # Compare passwords. if ($root->{users}->{$user}->{password} eq $pass) { # Good. $okay = 1; } } # Authentication was okay? if ($okay) { # Log us in. $root->{auth} = 1; $root->{me} = $user; &doLogin($user,$pass,$keep); $root->{content} = "

Login Successful

\n\n" . "You will be redirected to your homepage " . "shortly.\n\n" . ""; } else { $root->{content} = "

Login Failed

\n\n" . "Your login attempt was denied."; } } elsif ($action eq 'logout') { # Clear out the cookies. $root->{auth} = 0; $root->{me} = 'guest'; &doLogout(); $root->{content} = "

Logged Out

\n\n" . "You will be redirected to your homepage " . "shortly.\n\n" . ""; }