<% use strict; use vars qw( $dbh ); $Response->Include("head1.inc"); my $template = slurp_template(); my ($aff_email, $aff_password, $mesg, $aff_id, $aff_name); if ($Request->Form("submit_affiliate")) { $aff_email = $Request->Form("aff_email"); $aff_password = $Request->Form("aff_password"); #clean up form values $aff_email =~ s/^\s*//; $aff_email =~ s/\s*$//; $aff_password =~ s/^\s*//; $aff_password =~ s/\s*$//; #check required fields if (!$aff_email || !$aff_password) { $mesg = "Please complete the form."; goto PRINT_PAGE; } #check if affiliate member my $sth = $dbh->prepare("SELECT affiliate_id, affiliate_name FROM Affiliate WHERE affiliate_email=? AND password=?"); $sth->execute($aff_email, $aff_password); unless (($aff_id, $aff_name) = $sth->fetchrow) { $sth->finish; $mesg = "Invalid Username/Password."; goto PRINT_PAGE; } $sth->finish; #if affiliate has been verified $Response->Cookies('tsaffiliate', 'id', $aff_id); $Response->Cookies('tsaffiliate', 'uname', $aff_name); $Response->Cookies('tsaffiliate', 'email', $aff_email); #redirect to referrals page $dbh->disconnect(); $Response->Redirect("afreferrals.asp"); } PRINT_PAGE: my $template_body = qq{
M A N A G E   Y O U R   A F F I L I A T E   A C C O U N T

View your referrals and commissions online! If you are not a member yet, please sign up now.

If you find any discrepancies with your referrals and total commissions, please send us email.

Email Address:

Forgot password?











}; $template =~ s//$template_body/s; print $template; $dbh->disconnect(); %>