Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use DBI;
- use DBD::Pg;
- use DateTime;
- use CGI ':standard';
- my $username = $ENV{"HTTP_CAS_USER"}; # username from the environment
- my $password = "";
- my $effective = 0;
- my $expiry = 0;
- my $comment = "";
- my $email = "";
- my $state = "active";
- my $sponsor = $username; # for now, the sponsor is the uw user
- sub expiry {
- # in this subroutine we want to define different sponsorship
- # periods depending on who the sponsor is (professor vs
- # ungergraduates and so forth
- my $startDate = $_[0];
- my $duration = DateTime::Duration->new ( months => 1);
- return ($startDate + $duration);
- }
- my ($cday, $cmonth, $cyear) = (localtime)[3,4,5];
- my $cdate = ($cyear+1900)."-".($cmonth+1)."-".($cday);
- my $currentTime = DateTime->from_epoch( epoch => time());
- my $expiryDate = expiry($currentTime)->date;
- print header;
- print start_html("NetID Activation");
- print start_form;
- print "<table border=\"1\" cellpadding=\"2\" frame=\"void\">\n<tr>\n<th align=\"left\">UW ID:</th><th>";
- print textfield(-name=>'uwid',
- -value=>$username,
- -size=>35,
- -maxlength=>30);
- print "</th>\n</tr>\n<tr>\n<th align=\"left\">Password</th><th>";
- print password_field(-name=>'password',
- -value=>'',
- -size=>'35',
- -maxlength=>'80');
- print "</th>\n</tr>\n<tr><th align=\"left\">E-mail</th><th>";
- print textfield(-name=>'email',
- -value=>'',
- -size=>35,
- -maxlength=>50);
- print "</th>\n</tr>\n<tr><th align=\"left\">Sponsor</th><th>";
- print textfield(-name=>'sponsor',
- -value=>$username,
- -size=>35,
- -maxlength=>50,
- -disabled=>1);
- print "</th>\n</tr>\n<tr><th align=\"left\">Effective</th><th>";
- print textfield(-name=>'effective',
- -value=>$cdate,
- -size=>35,
- -maxlength=>15,
- -disabled=>1);
- print "</th>\n</tr>\n<tr><th>Expiry</th><th>";
- print textfield(-name=>'expiry',
- -value=>$expiryDate,
- -size=>35,
- -maxlength=>15,
- -disabled=>1);
- print "</th>\n</tr>\n</table>\n";
- print "<p>",reset;
- print submit('Action','Activate Net ID');
- print end_form;
- print "<hr>\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement