#!/usr/bin/perl
$test_mode = "TRUE";
$test_mode = "FALSE";
$STYLE = "RACE";
$asknat = "hidden";
##############################################################################
# singmeup
##############################################################################
require "/var/www/custom/cgi/FORMCODE.cgi" ;
require "/var/www/custom/cgi/formmisc.cgi" ;
require "/var/www/custom/cgi/errors.cgi" ;
require "/var/www/custom/cgi/CC_VER" ;
require "/var/www/custom/cgi/ChipCheck" ;
# Define Variables #
# Detailed Information Found In README File. #
$CAT = '/bin/cat' ;
$GREP = '/bin/grep' ;
$SORT = '/bin/sort' ;
$RACELIST ="/var/race/RACE_LIST" ;
$EVENTLIST ="/var/race/EventID" ;
$mailprog = '/usr/sbin/sendmail -i -t';
$mailprog1= '/usr/sbin/sendmail -i -t -fsignups@comfortinc.com';
$mailto = "signups\@comfortinc.com" ;
$memberfile = "/var/race/members/memberfile" ;
$PPfile = "/var/race/members/Pprofiles" ;
#@referers = ('www.comfortsignups.com','comfortinc.com','srnet.com');
@referers = ('*');
@recipients = &fill_recipients(@referers);
@valid_ENV = ('REMOTE_HOST','REMOTE_ADDR','REMOTE_USER','HTTP_USER_AGENT');
##############################################################################
$TableCount = 0;
@theLINE = split(/\//,$0);
for($i=0;$i<15;++$i){
$parting = $theLINE[$i];
if($parting eq ""){$scriptname = $theLINE[$i-1];$i=16;}
}
if($ENV{'QUERY_STRING'}) {$scriptname .="?$ENV{'QUERY_STRING'}";}
$FORM1 = "/signup/$scriptname";
$FORM1 = "/cgi-bin/$scriptname";
$FORM2 = "/cgi-bin/$scriptname";
#require "/var/www/racedata/demo/demo/raceopts";
$formactionX = "http://www.comfortsignups.com$FORM1";
$incdir = "/var/www/racedata" ;
$incdir = "/home/signups/racedata" ;
$customdir = "/var/www/custom" ;
$HTMLdir = "/var/www/signups/docs/html" ;
$HTMLdir = "/var/www/custom/html" ;
$CGIdir = "/var/www/signups/cgi-bin" ;
$TEAMNAMES ="/var/race/TEAMNAMES";
$TEAMNAMES ="/var/race/TeamNames";
$FlatAdd = 1 ;
$PercentAdd = 0.05 ;
$PercentMore = 0.00 ;
$TeamMemberAdd = $FlatAdd;
$TeamMemberAdd = .50 ;
$Step = 1 ;
$AskForChip ="YES";
$Trust_Logo = "YES";
# Check Referring URL
&check_url;
# Retrieve Date
&get_date;
# Parse Form Contents
$AllUpper="TRUE";
&parse_form;
if($Form{Event} == 2023 || $Form{Event} eq 'cigna|Corporate'){
print "Location: http://www.comfortsignups.com/cgi-bin/cigna \n\n";
exit;
}
#if($Form{Event} == 2023 || $Form{Event} eq 'cigna|Corporate'){require "cigna";exit;}
#$WaiverIsSigned = "NEED WAIVER";
#if( $Form{agreement} ne ""){$WaiverIsSigned = "WAIVER OK";}
$Form{other_team_name} =~ tr [a-z] [A-Z];
(@Kids)=split(/\r\n/,$Form{KidsNames});
(@TeamMember)=split(/\r\n/,$Form{TeamMembers});
(@Series)=split(/\, /,$Form{SeriesEvent});
foreach (@TeamMember){ ++$TotalTeam ;}
$Form{country} =~ tr [a-z] [A-Z] ;
$Form{address} =~ s/\'//g;
&html_header("Computer Comfort Sign-ups","BGCOLOR=#FFFEEA");
# print " -$goodEvent - $Form{ProfileID}$Form{ProfilePassword} --";
$sdlname = $Form{lastname};
$sdfname = $Form{firstname};
$sdfname =~ s/ //g;
$sdfname =~ s/\.//g;
$sdfname =~ s/\'//g;
$sdlname =~ s/ //g;
$sdlname =~ s/\.//g;
$sdlname =~ s/\'//g;
$sdtos = substr($sdlname,0,1);
$sdtos .= substr($sdlname,length($sdlname)-1,1);
$sdtos .= substr($sdfname,0,1);
$control = "$dtos-$ttos-$sdtos" ;
$control =~ tr [a-z] [A-Z] ;
if($Form{credit_card_number} eq "PAPER-ENTRY") { $Form{PaperEntry} = "YES" ;}
if($Config{control} eq "") {$Config{control} = $control;}
$Action = $Config{Action};
$Step = "$Config{Step}$Config{step}";
if($ENV{'QUERY_STRING'} >0) {$Form{Event}="$ENV{'QUERY_STRING'}";}
$Event = "$Form{Event}$Form{event}$Form{EVENT}";
#print "$Event -- $ENV{'QUERY_STRING'}";
if ($Event eq "") { ¬now("NoEvent"); }
$goodEvent = (`$GREP \"|$Event|\" $EVENTLIST`);
if ($goodEvent) {
chop $goodEvent;
($fil1,$IDnum,$IDp1,$IDp2) = split(/\|/,$goodEvent);
if($Event == $IDnum) {$Event = "$IDp1|$IDp2" ;}
# $goodEvent = substr($goodEvent,1);
# $Event = substr($goodEvent,index($goodEvent,"|")+1);
}
$goodEvent = (`$GREP \"$Event|\" $RACELIST`);
if (!$goodEvent) { ¬now("NoEvent") ; }
($CompanyID,$EventID,$EventName,$EventTown,$EventState,$EventDTOS,$EventContact,$EventxEmail,$EventPhone,$EventOn,$TimeOn,$EventOff,$TimeOff,$filler1,$filler2,$SeriesID) =split(/\|/, $goodEvent);
$goodEvent = (`$GREP \"$CompanyID|\" $memberfile | $GREP \"|ACTIVE|\"`);
if (!$goodEvent) { ¬now("NoEvent") ; }
($XX1,$CompanyID,$XX3,$XX4,$CompanyContact,$CompanyPhone,$EventEmail,$CompanyName,$CompanyAddress1,$CompanyAddress2,$CompanyAddress3,$filler1,$filler2,$COSTATUS,$SeriesIDx) =split(/\|/, $goodEvent);
#&html_header("$EventName");
#print "$dtos - $EventOn - $EventOff";
#$TimeOff="2400";
$EventStart = "$EventOn$TimeOn";
$EventStop = "$EventOff$TimeOff";
$EventStart = "$EventOn"."0000";
$EventStop = "$EventOff"."2400";
$isNow = "$dtos".substr($ttos,0,4);
$Event =~ s/\|/\//g ;
#$incdir .= "$Event" ;
if ("$Form{lastname}" eq "BOULTON" && "$Form{firstname}" eq "BENN") {
&html_header ;
print "$CompanyID --- $EventID --
";
# print "$goodEvent";
&return_html ;
}
if ($ENV{REMOTE_ADDR} eq "216.107.209.01"){ $EventStart=20000000;$EventStop=999999999999;}
if (index($ENV{QUERY_STRING},"TestMode=YES" || $Form{PaperEntry} eq "YES")>0){ $EventStart=20000000;$EventStop=999999999999;}
if($Form{PaperEntry} eq "YES"){ $EventStop = "999999999999";}
if (index($ENV{QUERY_STRING},"TestMode=YES")>0){
}else{
#print "Registration Services are Temporary Unavailable.\n";
#print "
We expect to return service by 8:00 am Saturday (7-11-2009)\n";
#print "
We are sory for any inconvenience.\n";
#exit;
}
$Reg_Start = $EventStart;
$Reg_Stop = $EventStop;
$Reg_Count = `$GREP -c "-" $incdir/$Event/REGDATA.csv`;
$optfile = "$incdir/$Event/raceopts" ;
$TeamFile = "$incdir/$Event/SpecialTeamList" ;
$PayPassFile = "$incdir/$Event/paypass.pw";
$PayPass = `$CAT $PayPassFile`;
chomp $PayPass;
if (!-f "$optfile") { ¬now("Cannot Locate Options File"); }
#require "$optfile";
&getraceopts("$optfile") ;
if($MaxReg > 0 && $Reg_Count >= $MaxReg && $Form{PaperEntry} ne "YES"){¬now("This Event Is Full");}
if($Form{category} ne ""){
($CatName,$CatCode,$CatBib,$CatTeamSize,$CatFee,$CGchangedate,$CGnewfee)= split(/\|/,$Form{category});
$EventFee = $CatFee;
$AltFee = $CGnewfee;
$AltFeeDate = $CGchangedate;
($EventTempName)= split(/\(/,$CatName);
$EventName = "$EventName $EventTempName";
}
if( $Form{other_team_name} ne ""){
if ($AutoAddTeam ne "") {
open (OTN, ">>$TeamFile");
print OTN "$Form{other_team_name}\n";
close (OTN);
}
$Form{team_name} = $Form{other_team_name};
$Form{other_team_name} = "" ;
}
if($Form{ForcePrice} ne ""){$EventFee=$Form{ForcePrice} ;}
$ChipRace =~ tr [a-z] [A-Z];
if($ChipRace eq "CHECKED"){$ChipRace = "YES";}
$ClyFyl =~ tr [a-z] [A-Z];
$STYLE =~ tr [a-z] [A-Z];
$FreeShirt = "$tsizeC$tsizeS$tsizeM$tsizeL$tsizeXL$tsizesXXL" ;
$PProfile = "$Form{ProfileID}$Form{ProfilePassword}";
if ($PProfile && $STYLE ne "PAYMENT") {
$PProfile = "|$Form{ProfileID}|$Form{ProfilePassword}|";
$PPfile = "/var/race/members/PROFILES/$Form{ProfileID}-$Form{ProfilePassword}";
$PProfile = (`$GREP \"$PProfile\" $PPfile`);
if ($PProfile){
#print "
$PProfile
$PPfile";
($XX1,$XX2,$XX3,$lastname,$firstname,$address,$city,$state,$zip,$phone,$email,$gender,$DOBmonth,$DOBday,$DOByear,$ChipCode,$Country) = split (/\|/, $PProfile);
$isProfile = "YES";
}
}
if ($STYLE eq "PAYMENT" && $Step < 3) {
$ffg = crypt($Form{ProfilePassword},$Form{ProfileID});
#print "---$STYLE--- $Step $PProfile
$PayPass - $ffg - \n";
if($ffg ne $PayPass){$Form{Step} = $Step = 0;}
#print " $Step ";
if ($Step > 0) {
#print " ok ";
$Config{required} = "ProfileID,ProfilePassword";
$ForcePrice = " Charge: \$";
}
}
# if ($Form{lastname} eq "BOULTON" && $Form{firstname} eq "BENN") { $isNow = "200304040800";}
if($Form{PaperEntry} eq "YES"){ $EventStop = "999999999999";}
if ($EventID ne "demo") {
if ($isNow < $Reg_Start) { ¬now("NotYet"); }
if ($isNow > $Reg_Stop) { ¬now("TooLate"); }
}
#print "$isNow -- $EventStart ";
$EventDate = "$months[$EventMonth-1] $EventDay, $EventYear";
if($AltFeeDate ne "" && length($AltFeeDate)==8){ $AltFeeDate .= "0000";}
if($AltFeeDate ne "" && $isNow > $AltFeeDate){ $EventFee = $AltFee;}
if($Form{ForcePrice} ne ""){$EventFee=$Form{ForcePrice} ;}
$RACE = $EventName;
$FEE = $EventFee;
if ($Action eq "" ) { $Action = $Form{action}; }
$Action =~ tr [a-z] [A-Z] ;
if ($Event eq "" && $Action eq "") { ¬now("NoEvent") ; }
if ($Action eq "") { $Action = "CONTINUE"; $Step = 0 }
&html_header("Computer Comfort Sign Ups");
print "
$EventName
";
if ($EventID ne "demo" && $STYLE ne "PAYMENT") { print "$EventDate $EventStart"; }
if($Form{PaperEntry} eq "YES"){ print "
Paper Entry";}
print "
\n";
###BBB&Table_End;
###BBB&Table_Start("1");
$waiverfile = "$incdir/$Event/waiver.txt" ;
$Config{recipient} = $EventEmail;
if($Form{PaperEntry} eq "YES"){
$ForcePrice = "Event Fee: \$";
if($PaperFee ne "" && $PaperFee != $EventFee){ $EventFee = $PaperFee;}
$AskBib = "Event/Bib #:";
$AskAge = "Age On Race Day: ";
#$email = "$EventEmail";
#$email2 = "$EventEmail";
$Config{email2} = $Config{email} ;
if($FeeOverride eq "checked"){
$ForcePrice = "Event Fee: \$";
}else{
$SkipEmail = "";
$NoShirt = "";
}
}
# Check Required Fields
&more_required ;
&check_required;
$NextStep = $Config{NextStep} ;
#print "
$PProfile
$PPfile";
$PProfile = "$Form{ProfileID}$Form{ProfilePassword}";
if ($PProfile) {
$PProfile = "|$Form{ProfileID}|$Form{ProfilePassword}|";
# $Form{ProfileID} =~ tr [a-z] [A-Z] ;
# $Form{ProfilePassword} =~ tr [a-z] [A-Z] ;
## $PProfile = (`$GREP \"|$Form{ProfileID}|$Form{ProfilePassword}|\" $PPfile`);
$PProfile = (`$GREP \"$PProfile\" $PPfile`);
if ($PProfile){
($XX1,$XX2,$XX3,$lastname,$firstname,$address,$city,$state,$zip,$phone,$email,$gender,$DOBmonth,$DOBday,$DOByear,$ChipCode) = split (/\|/, $PProfile);
$isProfile = "YES";
}
}
$TYPE = "ON-LINE" ;
if ($TYPE eq "ONLINE") { $TYPE = "ON-LINE"; }
if($Form{PaperEntry} eq "YES") {$TYPE="PAPER-ENTRY";$credit_card_number ="TESTING";}
if($Form{credit_card_number} eq "TESTING"){$TYPE = "MAIL-IN";}
if($Form{credit_card_number} eq "PAPER-ENTRY"){$TYPE = "MAIL-IN";}
$CSVFILE = "$incdir/$Event/regfiles/$Config{control}";
if ($Step == 5) {
if ($TYPE eq "ON-LINE") {
if($Form{credit_card_number} eq "TESTING"){
$Form{TestMode} = "YES";
$test_mode ="TRUE";
}else {
&CC_Verify;
$last4 = "XXXX-XXXX-XXXX-".substr($cardnumber,length($cardnumber)-4,4) ;
}
} # else {$FEE = $MAILINFEE; }
$Responce_Code = 0 ;
if($Form{credit_card_number} eq "TESTING") {$Responce_Code = 1;}
if($Form{PaperEntry} eq "YES") {$Responce_Code = 1;}
## removed @()'s from here
foreach (@Series){(@SerEV)=split(/\|/,$_);$TOTAL = $TOTAL +$SerEV[2]; }
foreach (@Kids){$TOTAL = $TOTAL +$funrunfee; }
#foreach (@TeamMember){print "$_ 1"; $TOTAL = $TOTAL +$FEE +$TeamMemberAdd; ++$FlatAdd; }
$CCFEE = $FEE+$TOTAL+$ServiceCharge;
$CCFEE = $ONLINEFEE+$TOTAL+$OnLineCharge ;
$CCFEE = $Form{CCFEE} ;
if ($Form{lastname} eq "BENN BOULTON" && $Form{firstname} eq "BENN BOULTON") {
$CCFEE = "1.00" ;
}
#$Form{firstname} = $RunnerFirst;
#$Form{lastname} = $RunnerLast;
if($Form{TestMode} ne "YES" && $test_mode eq "FALSE") {
print "
Card Declined
Click your Browser's BACK button
and make sure the information is correct
or use a different credit card.") ;
}
}
if ($Action eq "CONTINUE") {
$Form{chipcode} =~ s/ //g;
$Form{chipcode} =~ s/-//g;
$Form{chipcode} =~ tr [a-z] [A-Z] ;
if ($Step == 0) {
&form_begin("form1","$FORM1");
if($STYLE eq "PAYMENT" && $NoPaymentPassword ne "YES"){
print "Enter Your Payment ID and Password
";
}else{
# if($CompanyID eq "cigna"){&AskSigningUp;}
print "If you have a Comfort Signups
";
print "participant profile enter information
";
}
print "ID: ";
&FORM_input("text","ProfileID","",10);
print "Password: "; &FORM_input("password","ProfilePassword","",10);
if($STYLE ne "PAYMENT"){
# print "
NOTE: Due to error, all profiles saved before";
# print "
April 13th 2007, were lost. Sorry! ";
print "
";
print "If you DO NOT have a profile, you can save one
";
print "at the end of the registration process.
";
}
&form_end("1") ;
&html_footer;
exit;
}
}
if ($Action eq "COMPLETE") {
&add_to_file;
# &mail_ack ;
exit ;
}
if ($Action eq "CONTINUE") {
if ($Step == 1) {
if ($isProfile) {
print "Welcome back $firstname $lastname
\n";
}
&help_script;
&form_begin("form1","$FORM1");
&get_waiver_ok;
# $CorpSignup ="checked";
# if($SeriesID ne "") { &ShowSeries ;}
if($CorpSignup eq "checked") { &AskSigningUp; }
&form_end($Step+1);
&html_footer;
}
if ($Step == 2) {
&Table_End;
&form_begin("form1","$FORM1");
if ($Form{signup_type} eq "GROUP") {
$Group = "YES" ;
print "";
}
&FORM_input("hidden","PaperEntry","$Form{PaperEntry}");
if ($isProfile) {print ""; }
if($Form{CorporInd} eq "CorpTeam"){
print"Please Enter Company Contact/Captian Information\n";
print "
Company Name\n";
print "Team Name \n";
if(-f "$incdir/$Event/TeamList.csv"){$TEAMNAMES.=" $incdir/$Event/TeamList.csv";}
# if($CompanyID eq "cigna"){$TEAMNAMES.=" $incdir/Corporate/TeamList.csv";}
&teamnames;
$CorpBypassOn = "";
}
print"";
if($Form{CorporInd} eq "CorpTeam"){
print"Team Contact Information\n";
}
$Country_List ='';
$Country_List ="";
$State_List ="";
$State_List = '';
if(-f "/var/www/custom/html/State_list.html"){
$State_List = `$CAT /var/www/custom/html/State_list.html`;
if(-f "$incdir/$Event/state_list.txt"){@Add_States=` $CAT $incdir/$Event/state_list.txt`;}
foreach $newState (@Add_States) {
chomp($newState);
($st_opt,$st_desc) = split(/\=/,$newState);
$State_List .= ""
}
$State_List .= ""
}
$State_List ="";
if ($STYLE eq "TICKETS" || $STYLE eq "CONCERT"){
$CorpBypassOn = "";
}
if ($STYLE ne "PAYMENT"){
print &getTemplate('/var/www/custom/html/racereg.html');
print &getTemplate('/var/www/custom/html/racereg2.html');
print &getTemplate('/var/www/custom/html/racereg3.html');
} else {
print &getTemplate('/var/www/custom/html/payments.html');
}
print '';
if($SeriesID ne "") { &ShowSeries ;}
# if($WaveStart ne "") {
$EvCatCnt = 0;
# foreach (`$CAT $incdir/$Event/category.txt`) {
# if($EvCatCnt == 0){
# print "Please Select Your Event Category | ";
print "Please Select Your Event Category \n"; print " | ||
| \n"; print "$CatName | "; print "$CatExtra | \n"; print "\$$CatFee\n |
Please enter
LAST NAME,FIRST NAME,AGE(on Race Day),GENDER(M or F)";
if ($FreeShirt) {print ",Shirt Size(as listed above)"; }
print " seperated by commas:
| Last Name | First Name | Age (Event Day) | Gender | \n"; if ($FreeShirt) {print "Shirt Size | \n";} print "|
|---|---|---|---|---|---|
| "; print " | "; print " | "; print " | M "; print "F | "; if ($FreeShirt) { print ""; } print " | "; print " |
"; &Table_Start; $ChipRace =~ tr [a-z] [A-Z]; if($ChipRace eq "CHECKED"){$ChipRace = "YES";} $MODE1 = "DISPLAY"; if($ChipRace eq "YES" && $Form{CorporInd} ne "CorpTeam"){&pr_chipinfo;} if ($ClyFyl eq "YES") { print "
Clydesdale/Filly ";
print "Check here only if you are male 190+ pounds or female 140+ pounds. $RACE\n" ;
if($FEE > 0){
print "\$ ";
print sprintf ("%5.2f",$FEE);
}
print " Check here to";
print " remember above the information as a ";
print "Comfort Signup Profile.
\n";
}
if($UseTeams eq "checked" && $Form{CorporInd} ne "CorpTeam"){ &teamnames; }
if ($Form{signup_type} eq "BYPASS"){
open (ST2,"/$incdir/$Event/bypassoptions.htm");
while (";
# print sprintf(" ";
&Table_End;
if($EvCatCnt == 0){
if($STYLE eq "TICKETS"){$rpalign="center";}else{$rpalign="left";}
print "\$%9.2f ",$EventFee );
# print "
\n";
print "Click the browser BACK BUTTON to go back and make any corrections
\n";
}
$require="lastname,firstname";
if($STYLE ne "PAYMENT" && $STYLE ne "TICKETS"){$require=$require.",gender,DOBmonth,DOBday,DOByear";}
$require= $require.",city,state,zip,email,email2,Phone,shirt_size";
if($AskCountry ne "") {$require = $require.",country";}
# $require="lastname,firstname,gender,DOBmonth,DOBday,DOByear,city,state,zip,email,email2,Phone,shirt_size";
$sdlname = $Form{lastname};
$sdfname = $Form{firstname};
$sdfname =~ s/ //g;
$sdfname =~ s/\.//g;
$sdlname =~ s/ //g;
$sdlname =~ s/\.//g;
$sdtos = substr($sdlname,0,1);
$sdtos .= substr($sdlname,length($sdlname)-1,1);
$sdtos .= substr($sdfname,0,1);
# $sdtos .= substr($dtos,6);
$control = "$dtos-$ttos-$sdtos" ;
$control =~ tr [a-z] [A-Z] ;
# print "";
&form_end($Step+1,"$NEXT");
}
}
if ($Action eq "FINISH") {
if ($Step == 5) {
# $TYPE="ON-LINE";
# &FORMinput("hidden","RaceDayAge","0");
$FEE = $ONLINEFEE;
$FEE = $EventFee;
if ($Form{team_name} eq "NONE") { $Form{team-name} == "" ;}
if ($Form{Group} eq "YES" || $Form{Group} eq "ON") {
$Group = "YES";
$FEE = $MAILINFEE;
$TYPE="MAIL-IN";
}
# if ($TYPE eq "ON-LINE") {
# &CC_Verify;
# $last4 = "XXXX-XXXX-XXXX-".substr($cardnumber,length($cardnumber)-4,4) ;
# }else {$FEE = $MAILINFEE; }
&calcage;
$MODE1 = "DISPLAY";
&Step3A ;
if ($Form{lastname} eq "BOULTON" && $Form{firstname} eq "BENN") {
print "$Form{EventID}
--";
&return_html ;
}
&html_footer;
# if ($TYPE eq "ON-LINE") { &ccgetinfo; }
# if ($TYPE eq "MAIL-IN") { $Step = 4; }
if ($Adjustment eq "INCLUDED") {
if($Address_VCode eq "Y"){ $PercentMore = 0;}
$TeamMemberAdd = 0;
$DiVisor = $PercentAdd+$PercentMore ;
$ServiceCharge = int($TOTAL * $DiVisor * 100)/100 + $FlatAdd ;
if ($CompanyID eq "prponh" && $ServiceCharge == 2.05){
# $ServiceCharge = 2.00 ;
}
if ($TotalTeam > 1) {
$ServiceCharge = int($TOTAL*$DiVisor * 100)/100 + ($FlatAdd*$TotalTeam) ;
}
if($ServiceCharge < $MinServiceCharge) {$ServiceCharge = $MinServiceCharge;}
$FEE = $TOTAL - $ServiceCharge ;
$FEE =~ s/ //g;
$TOTAL = $FEE ;
$FEE = sprintf("%9.2f",$FEE ) ;
}
$CSVFILE = "$incdir/$Event/regfiles/$Config{control}";
if (-f "$CSVFILE") {
}else {
$RunnerFirst = $Form{firstname};
$RunnerLast = $Form{lastname};
if($SeriesAdd > 0) {
$X_Event = $Event;
# (@Series)=split(/\, /,$Form{SeriesEvent});
foreach (@Series){
(@SerEV)=split(/\|/,$_);$Event = "$SerEV[0]/$SerEV[1]";
$TOTAL = $SerEV[2];
$RACE = $SerEV[3];
if ($SerEV[4] eq "ADD"){
$ServiceCharge = (($TOTAL +$FlatAdd) * $PercentAdd)+$FlatAdd ;
}else{
$DiVisor = $PercentAdd+$PercentMore ;
$ServiceCharge = int($TOTAL * $DiVisor * 100)/100 + $FlatAdd ;
}
if($ServiceCharge < $MinServiceCharge) {$ServiceCharge = $MinServiceCharge;}
if($TYPE eq "ON-LINE"){&make_ccdata ;&add_to_cc_file ; }
if ($CompanyID eq 'nedin'){ print " Ta ";}
&do_file_stuff;
}
$TOTAL = $EventFee;
}
if($TYPE eq "ON-LINE"){&make_ccdata ;&add_to_cc_file ; }
if($TotalTeam > 0) {
$X_TOTAL = $TOTAL ;
$X_SERVICECHARGE = $ServiceCharge;
$T_COMPANY = $Form{CompanyName} ;
$T_ADDRESS = $Form{address} ;
$T_CSZ = "$Form{city} $Form{state} $Form{zip}" ;
$T_CONTACT = "$Form{firstname} $Form{lastname}";
$T_EMAIL = $Config{email} ;
$T_PHONE = "$Phone $Form{phone2}" ;
foreach (@TeamMember){
if ($Adjustment eq "INCLUDED") {
$TOTAL = $FEE;
$FlatAdd = $TeamMemberAdd;
if($Address_VCode eq "Y"){ $PercentMore = 0;}
$DiVisor = $PercentAdd+$PercentMore ;
$ServiceCharge = int($TOTAL * $DiVisor * 100)/100 + $FlatAdd ;
$FEE = $TOTAL - $ServiceCharge ;
$FEE =~ s/ //g;
$TOTAL = $FEE ;
$FEE = sprintf("%9.2f",$FEE ) ;
}else {
$TOTAL= $EventFee;
$ServiceCharge = (($TOTAL +$TeamMemberAdd) * $PercentAdd)+$TeamMemberAdd ;
# $TOTAL = $TOTAL - $ServiceCharge ;
}
(@tmemberinfo) = split(/\^/,$_);
$Form{firstname}=$tmemberinfo[0];
$Form{lastname}=$tmemberinfo[1];
$Form{gender}=$tmemberinfo[2];
$Form{RaceDayAge} = $tmemberinfo[3];
$Form{city}=$tmemberinfo[4];
$Form{state}=$tmemberinfo[5];
$Form{shirt_size}=$tmemberinfo[6];
$Form{Chipcode}= $tmemberinfo[7];
#$Form{team_name} .= $Form{CompanyTeam};
$Form{zip}= "";
if ($CompanyID eq 'nedin'){ print " Tb ";}
&do_file_stuff;
}
}else{
if ($CompanyID eq 'nedin'){ print " Tc ";}
&do_file_stuff;
}
#if($Form{PaperEntry} eq "YES"){ print "";exit;}
&send_ack;
if ($Form{Save_Me} eq "SAVE_ME") { &SaveMe; }
# &do_alert;
}
}
}
exit ;
sub do_file_stuff {
if ($CompanyID eq 'nedin'){ print " T1 ";}
&make_filedata;
if ($CompanyID eq 'nedin'){ print " T3 ";}
&add_to_file;
if ($CompanyID eq 'nedin'){ print " T2 ";}
&save_data;
if ($CompanyID eq 'nedin'){ print " T4 ";}
}
sub form_begin {
local($formname,$formaction) = @_;
print "\n";
}
sub parse_form {
# Define the configuration associative array. #
%Config = ('recipient','', 'subject','',
'email','', 'realname','',
'redirect','', 'Step','',
'background','', 'control','',
'vlink_color','', 'NextStep','',
'alink_color','', 'title','',
'sort','', 'print_config','',
'required','', 'env_report','',
'return_link_title','', 'return_link_url','',
'print_blank_fields','', 'missing_fields_redirect','',
'Action','', 'ContactEmail','',
'email2','', 'XontactEmail','');
# print " METHOD = $ENV{'REQUEST_METHOD'}" ;
if ($ENV{'REQUEST_METHOD'} eq 'GET') {
# Split the name-value pairs
@pairs = split(/&/, $ENV{'QUERY_STRING'});
}
elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
$buffer .= "&RaceDayAge=0";
# Split the name-value pairs
@pairs = split(/&/, $buffer);
}
else {
# &Login ;
&error('request_method');
}
# For each name-value pair: #
foreach $pair (@pairs) {
# Split the pair up into individual variables. #
local($name, $value) = split(/=/, $pair);
# Decode the form encoding on the name and value variables. #
# v1.92: remove null bytes #
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$name =~ tr/\0//d;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/\0//d;
# $value =~ s/\,//g;
# If the field name has been specified in the %Config array, it will #
# return a 1 for defined($Config{$name}}) and we should associate #
# this value with the appropriate configuration variable. If this #
# is not a configuration form field, put it into the associative #
# array %Form, appending the value with a ', ' if there is already a #
# value present. We also save the order of the form fields in the #
# @Field_Order array so we can use this order for the generic sort. #
if (defined($Config{$name})) {
$Config{$name} = $value;
}
else {
if ($Form{$name} ne '') {
$Form{$name} = "$Form{$name}, $value";
}
else {
push(@Field_Order,$name);
if($name eq "TeamMembers"){
$value =~ tr [a-z] [A-Z] ;
$value =~ s/\,/^/g;}
if($name ne "KidsNames"){
$value =~ s/\,/ /g;
}
# $value =~ tr [a-z] [A-Z] ;
$Form{$name} = $value;
}
}
}
# The next six lines remove any extra spaces or new lines from the #
# configuration variables, which may have been caused if your editor #
# wraps lines after a certain length or if you used spaces between field #
# names or environment variables. #
$Config{'required'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$Config{'required'} =~ s/(\s+)?\n+(\s+)?//g;
$Config{'env_report'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$Config{'env_report'} =~ s/(\s+)?\n+(\s+)?//g;
$Config{'print_config'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$Config{'print_config'} =~ s/(\s+)?\n+(\s+)?//g;
# Split the configuration variables into individual field names. #
@Env_Report = split(/,/,$Config{'env_report'});
@Print_Config = split(/,/,$Config{'print_config'});
# ACCESS CONTROL FIX: Only allow ENV variables in @valid_ENV in #
# @Env_Report for security reasons. #
foreach $env_item (@Env_Report) {
foreach $valid_item (@valid_ENV) {
if ( $env_item eq $valid_item ) { push(@temp_array, $env_item) }
}
}
@Env_Report = @temp_array;
}
sub check_required {
# Localize the variables used in this subroutine. #
local($require, @error);
# The following insures that there were no newlines in any fields which #
# will be used in the header. #
@Required = split(/,/,$Config{'required'});
if ($Config{'subject'} =~ /(\n|\r)/m || $Config{'email'} =~ /(\n|\r)/m ||
$Config{'realname'} =~ /(\n|\r)/m || $Config{'recipient'} =~ /(\n|\r)/m) {
&error('invalid_headers');
}
if (!$Config{'recipient'}) {
if (!defined(%Form)) { &error('bad_referer') }
else { &error('no_recipient') }
}
else {
# This block of code requires that the recipient address end with #
# a valid domain or e-mail address as defined in @recipients. #
$valid_recipient = 0;
foreach $send_to (split(/,/,$Config{'recipient'})) {
foreach $recipient (@recipients) {
if ($send_to =~ /$recipient$/i) {
push(@send_to,$send_to); last;
}
}
}
if ($send_to < 0) { &error('no_recipient') }
$Config{'recipient'} = join(',',@send_to);
}
# For each require field defined in the form: #
foreach $require (@Required) {
if ($require eq 'cardemail' && !&check_email($Form{$require})) {
push(@error,$require);
}
# If the required field is the email field, the syntax of the email #
# address if checked to make sure it passes a valid syntax. #
if ($require eq 'email' && !&check_email($Config{$require})) {
push(@error,$require);
}
# Otherwise, if the required field is a configuration field and it #
# has no value or has been filled in with a space, send an error. #
elsif (defined($Config{$require})) {
if ($Config{$require} eq '') { push(@error,$require); }
}
# If it is a regular form field which has not been filled in or #
# filled in with a space, flag it as an error field. #
elsif (!defined($Form{$require}) || $Form{$require} eq '') {
push(@error,$require);
}
}
# If any error fields have been found, send error message to the user. #
if (@error) { &error('missing_fields', @error) }
}
sub notnow {
# Localize variables and assign subroutine input. #
local($error,@error_fields) = @_;
&html_header;
&error_header;
if ($error eq 'NotYet') {
$error = " Sorry
$EventName
Registrations Are Not Activated Yet.";
$error .= "
Please come back after ";
if($TimeOn >1159) {
$error .= substr($TimeOn,0,2) -12;
}else{
$error .= substr($TimeOn,0,2);
}
$error .= ":".substr($TimeOn,2,2);
if($TimeOn <1159) {$error .= "am";}else{$error .= "pm";}
$error .= " on ";
$error .= substr($EventOn,4,2)."/";
$error .= substr($EventOn,6,2)."/";
$error .= substr($EventOn,0,4);
}
if ($error eq 'TooLate') {
$error = " Sorry
$EventName
Online Registrations Are CLOSED.
";
if($RaceDayReg eq "YES"){ $error="$error You can still register on race day at the event.";}
if($CloseLink ne ""){ $error="$error
More Information";}
}
if ($error eq 'NoEvent') {
$error = " NOT a valid Event.";
}
print "$error";
&error_footer;
print "$isNow - $EventStart - $EventStop";
exit;
}
sub error_header {
&html_header("","bgcolor=#FFFFFF text=#000000");
print <<"(END ERROR HTML)";
$racetitle1