#!/usr/bin/perl use strict; use CGI::Pretty qw(:standard); use Digest::MD5 qw(md5_based64); use constant USER_DATA => '/usr/local/httpd/data/users/'; use constant ERR_MSG => 'Your username and password information did not match. #!/usr/bin/perl use strict; use CGI::Pretty qw(:standard); use Digest::MD5 qw(md5_based64); use constant CONF => '/usr/local/httpd/data/users/'; use constant ERR_MSG => 'Your username and password information did not match. Check to see that you do not have Caps Lock on, hit the back button, and try again.'; my $config = do(CONFIG}' #!/usr/bin/perl use strict; use CGI::Pretty qw(:standard); use Digest::MD5 qw(md5_base64); use CGI::Carp qw(fatalsToBrowser); use constant CONF => '/usr/local/httpd/data/users/'; use constant ERR_MSG => 'Your username and password information did not match. Check to see that you do not have Caps Lock on, hit the back button, and try aga in.'; my $config = do(CONF); my $_username = param( 'username' ) || ''; my $_password = param( 'password' ) || ''; my $_remember = param( 'remember' ) || ''; my ($username) = ($_username =~ /(\w+)/); my ($password) = ($_password =~ /(\w+)/); my ($remember) = ($_remember =~ /(\w+)/); use CGI::Carp qw(fatalsToBrowser); use constant CONF => '/usr/local/httpd/data/users/'; use constant ERR_MSG => 'Your username and password information did not match. Check to see that you do not have Caps Lock on, hit the back button, and try aga in.'; my $config = do(CONF); my $_username = param( 'username' ) || ''; #!/usr/bin/perl use strict; use CGI::Pretty qw(:standard); use Digest::MD5 qw(md5_base64); use CGI::Carp qw(fatalsToBrowser); use constant CONF => '/usr/local/httpd/data/conf/test.conf'; use constant ERR_MSG => 'Your username and password information did not match. Check to see that you do not have Caps Lock on, hit the back button, and try aga in.'; my $config = do(CONF); my $_username = param( 'username' ) || ''; my $_password = param( 'password' ) || ''; my $_remember = param( 'remember' ) || ''; my ($username) = ($_username =~ /(\w+)/); my ($password) = ($_password =~ /(\w+)/); my ($remember) = ($_remember =~ /(\w+)/); # the rest of the program goes here. my $userfile = $config->{ users } . $username; my $message = ERR_MSG; $message = $config->{users} . $username; open (USER, "< $userfile") or display_page($userfile . $username), exit; chomp (my ( $real_password, $sessionID, $remember) = ); close USER; my $digest = md5_base64($password,$config->{salt}); if ($digest eq $real_password) { $message = "Hello, $username. You gave me a good password"; } display_page('>'.$password . '::' .$digest. '::'.$real_password . '::' .$config- >{salt}); exit; sub display_page { my $message = shift; print header, start_html, p($message). end_html; }