# Utils.pm #################### sub AuthenticateUser { my $user = shift; my $passwd = shift; my $privs = shift; my $res; my $authlink = $Globals::baseurl."/cgi-bin/auth.pl"; # now we have to authenticate the user $res = CGI_ats::GetUserandPasswd(\$user, \$passwd, \$privs); #$res = 1; if (!$res) { print "cookie($CGI_ats::ats_cookie_name); #Check it was defined if(! defined $cookie) { Utils::HTMLFailure("Failed to get $CGI_ats::ats_cookie_name cookie"); return 0; } my @cookie_content = split(/\,/, MIME::Base64::decode($cookie)); # check if had valid content if(! scalar @cookie_content) { Utils::HTMLFailure("Failed to get $CGI_ats::ats_cookie_name cookie"); return 0; } $$user = $cookie_content[0]; $$password = MIME::Base64::decode($cookie_content[1]); $$privs = $cookie_content[2]; return 1; } ############## # auth.pl if(defined $CGI_ats::query->param('op')) { if($CGI_ats::query->param('op') eq 'login') { # make sure we have a name and password before we # enter the poll loop if(! defined $CGI_ats::query->param('name') || ! $CGI_ats::query->param('name') || ! defined $CGI_ats::query->param('passwd') || ! $CGI_ats::query->param('passwd')) { $error_text = "

User name and password not supplied

\n"; } else { # we have to enter a poll loop to do this enter_poll(); } ############### # results.pl $res = Utils::AuthenticateUser(\$user, \$passwd, \$privs); if (!$res) { exit(1); }