use Time::Local; ############################################################### ### Define any globals ############################################################### my $org_url = "lyaa"; my $method = "post"; #Use Post for production, it hides the parameters. #my $paypal_url = "https://www.sandbox.paypal.com/cgi-bin/webscr"; #my $paypal_acc = "jeremyhlmclean\@yahoo.com"; #my $paypal_acc = "jeremy_1195331242_biz\@yahoo.com"; #my $paypal_acc = "jeremymclean\@gmail.com"; my $paypal_acc = "lyaaball\@comcast.net"; my $admin_url = "regadmin.html"; my $page_url = "reg.html"; my $thanks_url = "https://www.hometeamzonline.com/lyaa/$page_url?action=pp"; my $ipn_url = "http://www.hometeamzonline.com/pp/ipn.php"; my $base_reg_url = "https://www.hometeamzonline.com/$org_url/$page_url"; #my $paypal_acc = "jeremymclean\@gmail.com"; my $paypal_url = "https://www.paypal.com/cgi-bin/webscr"; #my $thanks_url = "https://www.hometeamzonline.com/$org_url/thanks.html?transaction="; $phone_example = "Format 847-999-9999"; ################################################################ ### This is the admin Sub routing for the home page ################################################################ sub main_thanks{ $failed_login = 0; ############################################################### ### Get paramters ############################################################### $page = param('page'); $sub = param('sub'); $coach = param('coach'); $newnews = param('news'); $title = param('title'); $date = param('date'); $update = param('update'); $obj_id = param('obj_id'); $month = param('month'); $year = param('year'); $day = param('day'); #$org_id = param('org_id'); $league_id = param('league_id'); $user = param('user'); $pass = param('pass'); $filter = param('filter'); $admin = param('admin'); $info_id = param('info_id'); $login = param('login'); $personal = param('personal'); $action = param('action'); $newemail = param('newemail'); ############################################################### ### Print Header ############################################################### %site_info = get_site_info($org_id); $site_info{"site_banner_image"} =~ s/\/home\/homete3\/public_html//; $site_info{"site_logo"} =~ s/\/home\/homete3\/public_html//; print header(); print_start_header_main(); print_style(); ############################################################### ### Print Body of HTML doc ############################################################### print <<__HTML__; __HTML__ $active_id{"login"} = ""; $active_id{"create"} = ""; $active_id{"register"} = ""; $active_id{"verify"} = ""; $active_id{"pay"} = ""; #ADDED this portion to show logout feature. my $email = param('email'); my $pw = param('pw'); my $session_id = check_reg_login($email, "$pw"); if($session_id ne ""){ $transaction_id = param("transaction"); $valid = check_transaction_user($session_id, $transaction_id); }else{ $valid = 0; } print_top($session_id); #print_right_border($org_id); #print_menu($org_id); print_reg_info(); print "VALID: $valid
\n"; $active_id{"complete"} = "id=current"; print_steps(); if($valid == 1){ print_thanks($transaction_id); }else{ print_show_purchase_invalid(); } } sub check_transaction_user{ my $session = shift; my $transaction_id = shift; my $valid = 0; my $session_user = get_user_by_session($session); my $txn_user = get_user_by_transaction($transaction_id); #print "SESSION USER: $session_user
\n"; #print "TXN_USER: $txn_user
\n"; if(($session_user != 0)&&($txn_user != 0)){ if($session_user == $txn_user){ $valid = 1; } } return $valid; } sub get_user_by_transaction{ my $transaction_id = shift; my $dbh = get_dbh(); my $return_key = 0; ################################################################ # Query DB for tranasctions ################################################################ my $query = "SELECT `Account_ID` FROM `TMP_PAYPAL` WHERE `Transaction_ID` = '$transaction_id'"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Key); while($sth->fetch()) { $return_key = $Key; } $sth->finish(); $dbh->disconnect; return $return_key; } sub get_user_by_session{ my $session = shift; my $dbh = get_dbh(); my $return_key = 0; ################################################################ # Query DB for tranasctions ################################################################ my $query = "SELECT `Key` FROM `Account_Info` WHERE `Last_Access_ID` = '$session'"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Key); while($sth->fetch()) { $return_key = $Key; } $sth->finish(); $dbh->disconnect; return $return_key; } ################################################################ ### This is the admin Sub routing for the home page ################################################################ sub admin_registration{ $failed_login = 0; ############################################################### ### Get paramters ############################################################### $page = param('page'); $sub = param('sub'); $coach = param('coach'); $newnews = param('news'); $title = param('title'); $date = param('date'); $update = param('update'); $obj_id = param('obj_id'); $month = param('month'); $year = param('year'); $day = param('day'); #$org_id = param('org_id'); $league_id = param('league_id'); $user = param('user'); $pass = param('pass'); $filter = param('filter'); $admin = param('admin'); $info_id = param('info_id'); $login = param('login'); $personal = param('personal'); $action = param('action'); $newemail = param('newemail'); ############################################################### ### Print Header ############################################################### %site_info = get_site_info($org_id); $site_info{"site_banner_image"} =~ s/\/home\/homete3\/public_html//; $site_info{"site_logo"} =~ s/\/home\/homete3\/public_html//; print header(); print_start_header_main(); print_style2(); ############################################################### ### Print Body of HTML doc ############################################################### print <<__HTML__; __HTML__ $active_id{"login"} = ""; $active_id{"create"} = ""; $active_id{"register"} = ""; $active_id{"verify"} = ""; $active_id{"pay"} = ""; #ADDED this portion to show logout feature. my $email = param('email'); my $pw = param('pw'); if(!(defined($email))){ $email = ""; $pw = ""; } my $login, $failed_login, $admin = print_reg_admin2($email, $pw, $org_id, "NA", "NA", "NA"); #my $session_id = check_reg_login($email, "$pw"); #print "SESSION ID: $session_id
\n"; #print_top($session_id); #print_right_border($org_id); #print_menu($org_id); #print_reg_info(); #print_reg_admin($session_id); print " \n"; print <<__HTML__; __HTML__ print "\n"; } ################################################################ ### Check to see if the user is logged in ################################################################ sub check_valid_user_reg_admin{ my $user = shift; my $pass = shift; my $org_id = shift; my $league_id = shift; my $info_id = shift; my $page = shift; my $success = 0; my $login_success = 0; my $session_id = get_cookie(); my $return_hash; $return_hash{"LOGIN_SUCCESS"} = 0; my $dbh = get_dbh(); #print "\n"; ################################################################ # Check to see if there is a valid cookie ################################################################ if($session_id eq ""){ #print "\n"; #print "\n"; ################################################################ # If not a valid cookie, check the to see if the user/pass # combination is correct ################################################################ if(($user ne "") && ($pass ne "")){ $query = "SELECT * FROM `Account_Info` WHERE (`Login` = '$user' OR `email` = '$user') AND `Password` = '$pass'"; #print "\n"; $sth = $dbh->prepare($query); $sth->execute(); $sth->bind_columns(\$Key, \$Login, \$Password, \$email, \$League_ID, \$Last_Access, \$Last_Access_ID, \$Firstname, \$Lastname, \$Title, \$Home_Phone, \$Work_Phone, \$Zip_Code); ################################################################ # Loop through what the db returned, if there is somthing there # it assumes success. It also checks to see that they are # logging into the correct league. # League 0 is all leagues. ################################################################ while($sth->fetch()) { $return_hash{"LOGIN_SUCCESS"} = 1; $return_hash{"EMAIL"} = $email; $return_hash{"LOGIN_ID"} = $Key; $return_hash{"LOGIN"} = $Login; $return_hash{"FIRSTNAME"} = $Firstname; $return_hash{"LASTNAME"} = $Lastname; $return_hash{"TITLE"} = $Title; $return_hash{"HOMEPHONE"} = $Home_Phone; $return_hash{"WORKPHONE"} = $Work_Phone; $return_hash{"ZIPCODE"} = $Zip_Code; $test_hash{"ONE"} = 1; } ################################################################ # Login failed because incorrect Login or password ################################################################ if($return_hash{"LOGIN_SUCCESS"} == 0){ $return_hash{"LOGIN_SUCCESS"} = -1; $session_id = ""; #print "\n"; }else{ $current_date = get_date_time(); $session_id = generate_random_string(15); $update = "UPDATE `Account_Info` SET `Last_Access`='$current_date', `Last_Access_ID`='$session_id' WHERE `Key` = $Key;"; ##print "QUERY: $update
\n"; $sth = $dbh->prepare($update); $sth->execute(); print <<__HTML__; __HTML__ } }else{ ################################################################ # Login failed because no Login or password # Could be first time loggin in. ################################################################ $session_id = ""; } }else{ #print "\n"; ################################################################ # Query DB to verify Session ################################################################ $query = "SELECT * FROM `Account_Info` WHERE `Last_Access_ID` = '$session_id'"; $sth = $dbh->prepare($query); $sth->execute(); $sth->bind_columns(\$Key, \$Login, \$Password, \$email, \$League_ID, \$Last_Access, \$Last_Access_ID, \$Firstname, \$Lastname, \$Title, \$Home_Phone, \$Work_Phone, \$Zip_Code); ################################################################ # Loop through what the db returned, if there is somthing there # it assumes success. It also checks to see that they are # logging into the correct league. # League 0 is all leagues. ################################################################ while($sth->fetch()) { $return_hash{"LOGIN_SUCCESS"} = 1; $return_hash{"EMAIL"} = $email; $return_hash{"LOGIN_ID"} = $Key; $return_hash{"FIRSTNAME"} = $Firstname; $return_hash{"LASTNAME"} = $Lastname; $return_hash{"TITLE"} = $Title; $return_hash{"HOMEPHONE"} = $Home_Phone; $return_hash{"WORKPHONE"} = $Work_Phone; $return_hash{"ZIPCODE"} = $Zip_Code; } #print "\n"; ################################################################ # If we get to this point. The cookie is invalid at least for # this league. ################################################################ if($return_hash{"LOGIN_SUCCESS"} == 0){ #print "

Your Session has expired,
Please login again.
\n"; print "\n"; $session_id = ""; }else{ ################################################################ # Update DB to keep session active ################################################################ $current_date = get_date_time(); $update = "UPDATE `Account_Info` SET `Last_Access`='$current_date' WHERE `Key` = $Key;"; ##print "QUERY: $update
\n"; $sth = $dbh->prepare($update); $sth->execute(); ################################################################ # Update Cookie to keep session active ################################################################ print <<__HTML__; __HTML__ } } ################################################################ # Close DB connection ################################################################ $sth->finish(); # disconnect from database $dbh->disconnect; #print "\n"; # foreach $key (keys %return_hash){ # print "\n"; # } $return_hash{"SESSION_ID"} = $session_id; # $return_hash{"TEST"} = "TEST"; return %return_hash; } sub print_reg_admin2{ my $user = shift; my $pass = shift; my $org_id = shift; my $league_id = shift; my $info_id = shift; my $page = shift; my $access_level = 0; my $admin = 1; my $login = 1; my $failed_login = 0; %valid_user = check_valid_user_reg_admin($user,$pass,$org_id,$league_id,$info_id,$page); if($valid_user{"LOGIN_SUCCESS"} == 1){ ################################## # Check valid user access ################################## $access_level = check_permissions($valid_user{"LOGIN_ID"}, $org_id, $league_id, $info_id, $page); $login = 0; ################################## # if they are trying for a coach # or admin page, check verify permssions. ################################## #print "\n"; if($admin == 1){ if(!($access_level >=3)){ #print "\n"; $admin = 0; } } }elsif($valid_user{"LOGIN_SUCCESS"} == -1){ $failed_login = 1; $login = 1; }else{ ################################## # if not valid user (ie. not logged in) # check if it was attempting a admin # or coach ################################## if(($coach == 1)||($admin == 1)){ #print "\n"; #$coach = 0; #$admin = 0; $login = 1; } } if($admin == 1){$session_id = "1234";}else{$session_id = "";} #admin = 1 prints logout, admin != 1 prints log in. if($access_level >=3){ print_top_admin($session_id); }else{ print_top_admin(""); } if($action eq "adminlogin"){ ##### Log in to verify USER Account information if($failed_login == 1){ print "\n"; print_admin_login("Your username or password was incorrect."); }elsif($admin == 0){ print "\n"; print_admin_login("You do not have access to this page."); }else{ #print_show_reg($org_id); print_show_reg_user_in_line($org_id); } }elsif($action eq "logout"){ print "\n"; print_admin_login("You have successfully logged out."); }elsif($action eq "admin_create_account"){ if($failed_login == 1){ print "\n"; print_admin_login(""); }elsif($admin == 0){ print "\n"; print_admin_login(""); }elsif($login == 1){ print "\n"; print_admin_login(""); }else{ if(check_for_account($newemail)== 0){ ##### Verify Email Account admin_print_create_account(); }else{ admin_print_create_user(); } } }elsif($action eq "admin_createaccount"){ ##### Create New USER Account, Get information to create new PLAYER Account if($failed_login == 1){ print "\n"; print_admin_login(""); }elsif($admin == 0){ print "\n"; print_admin_login(""); }elsif($login == 1){ print "\n"; print_admin_login(""); }else{ $user_email = get_param(user_email); if(check_for_account($user_email)== 0){ ##### Verify Email Account $user_key = admin_createaccount(); } admin_print_verify_account_info($user_email); #print_register_programs($user_key); } }elsif($action eq "admin_modify"){ ##### Get Information to Update USER Account if($failed_login == 1){ print "\n"; print_admin_login(""); }elsif($admin == 0){ print "\n"; print_admin_login(""); }elsif($login == 1){ print "\n"; print_admin_login(""); }else{ $user_email = param('user_email'); admin_print_update_account($user_email); } }elsif($action eq "admin_modifyaccount"){ ##### Modify USER Account, Verify Information if($failed_login == 1){ print "\n"; print_admin_login(""); }elsif($admin == 0){ print "\n"; print_admin_login(""); }elsif($login == 1){ print "\n"; print_admin_login(""); }else{ $email = admin_update_account(); admin_print_verify_account_info($email); } }elsif($action eq "admin_register"){ ##### After a USER logs in, Get information to create new PLAYER Account if($failed_login == 1){ print "FAILED\n"; print_admin_login(""); }elsif($admin == 0){ print "ADMIN 0 \n"; print_admin_login(""); }elsif($login == 1){ print "LOGIN 1\n"; print_admin_login(""); }else{ my $user_key = param('userkey'); if((!(defined($user_key))) || ($user_key eq "")){ $email = param('user_email'); my %user_info = get_account_info_by_email($email); $user_key = $user_info{"KEY"}; } admin_print_register_programs($user_key); } }elsif($action eq "admin_pay_by_check"){ if($failed_login == 1){ print "\n"; print_admin_login(""); }elsif($admin == 0){ print "\n"; print_admin_login(""); }elsif($login == 1){ print "\n"; print_admin_login(""); }else{ admin_print_pay_by_check(); } }elsif($action eq "admin_pay_by_check_complete"){ if($failed_login == 1){ print "\n"; print_admin_login(""); }elsif($admin == 0){ print "\n"; print_admin_login(""); }elsif($login == 1){ print "\n"; print_admin_login(""); }else{ admin_print_pay_partial_complete(); } }elsif($action eq "admin_account"){ if($failed_login == 1){ print "\n"; print_admin_login(""); }elsif($admin == 0){ print "\n"; print_admin_login(""); }elsif($login == 1){ print "\n"; print_admin_login(""); }else{ #print_show_reg($org_id); admin_print_create_user(); #print_show_reg_user_in_line($org_id); } }elsif($action eq "admin_createaplayerccount"){ ##### Create PLAYER account, Verify Information if($failed_login == 1){ print "\n"; print_admin_login(""); }elsif($admin == 0){ print "\n"; print_admin_login(""); }elsif($login == 1){ print "\n"; print_admin_login(""); }else{ my $new_player_id = create_new_player(); admin_print_verify_register_programs($new_player_id); } }elsif($action eq "admin_modify_player"){ #### Get Information to Modify PLAYER if($failed_login == 1){ print "\n"; print_admin_login(""); }elsif($admin == 0){ print "\n"; print_admin_login(""); }elsif($login == 1){ print "\n"; print_admin_login(""); }else{ admin_print_modify_player(); } }elsif($action eq "admin_updateplayerccount"){ ###### Modify PLAYER Account, Verify Information if($failed_login == 1){ print "\n"; print_admin_login(""); }elsif($admin == 0){ print "\n"; print_admin_login(""); }elsif($login == 1){ print "\n"; print_admin_login(""); }else{ my $player_id = update_player(); admin_print_verify_register_programs($player_id); } }elsif($action eq "admin_partial"){ if($failed_login == 1){ print "\n"; print_admin_login(""); }elsif($admin == 0){ print "\n"; print_admin_login(""); }elsif($login == 1){ print "\n"; print_admin_login(""); }else{ admin_print_pay_partial(); } }elsif($action eq "admin_pay"){ if($failed_login == 1){ print "\n"; print_admin_login(""); }elsif($admin == 0){ print "\n"; print_admin_login(""); }elsif($login == 1){ print "\n"; print_admin_login(""); }else{ admin_print_pay(); } }elsif($action eq "admin_verify_partial"){ if($failed_login == 1){ print "\n"; print_admin_login(""); }elsif($admin == 0){ print "\n"; print_admin_login(""); }elsif($login == 1){ print "\n"; print_admin_login(""); }else{ admin_print_verify_pay_partial(); } }elsif($action eq "admin_remove_player"){ if($failed_login == 1){ print "\n"; print_admin_login(""); }elsif($admin == 0){ print "\n"; print_admin_login(""); }elsif($login == 1){ print "\n"; print_admin_login(""); }else{ my $user_key = param('userkey'); my $player_key = param('playerkey'); remove_player($player_key); admin_print_register_programs($user_key); } }else{ if($failed_login == 1){ print "\n"; print_admin_login("Your username or password was incorrect. $access_level"); }elsif($admin == 0){ print "\n"; print_admin_login("You do not have access to this page. $access_level"); }elsif($login == 1){ print "\n"; print_admin_login(""); }else{ #print_show_reg($org_id); #print_show_reg_user_in_line($org_id); print_admin_home(); } } return $login, $failed_login, $admin; } ################################################################ ### Prints the top title bar ################################################################ sub print_top_admin{ $session_id = shift; if($session_id ne ""){ $access_level =1; } print <<__HTML__;
__HTML__ print "
\n"; if($access_level == 1){ #print "Welcome, $valid_user{\"FIRSTNAME\"}\n"; ################################# ## If Admin ################################# if($access_level >= 3){ print "   Control Panel\n"; } if($access_level >= 1){ #print "   My Hometeamz\n"; #print "   Create Account"; print "   Registration Menu"; print "   Logout"; } }else{ #print "Login"; } print <<__HTML__;
 

$site_info{"site_banner_text"}


__HTML__ } sub get_transactions{ my $transaction_id = shift; my %return_hash = (); my $dbh = get_dbh(); ################################################################ # Query DB for tranasctions ################################################################ my $query = "SELECT `Key`, `Player_ID`, `Amount`, `Processed` FROM `TMP_PAYPAL` WHERE `Transaction_ID` = '$transaction_id'"; #my $query = "SELECT `Key`, `Player_ID`, `Amount` FROM `TMP_PAYPAL` WHERE `Transaction_ID` = '$transaction_id' AND `Processed` = '1'"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Key, \$Player_ID, \$Amount, \$Processed); while($sth->fetch()) { $return_hash{$Player_ID}{"AMOUNT"} = $Amount; $return_hash{$Player_ID}{"PROCESSED"} = $Processed; } $sth->finish(); $dbh->disconnect; return %return_hash; } sub print_show_purchase_invalid{ #my $transaction_id = shift; #my %transactions = get_transactions($transaction_id); #my %users = get_users_by_org($org_id); #my %user_info = get_account_info($user_key); #my %player_info = get_player_info($user_key); #my %mod_player_info = get_player_info_by_key($player_key); #my %division_selected = get_division_data(); #print "

\n"; $html = "
"; $html .= "
Invalid Transaction
You have tried to view a transaction you do not have permissions for or have been logged out of your account.
Click HERE to return to the registration page.

\n"; $html .= "
\n"; print $html; } sub admin_print_pay_partial_complete{ #print "

\n"; $active_id{"complete"} = "id=current"; print_steps(); $html = "
"; $html .= "
Step 6 : Order Complete
Thank-you for registering for the Lakes Youth Athletic Association 2008 Season.\n

Your order is complete. If you require any assistance with the online registration process, or have any general questions regarding LYAA registration, please contact the board by emailing board\@lyaa.org, or leaving a message at (847) 604-0270.


\n"; $html .= "\n"; $html .= "
\n"; print $html; } sub print_pay_partial_complete{ #print "

\n"; $active_id{"complete"} = "id=current"; print_steps(); $html = "
"; $html .= "
Step 6 : Order Complete
Thank-you for registering for the Lakes Youth Athletic Association 2008 Season.\n

Your order is complete. If you require any assistance with the online registration process, or have any general questions regarding LYAA registration, please contact the board by emailing board\@lyaa.org, or leaving a message at (847) 604-0270.


\n"; $html .= "\n"; $html .= "
\n"; print $html; } sub print_show_purchase{ my $transaction_id = shift; my %transactions = get_transactions($transaction_id); #my %users = get_users_by_org($org_id); #my %user_info = get_account_info($user_key); #my %player_info = get_player_info($user_key); #my %mod_player_info = get_player_info_by_key($player_key); #my %division_selected = get_division_data(); #print "

\n"; $html = "
"; $html .= "
Step 6: Order Complete

\n"; $html .= "\n"; $user_header = "date_header"; $player_header1 = "cal_events3"; $player_header2 = "cal_events2"; $currnet_header = 2; $html .= " \n"; my $total = 0; my $count = 0; foreach my $player_key (keys %transactions) { $count++; my %player_info = get_player_info_by_key($player_key); if($player_header eq $player_header1){ $player_header = $player_header2; }else{ $player_header = $player_header1; } if($transactions{"$player_key"}{"PROCESSED"} == 1){ $processed = "Complete"; }else{ $processed = "Pending"; } $html .= " \n"; $total = $total + $transactions{"$player_key"}{"AMOUNT"}; } if($count == 0){ $html .= " \n"; } $html .= " \n"; $html .= "
Receipt #$transaction_id
$player_info{\"LASTNAME\"}, $player_info{\"FIRSTNAME\"}\$$transactions{\"$player_key\"}{\"AMOUNT\"}$processed
No Transaction Found
Total \$$total 

\n"; $html .= "

\n"; #
Click HERE to return to the registration page.
print $html; } sub print_thanks{ $transaction_id = shift; print_show_purchase($transaction_id); #if($action eq "thankslogin"){ ##### Log in to verify USER Account information # $email = param('email'); # $pw = param('pw'); # $session_id = check_reg_login($email, "$pw"); # if($session_id eq ""){ # print_admin_login("Your username or password was incorrect."); # }else{ # print_show_reg($org_id); # } #}else{ # print_admin_login(); #} print "
\n"; print <<__HTML__; __HTML__ print "\n"; } sub print_reg_admin{ $session_id = shift; if($action eq "adminlogin"){ ##### Log in to verify USER Account information if($session_id eq ""){ print_admin_login("Your username or password was incorrect."); }else{ #print_show_reg($org_id); print_show_reg_user_in_line($org_id); } }else{ if($session_id eq ""){ print_admin_login(); }else{ print_show_reg_user_in_line($org_id); } } print "
\n"; print <<__HTML__; __HTML__ print "\n"; } sub get_player_header4{ $player_header3 = "cal_events_head"; my $player_header .= "Player Last Name \n"; $player_header .= "Player First Name \n"; $player_header .= "Amount \n"; $player_header .= "Pay Pal ID \n"; $player_header .= "Date \n"; return $player_header; } sub get_player_header5{ $player_header3 = "cal_events_head"; my $player_header .= "Player Last Name \n"; $player_header .= "Player First Name \n"; $player_header .= "Amount \n"; $player_header .= "Notes / PayPal_ID / Check# \n"; $player_header .= "Date\n"; $player_header .= "Changed By \n"; return $player_header; } sub get_player_header6{ $player_header3 = "cal_events_head"; my $player_header .= "Player Last Name \n"; $player_header .= "Player First Name \n"; $player_header .= "Amount \n"; $player_header .= "Notes \n"; $player_header .= "Date\n"; $player_header .= "Changed By \n"; return $player_header; } sub get_player_header3{ $player_header3 = "cal_events_head"; my $player_header .= "Player Last Name \n"; $player_header .= "Player First Name \n"; $player_header .= "Total \n"; $player_header .= "Paid \n"; $player_header .= "Due \n"; return $player_header; } sub get_player_header7{ $player_header3 = "cal_events_head"; my $player_header .= "Player Last Name \n"; $player_header .= "Player First Name \n"; $player_header .= "Base \n"; $player_header .= "Adjustment \n"; $player_header .= "Paid \n"; $player_header .= "Due \n"; return $player_header; } sub get_player_header8_tab{ my $player_header .= '"Player Last Name"' . "\t"; $player_header .= '"Player First Name"' . "\t"; $player_header .= '"Registration Date"' . "\t"; $player_header .= '"Player DOB"' . "\t"; $player_header .= '"Player Gender"' . "\t"; $player_header .= '"Player School_Name"' . "\t"; $player_header .= '"Player Grade"' . "\t"; $player_header .= '"Emergency Contact Name"' . "\t"; $player_header .= '"Emergency Contact Phone1"' . "\t"; $player_header .= '"Emergency Contact Phone2"' . "\t"; $player_header .= '"Emergency Contact Relationship"' . "\t"; $player_header .= '"Guardian1 Contact Phone1"' . "\t"; $player_header .= '"Guardian1 Contact Phone2"' . "\t"; $player_header .= '"Guardian1 Name"' . "\t"; $player_header .= '"Guardian1 Relationship"' . "\t"; $player_header .= '"Guardian2 Contact Phone1"' . "\t"; $player_header .= '"Guardian2 Contact Phone2"' . "\t"; $player_header .= '"Guardian2 Name"' . "\t"; $player_header .= '"Guardian2 Relationship"' . "\t"; $player_header .= '"Preferred Doc Name"' . "\t"; $player_header .= '"Preferred Doc Number"' . "\t"; $player_header .= '"Preferred Dentist Name"' . "\t"; $player_header .= '"Preferred Dentist Number"' . "\t"; $player_header .= '"Preferred Hospital"' . "\t"; $player_header .= '"Insurance Carrier"' . "\t"; $player_header .= '"Policy Number"' . "\t"; $player_header .= '"Medical History"' . "\t"; $player_header .= '"Returning Player"' . "\t"; $player_header .= '"Paid"' . "\t"; $player_header .= '"Fee"' . "\t"; $player_header .= '"Fundraiser"' . "\t"; $player_header .= '"Adjustment"' . "\t"; $player_header .= '"Late Fee"' . "\t"; $player_header .= '"Payment Information"' . "\t"; $player_header .= '"Medical Consent Choice"' . "\t"; $player_header .= '"Medical Consent Notes"' . "\t"; $player_header .= '"Play Up"' . "\t"; $player_header .= '"Account First Name"' . "\t"; $player_header .= '"Account Last Name"' . "\t"; $player_header .= '"Account Email"' . "\t"; $player_header .= '"Account Address1"' . "\t"; $player_header .= '"Account Address2"' . "\t"; $player_header .= '"Account City"' . "\t"; $player_header .= '"Account State"' . "\t"; $player_header .= '"Account Zip"' . "\t"; $player_header .= '"Account Phone"' . "\t"; $player_header .= '"Account Mphone"'; return $player_header; } sub get_player_header8_csv{ my $player_header .= '"Player Last Name",'; $player_header .= '"Player First Name",'; $player_header .= '"Registration Date",'; $player_header .= '"Player DOB",'; $player_header .= '"Player Gender",'; $player_header .= '"Player School_Name",'; $player_header .= '"Player Grade",'; $player_header .= '"Emergency Contact Name",'; $player_header .= '"Emergency Contact Phone1",'; $player_header .= '"Emergency Contact Phone2",'; $player_header .= '"Emergency Contact Relationship",'; $player_header .= '"Guardian1 Contact Phone1",'; $player_header .= '"Guardian1 Contact Phone2",'; $player_header .= '"Guardian1 Name",'; $player_header .= '"Guardian1 Relationship",'; $player_header .= '"Guardian2 Contact Phone1",'; $player_header .= '"Guardian2 Contact Phone2",'; $player_header .= '"Guardian2 Name",'; $player_header .= '"Guardian2 Relationship",'; $player_header .= '"Preferred Doc Name",'; $player_header .= '"Preferred Doc Number",'; $player_header .= '"Preferred Dentist Name",'; $player_header .= '"Preferred Dentist Number",'; $player_header .= '"Preferred Hospital",'; $player_header .= '"Insurance Carrier",'; $player_header .= '"Policy Number",'; $player_header .= '"Medical History",'; $player_header .= '"Returning Player",'; $player_header .= '"Paid",'; $player_header .= '"Fee",'; $player_header .= '"Fundraiser",'; $player_header .= '"Adjustment",'; $player_header .= '"Late Fee",'; $player_header .= '"Payment Information",'; $player_header .= '"Medical Consent Choice",'; $player_header .= '"Medical Consent Notes",'; $player_header .= '"Play Up",'; $player_header .= '"Account First Name",'; $player_header .= '"Account Last Name",'; $player_header .= '"Account Email",'; $player_header .= '"Account Address1",'; $player_header .= '"Account Address2",'; $player_header .= '"Account City",'; $player_header .= '"Account State",'; $player_header .= '"Account Zip",'; $player_header .= '"Account Phone",'; $player_header .= '"Account Mphone",'; return $player_header; } sub get_player_header2{ $player_header3 = "cal_events_head"; my $player_header = "Edit Player \n"; $player_header .= "Player Last Name \n"; $player_header .= "Player First Name \n"; $player_header .= "Registration Date \n"; $player_header .= "Total \n"; $player_header .= "Adjustment \n"; $player_header .= "Paid \n"; $player_header .= "Due \n"; $player_header .= "Gender \n"; $player_header .= "DOB
Player \n"; $player_header .= "Grade \n"; $player_header .= "School \n"; $player_header .= "Returning
Player \n"; $player_header .= "Play Up? \n"; $player_header .= "Account
Last Name \n"; $player_header .= "Account
First Name \n"; $player_header .= "Account
Phone \n"; $player_header .= "Account
Email \n"; return $player_header; } sub get_player_header{ $player_header3 = "cal_events_head"; my $player_header = "NamePaid \n"; $player_header .= "Division \n"; $player_header .= "DOB \n"; $player_header .= "Gender \n"; $player_header .= "School \n"; $player_header .= "Grade \n"; $player_header .= "Returning
Player \n"; $player_header .= "Play
Up \n"; $player_header .= "Emergency Contact \n"; $player_header .= "Emergency Phone \n"; $player_header .= "Emergency Secondary Phone \n"; $player_header .= "Hat Size \n"; $player_header .= "Hat Size \n"; return $player_header; } ####################################### # This one shows the user in line with the player ####################################### sub print_show_reg_user_in_line{ my %users = get_users_by_org($org_id); #my %user_info = get_account_info($user_key); #my %player_info = get_player_info($user_key); #my %mod_player_info = get_player_info_by_key($player_key); #my %division_selected = get_division_data(); my $reg_report = "$teamdata/$org_id/regusers.csv"; print <<__HTML__; __HTML__ print "
\n"; my $player_header_info = get_player_header2(); my $player_header_info_csv = get_player_header8_csv(); #$table_header = "\n"; #$table_header = "
\n"; $table_header = "
NEW Player ReportExport to Excel
\n"; $user_header = "date_header"; $player_header3 = "player_header"; $player_header1 = "cal_events3"; $player_header2 = "cal_events2"; $currnet_header = 2; $full_user_info = ""; %player_info = (); foreach my $user_key (keys %users) { $html_user = "\n"; $html_user .= " \n"; my %tmp_player_info = get_player_info2($user_key); $paid = 0; $html = ""; my $num_players = 0; foreach my $player_key (sort {$a <=> $b}(keys %tmp_player_info)) { $player_info{$player_key}{"ULASTNAME"} = $users{$user_key}{"LASTNAME"}; $player_info{$player_key}{"UFIRSTNAME"} = $users{$user_key}{"FIRSTNAME"}; $player_info{$player_key}{"UHOMEPHONE"} = $users{$user_key}{"HOMEPHONE"}; $player_info{$player_key}{"UEMAIL"} = $users{$user_key}{"EMAIL"}; $player_info{$player_key}{"UWORK_PHONE"} = $users{$user_key}{"WORK_PHONE"}; $player_info{$player_key}{"UMOBILE_PHONE"} = $users{$user_key}{"MOBILE_PHONE"}; $player_info{$player_key}{"UZIP_CODE"} = $users{$user_key}{"ZIP_CODE"}; $player_info{$player_key}{"UADDRESS1"} = $users{$user_key}{"ADDRESS1"}; $player_info{$player_key}{"UADDRESS2"} = $users{$user_key}{"ADDRESS2"}; $player_info{$player_key}{"UCITY"} = $users{$user_key}{"CITY"}; $player_info{$player_key}{"USTATE"} = $users{$user_key}{"STATE"}; ##########################################################3 # Calculate amount total, paid and due ########################################################### $num_players++; my $base_cost = is_older_than_cutoff($tmp_player_info{$player_key}{"DOB"},$tmp_player_info{$player_key}{"GENDER"}); $amount_paid = $tmp_player_info{$player_key}{"PAID"}; if($num_players > 2){$fundraiser_fee = 0; $fundraiser_string = "";}else{$fundraiser_fee = 30; $fundraiser_string = "+ \$30 Fundraiser";} if($num_players > 1){$discount = 15; $discount_string = "-\$15 multiplayer discount";}else{$discount = 0;$discount_string = "";} $player_total = $base_cost + $fundraiser_fee - $discount; $player_total_csv = $base_cost - $discount; # Removed Fundraiser from total $tmp_player_info{$player_key}{"ADJUSTMENT"} = get_player_adjustment($player_key); $amount_due_csv = $player_total - $amount_paid + $tmp_player_info{$player_key}{"ADJUSTMENT"}; my ($tmp_pay_pal_info, $paypal_player_amount) = get_paypal_info_for_csv($tmp_player_info{$player_key}{"LASTNAME"}, $tmp_player_info{$player_key}{"FIRSTNAME"}, $player_key); my ($tmp_transaction_info, $tx_player_amount) = get_transaction_info_for_csv($tmp_player_info{$player_key}{"LASTNAME"}, $tmp_player_info{$player_key}{"FIRSTNAME"}, $player_key); my %player_adjustments = get_player_adjustment2($player_key); $tmp_player_info{$player_key}{"PAY_INFO"} = $tmp_pay_pal_info . $tmp_transaction_info; #$tmp_player_info{$player_key}{"ADJUSTMENT"} = $player_adjustments{"OTHER"}; $tmp_player_info{$player_key}{"LATE_FEE"} = $player_adjustments{"WALK_IN"}; $tmp_player_info{$player_key}{"FUNDRAISER"} = $fundraiser_fee; my $total_adjustment = $player_adjustments{"OTHER"} + $player_adjustments{"WALK_IN"}; $player_total_csv = $player_total + $player_adjustments{"OTHER"}; #$tmp_player_info{$player_key}{"ADJUSTMENT"} = get_player_adjustment2($player_key); $amount_due = $player_total - $amount_paid + $total_adjustment; $tmp_player_info{$player_key}{"TOTAL_DUE"} = $player_total; $tmp_player_info{$player_key}{"TOTAL_DUE_CSV"} = $player_total_csv; $tmp_player_info{$player_key}{"AMOUNT_DUE"} = $amount_due; foreach my $player_field (keys %{$tmp_player_info{$player_key}}){ $player_info{$player_key}{"$player_field"} = $tmp_player_info{$player_key}{$player_field}; } } } foreach my $player_key (sort {lc($player_info{$a}{"LASTNAME"}) cmp lc($player_info{$b}{"LASTNAME"})} (keys %player_info)) { my @field_list = ("LASTNAME", "FIRSTNAME","HAT_SIZE", "TOTAL_DUE", "ADJUSTMENT", "PAID", "AMOUNT_DUE" ,"GENDER","DOB","GRADE","SNAME","RETURNING","PLAY_UP","ULASTNAME","UFIRSTNAME","UHOMEPHONE","UEMAIL"); if($player_header eq $player_header1){ $player_header = $player_header2; }else{ $player_header = $player_header1; } $paid = $paid + $player_info{$player_key}{"PAID"}; $player_info = " \n"; $player_info_csv = ""; foreach(@field_list){ #$player_info_csv .= process_for_csv($player_info{$player_key}{$_}); if($_ eq "PAID"){ $player_info .= " \n"; }elsif($_ eq "ADJUSTMENT"){ $player_info .= " \n"; }elsif($_ eq "HAT_SIZE"){ $display_date = convert_date_no_time_to_display($player_info{$player_key}{$_}); $player_info .= "\n"; }else{ $player_info .= "\n"; } } my @csv_field_list = ("LASTNAME", "FIRSTNAME", "HAT_SIZE", "DOB", "GENDER", "SNAME", "GRADE", "E_CONTACT_NAME", "E_CONTACT_PHONE", "E_CONTACT_SPHONE", "E_CONTACT_REL", "G_CONTACT_PHONE", "G_CONTACT_SPHONE", "G_CONTACT_NAME", "G_CONTACT_REL", "OG_CONTACT_PHONE", "OG_CONTACT_SPHONE", "OG_CONTACT_NAME", "OG_CONTACT_REL", "PREF_DOC_NAME", "PREF_DOC_NUMB", "PREF_DENT_NAME", "PREF_DENT_NUMB", "PREF_HOSPITAL", "INSURANCE", "POLICY", "MEDICAL", "RETURNING", "PAID", "TOTAL_DUE_CSV", "FUNDRAISER", "ADJUSTMENT", "LATE_FEE", "PAY_INFO", "CONSENT", "ACTIONSTO", "PLAY_UP", "ULASTNAME", "UFIRSTNAME", "UEMAIL", "UADDRESS1", "UADDRESS2", "UCITY", "USTATE", "UZIP_CODE", "UHOMEPHONE", "UMOBILE_PHONE"); foreach(@csv_field_list){ $player_info_csv .= process_for_csv($player_info{$player_key}{$_}); } $player_info .= ""; $full_user_info .= $player_info; $player_info_csv .= "\n"; $full_user_csv_info .= $player_info_csv; } $full_user_info .= "
$users{$user_key}{\"LASTNAME\"}, $users{$user_key}{\"FIRSTNAME\"}$users{$user_key}{\"HOMEPHONE\"}
edit$player_info{$player_key}{$_}$player_info{$player_key}{$_}$display_date $player_info{$player_key}{$_}
\n"; print $table_header . $player_header_info . $full_user_info . "

 "; if(-e $reg_report){ `rm $reg_report`;} open(OUT, ">$reg_report") || die "ERROR: Could not create regusers. $!
"; print OUT $player_header_info_csv . "\n" . $full_user_csv_info; #print "$teamdata" . $player_header_info_csv . "\n" . $full_user_csv_info; close(OUT); } sub process_for_csv{ my $input_string = shift; $input_string =~ s/\"/\"\"/g; #$input_string = '"' . $input_string . '",'; $input_string = '"' . $input_string . '"' . "\t"; $input_string .= s/\r//g; return $input_string; } sub get_paypal_info_for_csv{ my $last_name = shift; my $first_name = shift; my $player_key = shift; my $return_string = ""; my $amount = 0; $player_header1 = "cal_events3"; $player_header2 = "cal_events2"; $user_header = "date_header"; my $dbh = get_dbh(); ################################################################ # Query DB to verify Session ################################################################ my $query = "SELECT `Amount`, `PP_Transaction_ID`, `Date` FROM `TMP_PAYPAL` WHERE `Player_ID` = '$player_key' AND `Processed` = '1';"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Amount, \$PP_Transaction_ID, \$Date); while($sth->fetch()) { #$return_string .= "$last_name$first_name$Amount$PP_Transaction_ID$DatePayPal"; $return_string .= "PayPal | $first_name $last_name | $Amount | $PP_Transaction_ID | $Date\n"; $return_amount = $return_amount + $amount; } # disconnect from database $sth->finish(); $dbh->disconnect; #print "RP: $return_password
\n"; return $return_string, $amount; } ####################################### # This one shows the user in line with the player ####################################### sub print_show_reg_csv{ my %users = get_users_by_org($org_id); #my %user_info = get_account_info($user_key); #my %player_info = get_player_info($user_key); #my %mod_player_info = get_player_info_by_key($player_key); #my %division_selected = get_division_data(); my $reg_report = "$teamdata/$org_id/regusers.csv"; my $player_header_info = get_player_header2(); my $player_header_info_csv = get_player_header8_tab(); #$table_header = "\n"; #$table_header = "
\n"; $table_header = "
Export to Excel2Export to Excel
\n"; $user_header = "date_header"; $player_header3 = "player_header"; $player_header1 = "cal_events3"; $player_header2 = "cal_events2"; $currnet_header = 2; $full_user_info = ""; %player_info = (); foreach my $user_key (keys %users) { $html_user = "\n"; $html_user .= " \n"; my %tmp_player_info = get_player_info2($user_key); $paid = 0; $html = ""; my $num_players = 0; foreach my $player_key (sort {$a <=> $b}(keys %tmp_player_info)) { $player_info{$player_key}{"ULASTNAME"} = $users{$user_key}{"LASTNAME"}; $player_info{$player_key}{"UFIRSTNAME"} = $users{$user_key}{"FIRSTNAME"}; $player_info{$player_key}{"UHOMEPHONE"} = $users{$user_key}{"HOMEPHONE"}; $player_info{$player_key}{"UEMAIL"} = $users{$user_key}{"EMAIL"}; $player_info{$player_key}{"UWORK_PHONE"} = $users{$user_key}{"WORK_PHONE"}; $player_info{$player_key}{"UMOBILE_PHONE"} = $users{$user_key}{"MOBILE_PHONE"}; $player_info{$player_key}{"UZIP_CODE"} = $users{$user_key}{"ZIP_CODE"}; $player_info{$player_key}{"UADDRESS1"} = $users{$user_key}{"ADDRESS1"}; $player_info{$player_key}{"UADDRESS2"} = $users{$user_key}{"ADDRESS2"}; $player_info{$player_key}{"UCITY"} = $users{$user_key}{"CITY"}; $player_info{$player_key}{"USTATE"} = $users{$user_key}{"STATE"}; ##########################################################3 # Calculate amount total, paid and due ########################################################### $num_players++; my $base_cost = is_older_than_cutoff($tmp_player_info{$player_key}{"DOB"},$tmp_player_info{$player_key}{"GENDER"}); $amount_paid = $tmp_player_info{$player_key}{"PAID"}; if($num_players > 2){$fundraiser_fee = 0; $fundraiser_string = "";}else{$fundraiser_fee = 30; $fundraiser_string = "+ \$30 Fundraiser";} if($num_players > 1){$discount = 15; $discount_string = "-\$15 multiplayer discount";}else{$discount = 0;$discount_string = "";} $player_total = $base_cost + $fundraiser_fee - $discount; $player_total_csv = $base_cost - $discount; # Removed Fundraiser from total $tmp_player_info{$player_key}{"ADJUSTMENT"} = get_player_adjustment($player_key); $amount_due_csv = $player_total - $amount_paid + $tmp_player_info{$player_key}{"ADJUSTMENT"}; my ($tmp_pay_pal_info, $paypal_player_amount) = get_paypal_info_for_csv($tmp_player_info{$player_key}{"LASTNAME"}, $tmp_player_info{$player_key}{"FIRSTNAME"}, $player_key); my ($tmp_transaction_info, $tx_player_amount) = get_transaction_info_for_csv($tmp_player_info{$player_key}{"LASTNAME"}, $tmp_player_info{$player_key}{"FIRSTNAME"}, $player_key); my %player_adjustments = get_player_adjustment2($player_key); $tmp_player_info{$player_key}{"PAY_INFO"} = $tmp_pay_pal_info . $tmp_transaction_info; #$tmp_player_info{$player_key}{"ADJUSTMENT"} = $player_adjustments{"OTHER"}; $tmp_player_info{$player_key}{"LATE_FEE"} = $player_adjustments{"WALK_IN"}; $tmp_player_info{$player_key}{"FUNDRAISER"} = $fundraiser_fee; my $total_adjustment = $player_adjustments{"OTHER"} + $player_adjustments{"WALK_IN"}; $player_total_csv = $player_total + $player_adjustments{"OTHER"}; #$tmp_player_info{$player_key}{"ADJUSTMENT"} = get_player_adjustment2($player_key); $amount_due = $player_total - $amount_paid + $total_adjustment; $tmp_player_info{$player_key}{"TOTAL_DUE"} = $player_total; $tmp_player_info{$player_key}{"TOTAL_DUE_CSV"} = $player_total_csv; $tmp_player_info{$player_key}{"AMOUNT_DUE"} = $amount_due; foreach my $player_field (keys %{$tmp_player_info{$player_key}}){ $player_info{$player_key}{"$player_field"} = $tmp_player_info{$player_key}{$player_field}; } } } foreach my $player_key (sort {lc($player_info{$a}{"LASTNAME"}) cmp lc($player_info{$b}{"LASTNAME"})} (keys %player_info)) { my @field_list = ("LASTNAME", "FIRSTNAME","HAT_SIZE", "TOTAL_DUE", "ADJUSTMENT", "PAID", "AMOUNT_DUE" ,"GENDER","DOB","GRADE","SNAME","RETURNING","PLAY_UP","ULASTNAME","UFIRSTNAME","UHOMEPHONE","UEMAIL"); if($player_header eq $player_header1){ $player_header = $player_header2; }else{ $player_header = $player_header1; } $paid = $paid + $player_info{$player_key}{"PAID"}; $player_info = " \n"; $player_info_csv = ""; foreach(@field_list){ #$player_info_csv .= process_for_csv($player_info{$player_key}{$_}); if($_ eq "PAID"){ $player_info .= " \n"; }elsif($_ eq "ADJUSTMENT"){ $player_info .= " \n"; }elsif($_ eq "HAT_SIZE"){ $display_date = convert_date_no_time_to_display($player_info{$player_key}{$_}); $player_info .= "\n"; }else{ $player_info .= "\n"; } } my @csv_field_list = ("LASTNAME", "FIRSTNAME", "HAT_SIZE", "DOB", "GENDER", "SNAME", "GRADE", "E_CONTACT_NAME", "E_CONTACT_PHONE", "E_CONTACT_SPHONE", "E_CONTACT_REL", "G_CONTACT_PHONE", "G_CONTACT_SPHONE", "G_CONTACT_NAME", "G_CONTACT_REL", "OG_CONTACT_PHONE", "OG_CONTACT_SPHONE", "OG_CONTACT_NAME", "OG_CONTACT_REL", "PREF_DOC_NAME", "PREF_DOC_NUMB", "PREF_DENT_NAME", "PREF_DENT_NUMB", "PREF_HOSPITAL", "INSURANCE", "POLICY", "MEDICAL", "RETURNING", "PAID", "TOTAL_DUE_CSV", "FUNDRAISER", "ADJUSTMENT", "LATE_FEE", "PAY_INFO", "CONSENT", "ACTIONSTO", "PLAY_UP", "ULASTNAME", "UFIRSTNAME", "UEMAIL", "UADDRESS1", "UADDRESS2", "UCITY", "USTATE", "UZIP_CODE", "UHOMEPHONE", "UMOBILE_PHONE"); foreach(@csv_field_list){ $player_info_csv .= process_for_csv($player_info{$player_key}{$_}); } $player_info .= ""; $full_user_info .= $player_info; $player_info_csv .= "\n"; $full_user_csv_info .= $player_info_csv; } $full_user_info .= "
$users{$user_key}{\"LASTNAME\"}, $users{$user_key}{\"FIRSTNAME\"}$users{$user_key}{\"HOMEPHONE\"}
edit$player_info{$player_key}{$_}$player_info{$player_key}{$_}$display_date $player_info{$player_key}{$_}
\n"; #print $table_header . $player_header_info . $full_user_info . "

 "; #if(-e $reg_report){ `rm $reg_report`;} #open(OUT, ">$reg_report") || die "ERROR: Could not create regusers. $!
"; #print OUT $player_header_info_csv . "\n" . $full_user_csv_info; #print "$teamdata" . $player_header_info_csv . "\n" . $full_user_csv_info; #close(OUT); return $player_header_info_csv . "\n" . $full_user_csv_info; } sub get_transaction_info_for_csv{ my $last_name = shift; my $first_name = shift; my $player_key = shift; my $return_string = ""; my $amount = 0; $player_header1 = "cal_events3"; $player_header2 = "cal_events2"; $user_header = "date_header"; my $dbh = get_dbh(); ################################################################ # Query DB to verify Session ################################################################ my $query = "SELECT a.`Amount`, a.`Check_ID`, a.`Date`, b.`Login` FROM `Reg_Manual_Transaction` a, `Account_Info` b WHERE a.`Player_ID` = '$player_key' AND b.`Key` = a.`Update_Account_ID`;"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Amount, \$Check_ID, \$Date, \$Login); while($sth->fetch()) { #$return_string .= "$last_name$first_name$Amount$Check_ID$Date$Login"; $return_string .= "Manual | $first_name $last_name | $Amount | $Check_ID | $Date\n"; $return_amount = $return_amount + $amount; } # disconnect from database $sth->finish(); $dbh->disconnect; #print "RP: $return_password
\n"; return $return_string, $amount; } sub get_adjustment_info{ my $last_name = shift; my $first_name = shift; my $player_key = shift; my $return_string = ""; my $amount = 0; my $return_amount = 0; $player_header1 = "cal_events3"; $player_header2 = "cal_events2"; $user_header = "date_header"; my $dbh = get_dbh(); ################################################################ # Query DB to verify Session ################################################################ my $query = "SELECT a.`Amount`, a.`Check_ID`, a.`Date`, b.`Login` FROM `Reg_Manual_Adjustment` a, `Account_Info` b WHERE a.`Player_ID` = '$player_key' AND b.`Key` = a.`Update_Account_ID`;"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Amount, \$Check_ID, \$Date, \$Login); while($sth->fetch()) { if($player_header eq $player_header1){ $player_header = $player_header2; }else{ $player_header = $player_header1; } $return_string .= "$last_name$first_name$Amount$Check_ID$Date$Login"; $return_amount = $Amount + $return_amount; } # disconnect from database $sth->finish(); $dbh->disconnect; #$return_amount = 3; #print "RP: $return_password
\n"; return $return_string, $return_amount; } sub get_player_adjustment2{ my $player_key = shift; my $walk_in_adjustment = 0; my $other_adjustment = 0; my $dbh = get_dbh(); my %reutrn_hash = (); $return_hash{"WALK_IN"} = 0; $return_hash{"OTHER"} = 0; my $query = "SELECT `Key`,`Amount`,`Check_ID` FROM `Reg_Manual_Adjustment` WHERE `Player_ID` = '$player_key';"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Key,\$Amount,\$Check_ID); while($sth->fetch()) { if($Check_ID eq "Walk In"){ $walk_in_adjustment = $walk_in_adjustment + $Amount; $return_hash{"WALK_IN"} = $walk_in_adjustment; }else{ $other_adjustment = $other_adjustment + $Amount; $return_hash{"OTHER"} = $other_adjustment; } } $sth->finish(); # disconnect from database $dbh->disconnect; return %return_hash; } sub get_player_adjustment{ my $player_key = shift; my $adjustment = 0; my $dbh = get_dbh(); my $query = "SELECT `Amount` FROM `Reg_Manual_Adjustment` WHERE `Player_ID` = '$player_key';"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Amount); while($sth->fetch()) { $adjustment = $adjustment + $Amount; } $sth->finish(); # disconnect from database $dbh->disconnect; return $adjustment; } ####################################### # This one shows the user on top of the player ####################################### sub print_show_reg{ my %users = get_users_by_org($org_id); #my %user_info = get_account_info($user_key); #my %player_info = get_player_info($user_key); #my %mod_player_info = get_player_info_by_key($player_key); #my %division_selected = get_division_data(); print <<__HTML__; __HTML__ print "
\n"; my $player_header_info = get_player_header(); $table_header = "\n"; $user_header = "date_header"; $player_header3 = "player_header"; $player_header1 = "cal_events3"; $player_header2 = "cal_events2"; $currnet_header = 2; $full_user_info = ""; foreach my $user_key (keys %users) { $html_user = "\n"; $html_user .= " \n"; my %player_info = get_player_info($user_key); $paid = 0; $html = ""; $player_info = ""; foreach my $player_key (keys %player_info) { if($player_header eq $player_header1){ $player_header = $player_header2; }else{ $player_header = $player_header1; } $paid = $paid + $player_info{$player_key}{"PAID"}; $player_info .= " \n"; $player_info .= " \n"; $player_info .= " \n"; $player_info .= " \n"; $player_info .= " \n"; $player_info .= " \n"; $player_info .= " \n"; $player_info .= " \n"; $player_info .= " \n"; $player_info .= " \n"; $player_info .= " \n"; $player_info .= " \n"; $player_info .= " \n"; $player_info .= " \n"; #$player_info{$player_key}{"SHOE_SIZE"} = $Shoe_Size; #$player_info{$player_key}{"JERSEY_PREF"} = $Jersey_Pref; #$player_info{$player_key}{"DOB"} = $DOB; #$player_info{$player_key}{"GENDER"} = $Gender; #$player_info{$player_key}{"SNAME"} = $School_Name; #$player_info{$player_key}{"GRADE"} = $Grade; #$player_info{$player_key}{"AGE"} = $Age; #$player_info{$player_key}{"HEIGHT"} = $Height; #$player_info{$player_key}{"WEIGHT"} = $Weight; #$player_info{$player_key}{"E_CONTACT_PHONE"} = $E_Contact_Phone; #$player_info{$player_key}{"E_CONTACT_SPHONE"} = $E_Contact_SPhone; #$player_info{$player_key}{"E_CONTACT_NAME"} = $E_Contact_Name; #$player_info{$player_key}{"E_CONTACT_REL"} = $E_Contact_Relationship; #$player_info{$player_key}{"G_CONTACT_PHONE"} = $G_Contact_Phone; #$player_info{$player_key}{"G_CONTACT_SPHONE"} = $G_Contact_SPhone; #$player_info{$player_key}{"G_CONTACT_NAME"} = $G_Contact_Name; #$player_info{$player_key}{"G_CONTACT_REL"} = $G_Contact_Relationship; #$player_info{$player_key}{"OG_CONTACT_PHONE"} = $OG_Contact_Phone; #$player_info{$player_key}{"OG_CONTACT_SPHONE"}= $OG_Contact_SPhone; #$player_info{$player_key}{"OG_CONTACT_NAME"} = $OG_Contact_Name; #$player_info{$player_key}{"OG_CONTACT_REL"} = $OG_Contact_Relationship; #$player_info{$player_key}{"PREF_DOC_NAME"} = $Preferred_Doc_Name; #$player_info{$player_key}{"PREF_DOC_NUMB"} = $Preferred_Doc_Number; #$player_info{$player_key}{"PREF_DENT_NAME"} = $Preferred_Dentist_Name; #$player_info{$player_key}{"PREF_DENT_NUMB"} = $Preferred_Dentist_Number; #$player_info{$player_key}{"PREF_HOSPITAL"} = $Preferred_Hospital; #$player_info{$player_key}{"INSURANCE"} = $Insurance_Carrier; #$player_info{$player_key}{"POLICY"} = $Policy_Number; #$player_info{$player_key}{"MEDICAL"} = $Medical_History; #$player_info{$player_key}{"RETURNING"} = $Returning_Player; #$player_info{$player_key}{"PAID"} = $Paid; #$player_info{$player_key}{"ACTIVE"} = $Active; #$player_info{$player_key}{"CONSENT"} = $Consent; #$player_info{$player_key}{"ACTIONSTO"} = $Consent_Actions; #$player_info{$player_key}{"PLAY_UP"} = $Play_Up; } $html_user .= "\n"; $full_user_info .= $html_user . $player_header_info . $player_info; #$users{$user_key}{"HOMEPHONE"} = $Home_Phone; #$users{$user_key}{"WORK_PHONE"} = $Work_Phone; #$users{$user_key}{"MOBILE_PHONE"} = $Mobile_Phone; #$users{$user_key}{"ZIP_CODE"} = $Zip_Code; #$users{$user_key}{"ADDRESS1"} = $Address1; #$users{$user_key}{"ADDRESS2"} = $Address2; #$users{$user_key}{"CITY"} = $City; #$users{$user_key}{"STATE"} = $State; } $full_user_info .= "
$users{$user_key}{\"LASTNAME\"}, $users{$user_key}{\"FIRSTNAME\"}$users{$user_key}{\"HOMEPHONE\"}
$player_info{$player_key}{\"LASTNAME\"}, $player_info{$player_key}{\"FIRSTNAME\"}$player_info{$player_key}{\"PAID\"}$player_info{$player_key}{\"DIVISION\"}$player_info{$player_key}{\"DOB\"}$player_info{$player_key}{\"GENDER\"}$player_info{$player_key}{\"SNAME\"}$player_info{$player_key}{\"GRADE\"}$player_info{$player_key}{\"RETURNING\"}$player_info{$player_key}{\"PLAY_UP\"}$player_info{$player_key}{\"PAID\"}$player_info{$player_key}{\"E_CONTACT_NAME\"}$player_info{$player_key}{\"E_CONTACT_PHONE\"}$player_info{$player_key}{\"E_CONTACT_SPHONE\"}$player_info{$player_key}{\"HAT_SIZE\"}$player_info{$player_key}{\"HAT_SIZE\"}
$paid
\n"; print $table_header . $full_user_info; } ################################################################ ### This is the Main Sub routing for the home page ################################################################ sub main_registration{ $failed_login = 0; ############################################################### ### Get paramters ############################################################### $page = param('page'); $sub = param('sub'); $coach = param('coach'); $newnews = param('news'); $title = param('title'); $date = param('date'); $update = param('update'); $obj_id = param('obj_id'); $month = param('month'); $year = param('year'); $day = param('day'); #$org_id = param('org_id'); $league_id = param('league_id'); $user = param('user'); $pass = param('pass'); $filter = param('filter'); $admin = param('admin'); $info_id = param('info_id'); $login = param('login'); $personal = param('personal'); $action = param('action'); $newemail = param('newemail'); $payment_s = param('payment_status'); ############################################################### ### Print Header ############################################################### %site_info = get_site_info($org_id); $site_info{"site_banner_image"} =~ s/\/home\/homete3\/public_html//; $site_info{"site_logo"} =~ s/\/home\/homete3\/public_html//; print header(); print_start_header_main(); print_style(); ############################################################### ### Print Body of HTML doc ############################################################### print <<__HTML__; __HTML__ $active_id{"login"} = ""; $active_id{"create"} = ""; $active_id{"register"} = ""; $active_id{"verify"} = ""; $active_id{"pay"} = ""; #ADDED this portion to show logout feature. my $email = param('email'); my $pw = param('pw'); my $session_id = check_reg_login($email, "$pw"); if($action eq "logout"){ $session_id = ""; } print_top($session_id); #print_right_border($org_id); #print_menu($org_id); print_reg_info(); print_step_choices(); } ################################################################ ### Prints the top title bar ################################################################ sub print_top{ $session_id = shift; if($session_id ne ""){ $access_level =1; } print <<__HTML__;
__HTML__ print "
\n"; if($access_level == 1){ #print "Welcome, $valid_user{\"FIRSTNAME\"}\n"; ################################# ## If Admin ################################# if($access_level >= 3){ print "   Control Panel\n"; } if($access_level >= 1){ #print "   My Hometeamz\n"; print "   Logout"; } }else{ #print "Login"; } print <<__HTML__;
 

$site_info{"site_banner_text"}


__HTML__ } sub print_steps{ print_reg_style(); print "
\n"; print <<__HTML__;
 
__HTML__ } sub print_step_choices{ if($action eq "step2"){ ##### Log in to verify USER Account information $email = param('email'); $pw = param('pw'); $session_id = check_reg_login($email, "$pw"); if($session_id eq ""){ print_reg_login("Your username or password was incorrect."); }else{ print_verify_account_info($email); } }elsif($action eq "sendtmppass"){ if(check_for_account($newemail)== 0){ ##### Verify Email Account print_send_temp_pw(); }else{ print_create_new_account_duplicate_email(); } }elsif($action eq "tmppw"){ $email = param('email'); $pw = param('pw'); $x = param('x'); $newemail = $email; #print "tmp_string: $x
\n"; if(defined($email)){ $bad_user_pass = "Your username or password was incorrect"; }else{ $bad_user_pass = ""; } $valid_tmp_pw = check_tmp_password($email, $pw, $x); if($valid_tmp_pw == 1){ print_create_account(); }else{ print_temp_pw_login($bad_user_pass); #print_send_temp_pw($bad_user_pass); } }elsif($action eq "newaccount"){ ##### Get information to create new USER Account if(check_for_account($newemail)== 0){ print_create_account(); }else{ print_create_new_account_duplicate_email(); } }elsif($action eq "createaccount"){ ##### Create New USER Account, Get information to create new PLAYER Account $email = get_param(email); if(check_for_account($email)== 0){ ##### Verify Email Account $user_key = createaccount(); } print_verify_account_info($email); #print_register_programs($user_key); }elsif($action eq "register"){ ##### After a USER logs in, Get information to create new PLAYER Account $session_id = check_reg_login(); if($session_id eq ""){ print_reg_login(); }else{ my $user_key = param('userkey'); if((!(defined($user_key))) || ($user_key eq "")){ $email = param('email'); my %user_info = get_account_info_by_email($email); $user_key = $user_info{"KEY"}; } print_register_programs($user_key); } }elsif($action eq "remove_player"){ $session_id = check_reg_login(); if($session_id eq ""){ print_reg_login(); }else{ my $user_key = param('userkey'); my $player_key = param('playerkey'); remove_player($player_key); print_register_programs($user_key); } }elsif($action eq "modify"){ ##### Get Information to Update USER Account $session_id = check_reg_login(); if($session_id eq ""){ print_reg_login(); }else{ $email = param('email'); print_update_account($email); } }elsif($action eq "modifyaccount"){ ##### Modify USER Account, Verify Information $session_id = check_reg_login(); if($session_id eq ""){ print_reg_login(); }else{ $email = update_account(); print_verify_account_info($email); } }elsif($action eq "createaplayerccount"){ ##### Create PLAYER account, Verify Information $session_id = check_reg_login(); if($session_id eq ""){ print_reg_login(); }else{ my $new_player_id = create_new_player(); print_verify_register_programs($new_player_id); } }elsif($action eq "updateplayerccount"){ ###### Modify PLAYER Account, Verify Information $session_id = check_reg_login(); if($session_id eq ""){ print_reg_login(); }else{ my $player_id = update_player(); print_verify_register_programs($player_id); } }elsif($action eq "modify_player"){ #### Get Information to Modify PLAYER $session_id = check_reg_login(); if($session_id eq ""){ print_reg_login(); }else{ print_modify_player(); } }elsif($action eq "pay"){ $session_id = check_reg_login(); if($session_id eq ""){ print_reg_login(); }else{ print_pay(); } }elsif($action eq "pay_by_check"){ $session_id = check_reg_login(); if($session_id eq ""){ print_reg_login(); }else{ print_pay_by_check(); } }elsif($action eq "partial"){ $session_id = check_reg_login(); if($session_id eq ""){ print_reg_login(); }else{ print_pay_partial(); } }elsif($action eq "verify_partial"){ $session_id = check_reg_login(); if($session_id eq ""){ print_reg_login(); }else{ print_verify_pay_partial(); } }elsif($action eq "forgot_pw"){ print_forgot_pw(); }elsif($action eq "send_pw"){ $found_email = send_pw(); if($found_email == 1){ print_reg_login("Your Password will be sent to you shortly"); }else{ print_forgot_pw("I'm sorry, we could not find that email,
if this problem continues, please
contact support\@hometeamz.com"); } }elsif($action eq "logout"){ print "\n"; print_reg_login("You have successfully logged out."); }elsif($action eq "pay_by_check_complete"){ $session_id = check_reg_login(); if($session_id eq ""){ print_reg_login(); }else{ print_pay_partial_complete(); } }elsif($action eq "pp"){ $session_id = check_reg_login(); if($session_id eq ""){ print_reg_login(); }else{ print_pay_partial_complete(); } }elsif($payment_s eq "Completed"){ $session_id = check_reg_login(); if($session_id eq ""){ print_reg_login(); }else{ print_pay_partial_complete(); } }else{ print_reg_login(); } print "
\n"; print <<__HTML__; __HTML__ print "\n"; } ############################################ # Step 1. login or create new account ############################################ sub print_forgot_pw{ my $msg = shift; if($msg ne ""){ $alert =<<__HTML__
$msg

__HTML__ } $active_id{"login"} = "id=current"; print_steps(); my $email_validation = get_email_validation(); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; my $html = <<__HTML__; $alert
Step 1: User Login - Retrieve Password
Enter your email and click Get Password and we will email you your password.

Enter Email
Email
__HTML__ print $html; } sub get_tmp_pw{ #my $tmp_pw = "123test"; my $tmp_pw = generate_random_string_pw(6); return $tmp_pw; } sub generate_random_string_pw{ $length = shift; $rand_string = ""; $possible = '23456789'; while (length($rand_string) < $length) { $rand_string .= substr($possible, (int(rand(length($possible)))), 1); } return $rand_string; } sub get_tmp_string{ #my $tmp_string = "123test"; my $tmp_string = generate_random_string(20); my $random_string_exists = get_email_by_x($tmp_string); my $count = 1; while($random_string_exists ne ""){ $random_string_exists = get_email_by_x($tmp_string); $count++; if($count > 10){ $random_string_exists = ""; } } return $tmp_string; } sub check_tmp_password{ my $email = shift; my $pw = shift; my $tmp_string = shift; my $tmp_pw = 0; my $valid_tmp_pw = 0; my $dbh = get_dbh(); my $query = "SELECT `Key`, `Tmp_Password` FROM `Account_TMP_Password` WHERE `Email` = '$email' AND `Tmp_String` = '$tmp_string';"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Key, \$Tmp_Password); while($sth->fetch()) { $tmp_pw = $Tmp_Password; $key = $Key; } if($tmp_pw eq $pw){ $valid_tmp_pw = 1; }else{ if($tmp_pw == 0){ $valid_tmp_pw = 2; } } $sth->finish(); $dbh->disconnect; return $valid_tmp_pw; } sub check_tmp_password_exits{ my $email = shift; my $valid_tmp_string = ""; my $dbh = get_dbh(); my $query = "SELECT `Tmp_String`, `Tmp_Password` FROM `Account_TMP_Password` WHERE `Email` = '$email';"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Tmp_String, \$Tmp_Password); while($sth->fetch()) { $valid_tmp_string = $Tmp_String; $tmp_password = $Tmp_Password; } $sth->finish(); $dbh->disconnect; return $valid_tmp_string, $tmp_password; } sub set_account_tmp_password{ my $email = shift; my $tmp_string = ""; my $pw = ""; my $date_time = ""; $date_time = get_date_time(); ($tmp_string, $pw) = check_tmp_password_exits($email); #print "TS: $tmp_string - PW: $pw
\n"; if($tmp_string eq ""){ $pw = get_tmp_pw(); $tmp_string = get_tmp_string(); my $dbh = get_dbh(); my $query = "INSERT INTO `Account_TMP_Password` ( `Key` , `Email` , `Tmp_Password` , `Tmp_String` , `Date`) VALUES ('', '$email', '$pw', '$tmp_string', '$date_time');"; my $sth = $dbh->prepare($query); $sth->execute(); $sth->finish(); $dbh->disconnect; } return $pw, $tmp_string, $date_time; } sub send_tmppw{ my $email = shift;; my $sendmail = "/bin/sendmail.localhost -t"; #my $reply_to = "Reply-to: jeremy\@hometeamz.com"; my $reply_to = "Reply-to: noreply\@lyaa.org"; my $subject = "Account Password for Lakes Youth Athletic Association Registration"; my $to = "$email"; #my $to = "jeremymclean\@gmail.com"; #my $from = "jeremy\@hometeamz.com"; my $from = "noreply\@lyaa.org"; my ($pw, $tmp_string, $date_time) = set_account_tmp_password($email); my $found_email = 0; if($pw ne ""){ $found_email = 1; my %user_info = get_account_info_by_email($email); $content = "Welcome,

\n\nThank you for registering with Lakes Youth Athletic Association

\n\n"; $contetn .= "Please use the temporary password provided below to validate your new account.

\n"; $content .= "Your temporary password is: $pw
\nYour login is: $email

\n\n"; $content .= "To proceed directly to the account verification window, please follow this link\n"; $content .= "\n"; #print "HEY
\n"; open(SENDMAIL, "|$sendmail -f $from") or die "Cannot open $sendmail: $!"; print SENDMAIL "To: $to\n"; #print SENDMAIL "bcc: $bcc\n"; print SENDMAIL "Subject: $subject\n"; print SENDMAIL "Content-type: text/html\n\n"; print SENDMAIL $content; close(SENDMAIL); } #print "$to $pw $from $content
\n"; return $found_email, $tmp_string; } sub send_pw{ my $email = param('email'); my $sendmail = "/bin/sendmail.localhost -t"; my $reply_to = "Reply-to: noreply\@lyaa.org"; my $subject = "Password Reminder for Lakes Youth Athletic Association "; my $to = "$email"; #my $to = "jeremymclean\@gmail.com"; #my $from = "jeremy\@hometeamz.com"; my $from = "noreply\@lyaa.org"; my $pw = get_pw_by_email($email); my $found_email = 0; if($pw eq ""){ #print "PW2: $pw
\n"; }else{ #print "PW: $pw
\n"; $found_email = 1; my %user_info = get_account_info_by_email($email); $content = "Hello $user_info{\"FIRSTNAME\"} $user_info{\"LASTNAME\"},\n\n"; $content .= "You have requested a password reminder from Lakes Youth Athletic Association.\n\n"; $content .= "Your information is:\nLogin: $user_info{\"EMAIL\"}\nPassword: $pw \n"; open(SENDMAIL, "|$sendmail -f $from") or die "Cannot open $sendmail: $!"; print SENDMAIL "To: $to\n"; print SENDMAIL "bcc: $bcc\n"; print SENDMAIL "Subject: $subject\n"; print SENDMAIL "Content-type: text/plain\n\n"; print SENDMAIL $content; close(SENDMAIL); #print $content; } return $found_email; } ########################################### # Modify player info on admin registration ########################################### sub print_modify_player2{ my $player_key = shift; my $org_id = shift; my %mod_player_info = get_player_info_by_key($player_key); my %division_selected = get_division_data(); my @grades = get_grades(); my @relationships = get_relationships(); #print "PLAYER KEY: $player_key
"; my $phone_validation = get_phone_validation(); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; #if($user_info{"ADDRESS2"} ne ""){ #$address2 = "$user_info{\"ADDRESS2\"}
"; #}else{ #$address2 = ""; #} my %division_selected = get_division_data(); my %shirt_size_selected = get_shirt_size_data(); my %pant_size_selected = get_pant_size_data(); $division_selected{$mod_player_info{"DIVISION"}}{"S"} = "SELECTED"; $shirt_size_selected{$mod_player_info{"SHIRT_SIZE"}}{"S"} = "SELECTED"; $pant_size_selected{$mod_player_info{"PANT_SIZE"}}{"S"} = "SELECTED"; my $html = <<__HTML__;

Step 3:Update Player
Please complete the information listed below...
    * Required Fields
__HTML__ #foreach my $div_id (sort { $a <=> $b } keys %division_selected) { # $html .= "\n"; #} $male_selected = ""; $female_selected = ""; $yes_selected = ""; $no_selected = ""; $consent_yes = ""; $consent_no = ""; if($mod_player_info{"CONSENT"} eq "Yes"){ $consent_yes = "CHECKED"; }else{ $consent_no = "CHECKED"; } if($mod_player_info{"GENDER"} eq "male"){ $male_selected = "CHECKED"; }else{ $female_selected = "CHECKED"; } if($mod_player_info{"RETURNING"} eq "Yes"){ $yes_selected = "CHECKED"; }else{ $no_selected = "CHECKED"; } if($mod_player_info{"PLAY_UP"} eq "Yes"){ $play_up = "CHECKED"; }else{ $play_up = ""; } $html .= <<__HTML__; __HTML__ $html .= <<__HTML__;
Player Information
Player First Name*
Player Last Name*
Date of Birth*
Gender* Male Female
School Name
Current Grade Level*
Returning Player* Yes No
Request this Player to play up a League:
Guardian Information
Guardian 1 Name*
Guardian 1 Primary Phone* $phone_example
Guardian 1 Secondary Phone $phone_example
Guardian 1 Relationship*
Guardian 2 Name
Guardian 2 Primary Phone $phone_example
Guardian 2 Secondary Phone $phone_example
Guardian 2 Relationship
Emergency Contact Information
Emergency Contact Name*
Emergency Contact Primary Phone* $phone_example
Emergency Contact Secondary Phone $phone_example
Emergency Contact Relationship*
Medical Information
Preferred Doctor Name
Preferred Doctor Phone $phone_example
Preferred Dentist Name
Preferred Dentist Phone $phone_example
Preferred Hospital
Insurance Carrier
Policy Number
Medical History:
Allergies, Medications,
Special Condition, etc
GRANT OF CONSENT * (please select one for the player listed above)
GRANT OF CONSENT: In the event reasonable attempts to contact the parents or guardians have been unsuccessful, I hereby give my consent for
(1) the administration of any treatment deemed necessary by preferred Dr.
(2), or preferred Dentists or in the event designated Dr. or Dentist is not available, by another licensed physician or dentist; and
(2) the transfer of the child to preferred hospital or any hospital reasonably accessible. NOTE: This authorization does not cover major surgery unless the medical options of two other licensed physicians or dentists, concurring in necessity for such surgery are obtained BEFORE the surgery IS PERFORMED.

REFUSAL OF CONSENT: I do NOT give consent for emergency medical treatment of my child. In the event of illness or injury requiring emergency treatment, I wish that Lakes Youth Athletic Association to take no action, or perform the following actions.
Actions to be taken:


* Required Fields
__HTML__ print $html; } ########################################### # Modify player info on main registration ########################################### sub print_modify_player{ my $user_key = param('userkey'); my $player_key = param('playerkey'); my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my %mod_player_info = get_player_info_by_key($player_key); my %division_selected = get_division_data(); my @grades = get_grades(); my @relationships = get_relationships(); my $account_table = get_account_table($user_key); my ($user_table, $player_num) = get_player_table($user_key); $active_id{"register"} = "id=current"; print_steps(); my $phone_validation = get_phone_validation(); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; if($user_info{"ADDRESS2"} ne ""){ $address2 = "$user_info{\"ADDRESS2\"}
"; }else{ $address2 = ""; } my %division_selected = get_division_data(); my %shirt_size_selected = get_shirt_size_data(); my %pant_size_selected = get_pant_size_data(); $division_selected{$mod_player_info{"DIVISION"}}{"S"} = "SELECTED"; $shirt_size_selected{$mod_player_info{"SHIRT_SIZE"}}{"S"} = "SELECTED"; $pant_size_selected{$mod_player_info{"PANT_SIZE"}}{"S"} = "SELECTED"; my $html = <<__HTML__;
$account_table $user_table

Step 3:Update Registration
Please complete the information listed below...
    * Required Fields
__HTML__ #foreach my $div_id (sort { $a <=> $b } keys %division_selected) { # $html .= "\n"; #} $male_selected = ""; $female_selected = ""; $yes_selected = ""; $no_selected = ""; $consent_yes = ""; $consent_no = ""; if($mod_player_info{"CONSENT"} eq "Yes"){ $consent_yes = "CHECKED"; }else{ $consent_no = "CHECKED"; } if($mod_player_info{"GENDER"} eq "male"){ $male_selected = "CHECKED"; }else{ $female_selected = "CHECKED"; } if($mod_player_info{"RETURNING"} eq "Yes"){ $yes_selected = "CHECKED"; }else{ $no_selected = "CHECKED"; } if($mod_player_info{"PLAY_UP"} eq "Yes"){ $play_up = "CHECKED"; }else{ $play_up = ""; } $html .= <<__HTML__; __HTML__ $html .= <<__HTML__;
Player Information
Player First Name*
Player Last Name*
Date of Birth*
Gender* Male Female
School Name
Current Grade Level*
Returning Player* Yes No
Request this Player to play up a League:
Guardian Information
Guardian 1 Name*
Guardian 1 Primary Phone* $phone_example
Guardian 1 Secondary Phone $phone_example
Guardian 1 Relationship*
Guardian 2 Name
Guardian 2 Primary Phone $phone_example
Guardian 2 Secondary Phone $phone_example
Guardian 2 Relationship
Emergency Contact Information
Emergency Contact Name*
Emergency Contact Primary Phone* $phone_example
Emergency Contact Secondary Phone $phone_example
Emergency Contact Relationship*
Medical Information
Preferred Doctor Name
Preferred Doctor Phone $phone_example
Preferred Dentist Name
Preferred Dentist Phone $phone_example
Preferred Hospital
Insurance Carrier
Policy Number
Medical History:
Allergies, Medications,
Special Condition, etc
GRANT OF CONSENT * (please select one for the player listed above)
GRANT OF CONSENT: In the event reasonable attempts to contact the parents or guardians have been unsuccessful, I hereby give my consent for
(1) the administration of any treatment deemed necessary by preferred Dr.
(2), or preferred Dentists or in the event designated Dr. or Dentist is not available, by another licensed physician or dentist; and
(2) the transfer of the child to preferred hospital or any hospital reasonably accessible. NOTE: This authorization does not cover major surgery unless the medical options of two other licensed physicians or dentists, concurring in necessity for such surgery are obtained BEFORE the surgery IS PERFORMED.

REFUSAL OF CONSENT: I do NOT give consent for emergency medical treatment of my child. In the event of illness or injury requiring emergency treatment, I wish that Lakes Youth Athletic Association to take no action, or perform the following actions.
Actions to be taken:


* Required Fields
__HTML__ print $html; } ########################################### # Modify player info on main registration ########################################### sub admin_print_modify_player{ my $user_key = param('userkey'); my $player_key = param('playerkey'); my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my %mod_player_info = get_player_info_by_key($player_key); my %division_selected = get_division_data(); my @grades = get_grades(); my @relationships = get_relationships(); my $account_table = get_account_table($user_key); my ($user_table, $player_num) = get_player_table($user_key); $active_id{"register"} = "id=current"; print_steps(); my $phone_validation = get_phone_validation(); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; if($user_info{"ADDRESS2"} ne ""){ $address2 = "$user_info{\"ADDRESS2\"}
"; }else{ $address2 = ""; } my %division_selected = get_division_data(); my %shirt_size_selected = get_shirt_size_data(); my %pant_size_selected = get_pant_size_data(); $division_selected{$mod_player_info{"DIVISION"}}{"S"} = "SELECTED"; $shirt_size_selected{$mod_player_info{"SHIRT_SIZE"}}{"S"} = "SELECTED"; $pant_size_selected{$mod_player_info{"PANT_SIZE"}}{"S"} = "SELECTED"; my $html = <<__HTML__;
$account_table $user_table

Step 3:Update Registration
Please complete the information listed below...
    * Required Fields
__HTML__ #foreach my $div_id (sort { $a <=> $b } keys %division_selected) { # $html .= "\n"; #} $male_selected = ""; $female_selected = ""; $yes_selected = ""; $no_selected = ""; $consent_yes = ""; $consent_no = ""; if($mod_player_info{"CONSENT"} eq "Yes"){ $consent_yes = "CHECKED"; }else{ $consent_no = "CHECKED"; } if($mod_player_info{"GENDER"} eq "male"){ $male_selected = "CHECKED"; }else{ $female_selected = "CHECKED"; } if($mod_player_info{"RETURNING"} eq "Yes"){ $yes_selected = "CHECKED"; }else{ $no_selected = "CHECKED"; } if($mod_player_info{"PLAY_UP"} eq "Yes"){ $play_up = "CHECKED"; }else{ $play_up = ""; } $html .= <<__HTML__; __HTML__ $html .= <<__HTML__;
Player Information
Player First Name*
Player Last Name*
Date of Birth*
Gender* Male Female
School Name
Current Grade Level*
Returning Player* Yes No
Request this Player to play up a League:
Guardian Information
Guardian 1 Name*
Guardian 1 Primary Phone* $phone_example
Guardian 1 Secondary Phone $phone_example
Guardian 1 Relationship*
Guardian 2 Name
Guardian 2 Primary Phone $phone_example
Guardian 2 Secondary Phone $phone_example
Guardian 2 Relationship
Emergency Contact Information
Emergency Contact Name*
Emergency Contact Primary Phone* $phone_example
Emergency Contact Secondary Phone $phone_example
Emergency Contact Relationship*
Medical Information
Preferred Doctor Name
Preferred Doctor Phone $phone_example
Preferred Dentist Name
Preferred Dentist Phone $phone_example
Preferred Hospital
Insurance Carrier
Policy Number
Medical History:
Allergies, Medications,
Special Condition, etc
GRANT OF CONSENT * (please select one for the player listed above)
GRANT OF CONSENT: In the event reasonable attempts to contact the parents or guardians have been unsuccessful, I hereby give my consent for
(1) the administration of any treatment deemed necessary by preferred Dr.
(2), or preferred Dentists or in the event designated Dr. or Dentist is not available, by another licensed physician or dentist; and
(2) the transfer of the child to preferred hospital or any hospital reasonably accessible. NOTE: This authorization does not cover major surgery unless the medical options of two other licensed physicians or dentists, concurring in necessity for such surgery are obtained BEFORE the surgery IS PERFORMED.

REFUSAL OF CONSENT: I do NOT give consent for emergency medical treatment of my child. In the event of illness or injury requiring emergency treatment, I wish that Lakes Youth Athletic Association to take no action, or perform the following actions.
Actions to be taken:


* Required Fields
__HTML__ print $html; } sub get_pant_size_data{ my %pant_size_selected = (); $pant_size_selected{0}{"OPTION"} = "--Select--"; $pant_size_selected{1}{"OPTION"} = "Youth Medium"; $pant_size_selected{2}{"OPTION"} = "Prepaid A Medium"; $pant_size_selected{3}{"OPTION"} = "Prepaid A Large"; $pant_size_selected{4}{"OPTION"} = "Prepaid A X-Large"; $pant_size_selected{5}{"OPTION"} = "Prepaid Y Small"; $pant_size_selected{6}{"OPTION"} = "Prepaid Y Medium"; $pant_size_selected{7}{"OPTION"} = "Prepaid Y Large"; $pant_size_selected{8}{"OPTION"} = "Prepaid Y X-Large"; $pant_size_selected{9}{"OPTION"} = "Youth Small"; $pant_size_selected{10}{"OPTION"} = "Youth Medium"; $pant_size_selected{11}{"OPTION"} = "Youth Large"; $pant_size_selected{12}{"OPTION"} = "Youth X-Large"; $pant_size_selected{13}{"OPTION"} = "Adult Small"; $pant_size_selected{14}{"OPTION"} = "Adult Medium"; $pant_size_selected{15}{"OPTION"} = "Adult Large"; $pant_size_selected{16}{"OPTION"} = "Adult X-Large"; $pant_size_selected{0}{"S"} = ""; $pant_size_selected{1}{"S"} = ""; $pant_size_selected{2}{"S"} = ""; $pant_size_selected{3}{"S"} = ""; $pant_size_selected{4}{"S"} = ""; $pant_size_selected{5}{"S"} = ""; $pant_size_selected{6}{"S"} = ""; $pant_size_selected{7}{"S"} = ""; $pant_size_selected{8}{"S"} = ""; $pant_size_selected{9}{"S"} = ""; $pant_size_selected{10}{"S"} = ""; $pant_size_selected{11}{"S"} = ""; $pant_size_selected{12}{"S"} = ""; $pant_size_selected{13}{"S"} = ""; $pant_size_selected{14}{"S"} = ""; $pant_size_selected{15}{"S"} = ""; $pant_size_selected{16}{"S"} = ""; return %pant_size_selected; } sub get_division_data{ my %division_selected = (); $division_selected{0}{"S"} = ""; $division_selected{1}{"S"} = ""; $division_selected{2}{"S"} = ""; $division_selected{3}{"S"} = ""; $division_selected{4}{"S"} = ""; $division_selected{5}{"S"} = ""; $division_selected{6}{"S"} = ""; $division_selected{7}{"S"} = ""; $division_selected{8}{"S"} = ""; $division_selected{9}{"S"} = ""; $division_selected{10}{"S"} = ""; $division_selected{11}{"S"} = ""; $division_selected{12}{"S"} = ""; $division_selected{13}{"S"} = ""; $division_selected{14}{"S"} = ""; $division_selected{15}{"S"} = ""; $division_selected{0}{"OPTION"} = "--Sport - League - Age(min-max)--"; $division_selected{1}{"OPTION"} = "Baseball - Bronco - 10-12"; $division_selected{2}{"OPTION"} = "Baseball - Colt - 15-16"; $division_selected{3}{"OPTION"} = "Baseball - Mustang - 8-10"; $division_selected{4}{"OPTION"} = "Baseball - Pinto - 6-8"; $division_selected{5}{"OPTION"} = "Baseball - Pony - 12-14"; $division_selected{6}{"OPTION"} = "Baseball - Travel 11 year old - 10-11"; $division_selected{7}{"OPTION"} = "Baseball - Travel 12 year old - 10-12"; $division_selected{8}{"OPTION"} = "Baseball - Travel 13 year old - 12-13"; $division_selected{9}{"OPTION"} = "Baseball - Travel 14 year old - 13-14"; $division_selected{10}{"OPTION"} = "Softball - Bronco - 10-12"; $division_selected{11}{"OPTION"} = "Softball - Colt - 14-17"; $division_selected{12}{"OPTION"} = "Softball - Mustang - 8-10"; $division_selected{13}{"OPTION"} = "Softball - Pinto - 6-8"; $division_selected{14}{"OPTION"} = "Softball - Pony - 12-14"; $division_selected{15}{"OPTION"} = "Softball - Travel 11 year old - 10-11"; $division_selected{0}{"COST"} = "0"; $division_selected{1}{"COST"} = "150"; $division_selected{2}{"COST"} = "175"; $division_selected{3}{"COST"} = "150"; $division_selected{4}{"COST"} = "150"; $division_selected{5}{"COST"} = "175"; $division_selected{6}{"COST"} = "270"; $division_selected{7}{"COST"} = "270"; $division_selected{8}{"COST"} = "270"; $division_selected{9}{"COST"} = "270"; $division_selected{10}{"COST"} = "150"; $division_selected{11}{"COST"} = "175"; $division_selected{12}{"COST"} = "150"; $division_selected{13}{"COST"} = "150"; $division_selected{14}{"COST"} = "175"; $division_selected{15}{"COST"} = "175"; return %division_selected; } sub get_shirt_size_data{ $shirt_size_selected{0}{"S"} = ""; $shirt_size_selected{1}{"S"} = ""; $shirt_size_selected{2}{"S"} = ""; $shirt_size_selected{3}{"S"} = ""; $shirt_size_selected{4}{"S"} = ""; $shirt_size_selected{5}{"S"} = ""; $shirt_size_selected{6}{"S"} = ""; $shirt_size_selected{0}{"OPTION"} = "--Select--"; $shirt_size_selected{1}{"OPTION"} = "Youth Medium"; $shirt_size_selected{2}{"OPTION"} = "Youth Large"; $shirt_size_selected{3}{"OPTION"} = "Adult Medium"; $shirt_size_selected{4}{"OPTION"} = "Adult Large"; $shirt_size_selected{5}{"OPTION"} = "Adult X-Large"; $shirt_size_selected{6}{"OPTION"} = "Other"; return %shirt_size_selected; } sub print_pay_by_check{ $active_id{"pay"} = "id=current"; my $user_key = param('userkey'); my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my %division_selected = get_division_data(); my ($user_table, $pay_pal) = get_pay_table($user_key, 1); my $account_table = get_account_table($user_key); print_steps(); print "
\n"; print "

Step 5 : Pay by Check
Please verify your registration prior to sending the check.

\n"; print $account_table . "

" . $user_table, "
"; print "
\n"; } sub admin_print_pay_by_check{ $active_id{"pay"} = "id=current"; my $user_key = param('userkey'); my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my %division_selected = get_division_data(); my ($user_table, $pay_pal) = admin_get_pay_table($user_key, 1); my $account_table = get_account_table($user_key); print_steps(); print "
\n"; print "

Step 5 : Pay by Check
Please verify your registration prior to sending the check.

\n"; print $account_table . "

" . $user_table, "
"; print "
\n"; } sub is_older_than_cutoff{ my $dob = shift; my $gender = shift; my $cost = 150; if($gender eq "male"){ ################################## # If born before this date add $25 ################################## my $cut_off = "1995-05-01"; my $league_start_date = "2008-05-01"; my $older_than_cut_off = 0; my ($year, $month, $day) = split(/-/, $dob); my ($cyear, $cmonth, $cday) = split(/-/, $cut_off); my ($syear, $smonth, $sday) = split(/-/, $league_start_date); my $hour = 0; my $sec = 0; my $min = 0; $year = $year - 1900; $cyear = $cyear - 1900; $syear = $syear - 1900; $month = $month -1; $cmonth = $cmonth -1; $smonth = $smonth -1; #if($month < 1){$month = 1;} #if($day < 1){$day =1;} my $dob_epoch = timelocal($sec,$min,$hour,$day,$month,$year); my $cdob_epoch = timelocal($sec,$min,$hour,$cday,$cmonth,$cyear); my $sdob_epoch = timelocal($sec,$min,$hour,$sday,$smonth,$syear); if($dob_epoch < $cdob_epoch){ $older_than_cut_off = 1; $cost = $cost + 25; } # Wasnt really needed :) #my $age_epoch = $sdob_epoch - $dob_epoch; #my $age_in_years = convert_epoch_to_years($age_epoch); #return $older_than_cut_off, $age_in_years; } return $cost; } sub convert_epoch_to_years{ my $age_epoch = shift; my $seconds_in_year = 60*60*24*365; my $age_in_years =sprintf("%.3f", $age_epoch/$seconds_in_year); return $age_in_years; } sub get_transaction_id{ my $dbh = get_dbh(); ################################################################ # Query DB to verify Session ################################################################ my $query = "SELECT `Transaction_ID` FROM `TMP_TRANSACTION_ID` WHERE 1"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Transaction_ID); while($sth->fetch()) { $return_id = $Transaction_ID; } # disconnect from database $query = "UPDATE `TMP_TRANSACTION_ID` SET `Transaction_ID`=`Transaction_ID`+1 WHERE `Transaction_ID` = '$return_id'"; $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->finish(); $dbh->disconnect; return $return_id; } sub insert_tmp_paypal{ my $account_id = shift; my $player_id = shift; my $amount = shift; my $transaction_id = shift; my $date = get_date_time(); my $dbh = get_dbh(); ################################################################ # Query DB to verify Session ################################################################ my $query = "INSERT INTO `TMP_PAYPAL` (`Key`, `Account_ID`, `Player_ID`, `Amount`, `Transaction_ID`, `PP_Transaction_ID`, `Processed`, `Date`) VALUES ('', '$account_id', '$player_id', '$amount', '$transaction_id','0', '0', '$date')"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->finish(); $dbh->disconnect; } sub admin_get_pay_table{ my $user_key = shift; my $by_check = shift; my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my $pay_pal_count = 1; my $num_players = 0; my $total_cost = 0; my $walk_in_fee = 0; my $walk_in_amount = 25; my $adjustment_string = ""; if($by_check == 0){ $transaction_id = get_transaction_id(); } my $user_table = "\n"; $user_table .= "\n"; #$user_table .= "\n"; my $pay_pal = "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; #$pay_pal .= "\n"; foreach my $user_number (sort {$a <=> $b} (keys %player_info)){ $num_players++; my $base_cost = is_older_than_cutoff($player_info{$user_number}{"DOB"},$player_info{$user_number}{"GENDER"}); $division_id = $player_info{$user_number}{"DIVISION"}; $player_key = $player_info{$user_number}{"KEY"}; $amount_paid = $player_info{$user_number}{"PAID"}; ($tmp_adjustment_info, $player_adjustment) = get_adjustment_info($player_info{$user_number}{"LASTNAME"}, $player_info{$user_number}{"FIRSTNAME"}, $player_info{$user_number}{"KEY"}); $user_table .= "\n"; $user_table .= "\n"; if($num_players > 2){$fundraiser_fee = 0; $fundraiser_string = "";}else{$fundraiser_fee = 30; $fundraiser_string = "+ \$30 Fundraiser";} if($num_players > 1){$discount = 15; $discount_string = "-\$15 multiplayer discount";}else{$discount = 0;$discount_string = "";} $player_total = $base_cost + $fundraiser_fee - $discount + $player_adjustment; $amount_due = $player_total - $amount_paid ; $registration_string = "\$$base_cost Registration Fee"; $user_table .= "\n"; $user_table .= "\n"; $user_table .= "\n"; $user_table .= "\n"; if($player_adjustment > 0){ $adjustment_string = "+ \$$player_adjustment Adjustment Fee"; }else{ $adjustment_string = ""; } #$amount_due = .02; if($by_check == 0){ insert_tmp_paypal($user_key, $player_key, $amount_due, $transaction_id); } $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal_count++; $total_cost = $amount_due + $total_cost; $paid = "No"; $user_table .= "\n"; } $user_table .= "\n"; $user_table .= "
Registered Players
NameRegistration FeeFundraiser FeeAdjustmentsMulti-Player
Discount
TotalPaidDue
NameDivisionRegistration FeeFundraiser FeeDiscountTotalPaid
$player_info{$user_number}{\"FIRSTNAME\"} $player_info{$user_number}{\"LASTNAME\"} $player_info{$user_number}{\"DOB\"}\$" . $base_cost . "\$$fundraiser_fee\$$player_adjustment-\$$discount\$$player_total\$$amount_paid\$$amount_due
TOTAL DUE: \$$total_cost
\n"; if($by_check != 1){ $user_table .= "\n"; #$partial_form = "\n"; $user_table .= ""; $user_table .= "\n"; $user_table .= "\n"; } $pay_pal .= "\n"; $pay_pal .= "\n"; #$pay_pal .= "\n"; #$pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "
 Credit Card Payment Optionsx
\n"; $pay_pal .= "

\n"; $pay_pal .= "
\n"; #$pay_pal .= "\n"; $pay_pal .= "\n"; if($by_check == 1){ $user_table .= "
In order to complete registration by check…

\n"; $user_table .= "  1. Please make the check payable to “LYAA” for the above amount.
\n"; $user_table .= "  2. Please mail the check to the following address…

\n"; $user_table .= "      LYAA
\n"; $user_table .= "      PO Box 296
\n"; $user_table .= "      Wauconda, IL 60084

\n"; $user_table .= "If you have any questions contact the board by leaving a message
at: (847) 604-0270.
\n"; $user_table .= "
\n"; #$partial_form = "\n"; $user_table .= ""; $user_table .= "\n"; $user_table .= "
\n
"; } return $user_table, $pay_pal; } sub get_pay_table{ my $user_key = shift; my $by_check = shift; my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my $pay_pal_count = 1; my $num_players = 0; my $total_cost = 0; if($by_check == 0){ $transaction_id = get_transaction_id(); } my $user_table = "\n"; $user_table .= "\n"; #$user_table .= "\n"; my $pay_pal = "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; #$pay_pal .= "\n"; foreach my $user_number (sort {$a <=> $b} (keys %player_info)){ $num_players++; my $base_cost = is_older_than_cutoff($player_info{$user_number}{"DOB"},$player_info{$user_number}{"GENDER"}); $division_id = $player_info{$user_number}{"DIVISION"}; $player_key = $player_info{$user_number}{"KEY"}; $amount_paid = $player_info{$user_number}{"PAID"}; $user_table .= "\n"; $user_table .= "\n"; if($num_players > 2){$fundraiser_fee = 0; $fundraiser_string = "";}else{$fundraiser_fee = 30; $fundraiser_string = "+ \$30 Fundraiser";} if($num_players > 1){$discount = 15; $discount_string = "-\$15 multiplayer discount";}else{$discount = 0;$discount_string = "";} $player_total = $base_cost + $fundraiser_fee - $discount; $amount_due = $player_total - $amount_paid; $registration_string = "\$$base_cost Registration Fee"; $user_table .= "\n"; $user_table .= "\n"; $user_table .= "\n"; #$amount_due = .02; if($by_check == 0){ insert_tmp_paypal($user_key, $player_key, $amount_due, $transaction_id); } $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal_count++; $total_cost = $amount_due + $total_cost; $paid = "No"; $user_table .= "\n"; } $user_table .= "\n"; $user_table .= "
Registered Players
NameRegistration FeeFundraiser FeeMulti-Player
Discount
TotalPaidDue
NameDivisionRegistration FeeFundraiser FeeDiscountTotalPaid
$player_info{$user_number}{\"FIRSTNAME\"} $player_info{$user_number}{\"LASTNAME\"} $player_info{$user_number}{\"DOB\"}\$" . $base_cost . "\$$fundraiser_fee-\$$discount\$$player_total\$$amount_paid\$$amount_due
TOTAL DUE: \$$total_cost
\n"; if($by_check != 1){ $user_table .= "\n"; #$partial_form = "\n"; $user_table .= ""; $user_table .= "\n"; $user_table .= "\n"; } $pay_pal .= "\n"; $pay_pal .= "\n"; #$pay_pal .= "\n"; #$pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "
 Credit Card Payment Optionsx
\n"; $pay_pal .= "

\n"; $pay_pal .= "
\n"; #$pay_pal .= "\n"; $pay_pal .= "\n"; if($by_check == 1){ $user_table .= "
In order to complete registration by check…

\n"; $user_table .= "  1. Please make the check payable to “LYAA” for the above amount.
\n"; $user_table .= "  2. Please mail the check to the following address…

\n"; $user_table .= "      LYAA
\n"; $user_table .= "      PO Box 296
\n"; $user_table .= "      Wauconda, IL 60084

\n"; $user_table .= "If you have any questions contact the board by leaving a message
at: (847) 604-0270.
\n"; $user_table .= "
\n"; #$partial_form = "\n"; $user_table .= ""; $user_table .= "\n"; $user_table .= "
\n
"; } return $user_table, $pay_pal; } sub get_amount_to_deduct{ my $partial = shift; my $total_remaining_players = shift; my $total_running_cost = shift; my $max_deduction = shift; my $player_min = shift; my $partial_remaining = $partial - $total_running_cost; my $deduction = 0; my $amount_to_deduct = 0; if($total_remaining_players > 0){ $amount_to_deduct = sprintf("%.0d", ($partial_remaining/$total_remaining_players)); $rounded_total = $amount_to_deduct * $total_remaining_players; if($rounded_total > $partial_remaining){ $deduction = $amount_to_deduct - ($rounded_total - $partial_remaining); }elsif($rounded_total < $partial){ $deduction = $amount_to_deduct + ($partial_remaining - $rounded_total); }else{ $deduction = $amount_to_deduct; } }else{ $deduction = 0; } print "ATD: $amount_to_deduct RT: $rounded_total PM: $partial_remaining - TMP: $total_remaining_players - D:$deduction - MAX:$max_deduction
\n"; ### If the deduction is greater than the max deduction set to max ### Also if the deduction is greater than max deduction, set it to max ### in order to lower the total. if(($deduction > $max_deduction)||($deduction >= $player_min)){ $deduction = $max_deduction; if($deduction > $partial_remaining){$deduction = $partial_remaining;} } if($deduction < 0){ $deduction = 0; } $deduction = sprintf("%0d", $deduction); return $deduction; } sub admin_get_partial_pay_table{ my $user_key = shift; my $by_check = shift; my $partial = shift; my ($total_num_players, $max_total_cost, $player_min) = get_num_players_and_total_cost($user_key); my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my $pay_pal_count = 1; my $num_players = 0; my $total_cost = 0; my $balance = 0; $transaction_id = get_transaction_id(); my $user_table = "\n"; $user_table .= "\n"; #$user_table .= "\n"; my $pay_pal = "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; #$pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; foreach my $user_number (sort {$a <=> $b} (keys %player_info)){ $num_players++; my $base_cost = is_older_than_cutoff($player_info{$user_number}{"DOB"},$player_info{$user_number}{"GENDER"}); $division_id = $player_info{$user_number}{"DIVISION"}; $player_key = $player_info{$user_number}{"KEY"}; $amount_paid = $player_info{$user_number}{"PAID"}; $user_table .= "\n"; $user_table .= "\n"; ($tmp_adjustment_info, $player_adjustment) = get_adjustment_info($player_info{$user_number}{"LASTNAME"}, $player_info{$user_number}{"FIRSTNAME"}, $player_info{$user_number}{"KEY"}); if($num_players > 2){$fundraiser_fee = 0; $fundraiser_string = "";}else{$fundraiser_fee = 30; $fundraiser_string = "+ \$30 Fundraiser";} if($num_players > 1){$discount = 15; $discount_string = "-\$15 multiplayer discount";}else{$discount = 0;$discount_string = "";} $player_total = $base_cost + $fundraiser_fee - $discount + $player_adjustment; $max_pay = $player_total - $amount_paid; my $amount_to_deduct = get_amount_to_deduct($partial, ($total_num_players - $num_players + 1), $total_cost, $max_pay, $player_min); $remaining_balance = $player_total - $amount_to_deduct - $amount_paid; $amount_due = $player_total - $amount_paid ; if($player_adjustment != 0){ $adjustment_string = "+ \$$player_adjustment Adjustment Fee"; }else{ $adjustment_string = ""; } #$amount_to_deduct = .02; insert_tmp_paypal($user_key, $player_key, $amount_to_deduct, $transaction_id); $registration_string = "\$$base_cost Registration Fee"; $user_table .= "\n"; $user_table .= "\n"; $user_table .= "\n"; $user_table .= "\n"; $user_table .= "\n"; $user_table .= "\n"; #$user_table .= "\n"; #$user_table .= "\n"; $balance = $balance + $amount_due; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal_count++; $total_cost = $amount_to_deduct + $total_cost; $paid = "No"; } $total_remaining = $balance - $total_cost; if($by_check == 2){ $user_table .= "\n"; $user_table .= "\n"; }else{ $user_table .= "\n"; } if($by_check != 1){ if($by_check == 2){ $user_table .= "\n"; $user_table .= "\n"; }else{ $user_table .= "\n"; } #$partial_form = "\n"; if($by_check == 2){ $this_action = "admin_partial"; }else{ $this_action = "admin_verify_partial"; } $user_table .= ""; $user_table .= "\n"; $user_table .= "\n"; } $user_table .= "
Registered Players
NameRegistration FeeFundraiser FeeAdjustmentsMulti-Player
Discount
TotalPaidDue
NameDivisionRegistration FeeFundraiser FeeDiscountTotalPaid
$player_info{$user_number}{\"FIRSTNAME\"} $player_info{$user_number}{\"LASTNAME\"} \$" . $base_cost . "\$$fundraiser_fee\$$player_adjustment-\$$discount\$$player_total-\$$amount_paid\$$amount_due-\$$amount_to_deduct\$$remaining_balance
Balance: \$$balance
TOTAL REMAINING After Payment: \$$total_remaining
Balance: \$$balance
Confirm Amount to Pay Now: \$$total_cost
Enter the Partial Amount You Want to Pay: \$
\n"; $pay_pal .= "\n"; #$pay_pal .= "\n"; if($by_check == 2){ $pay_pal .= "\n"; }else{ #$pay_pal .= "\n"; } #$pay_pal .= "
Make sure to Update the Payment before Paying with Credit Card
\n"; #$pay_pal .= "\n"; $pay_pal .= "
\n"; if($by_check == 1){ $user_table .= "
In order to complete registration by check…

\n"; $user_table .= "  1. Please make the check payable to “LYAA” for the above amount.
\n"; $user_table .= "  2. Please mail the check to the following address…

\n"; $user_table .= "      LYAA
\n"; $user_table .= "      PO Box 296
\n"; $user_table .= "      Wauconda, IL 60084

\n"; $user_table .= "If you have any questions contact the board by leaving a message
at: (847) 604-0270.\n"; } return $user_table, $pay_pal; } sub get_partial_pay_table{ my $user_key = shift; my $by_check = shift; my $partial = shift; my ($total_num_players, $max_total_cost, $player_min) = get_num_players_and_total_cost($user_key); my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my $pay_pal_count = 1; my $num_players = 0; my $total_cost = 0; my $balance = 0; $transaction_id = get_transaction_id(); my $user_table = "\n"; $user_table .= "\n"; #$user_table .= "\n"; my $pay_pal = "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; #$pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal .= "\n"; foreach my $user_number (sort {$a <=> $b} (keys %player_info)){ $num_players++; my $base_cost = is_older_than_cutoff($player_info{$user_number}{"DOB"},$player_info{$user_number}{"GENDER"}); $division_id = $player_info{$user_number}{"DIVISION"}; $player_key = $player_info{$user_number}{"KEY"}; $amount_paid = $player_info{$user_number}{"PAID"}; $user_table .= "\n"; $user_table .= "\n"; if($num_players > 2){$fundraiser_fee = 0; $fundraiser_string = "";}else{$fundraiser_fee = 30; $fundraiser_string = "+ \$30 Fundraiser";} if($num_players > 1){$discount = 15; $discount_string = "-\$15 multiplayer discount";}else{$discount = 0;$discount_string = "";} $player_total = $base_cost + $fundraiser_fee - $discount; $max_pay = $player_total - $amount_paid; my $amount_to_deduct = get_amount_to_deduct($partial, ($total_num_players - $num_players + 1), $total_cost, $max_pay, $player_min); $remaining_balance = $player_total - $amount_to_deduct - $amount_paid; $amount_due = $player_total - $amount_paid; #$amount_to_deduct = .02; insert_tmp_paypal($user_key, $player_key, $amount_to_deduct, $transaction_id); $registration_string = "\$$base_cost Registration Fee"; $user_table .= "\n"; $user_table .= "\n"; $user_table .= "\n"; $user_table .= "\n"; $user_table .= "\n"; #$user_table .= "\n"; #$user_table .= "\n"; $balance = $balance + $amount_due; $pay_pal .= "\n"; $pay_pal .= "\n"; $pay_pal_count++; $total_cost = $amount_to_deduct + $total_cost; $paid = "No"; } $total_remaining = $balance - $total_cost; if($by_check == 2){ $user_table .= "\n"; $user_table .= "\n"; }else{ $user_table .= "\n"; } if($by_check != 1){ if($by_check == 2){ $user_table .= "\n"; $user_table .= "\n"; }else{ $user_table .= "\n"; } #$partial_form = "\n"; if($by_check == 2){ $this_action = "partial"; }else{ $this_action = "verify_partial"; } $user_table .= ""; $user_table .= "\n"; $user_table .= "\n"; } $user_table .= "
Registered Players
NameRegistration FeeFundraiser FeeMulti-Player
Discount
TotalPaidDue
NameDivisionRegistration FeeFundraiser FeeDiscountTotalPaid
$player_info{$user_number}{\"FIRSTNAME\"} $player_info{$user_number}{\"LASTNAME\"} \$" . $base_cost . "\$$fundraiser_fee-\$$discount\$$player_total-\$$amount_paid\$$amount_due-\$$amount_to_deduct\$$remaining_balance
Balance: \$$balance
TOTAL REMAINING After Payment: \$$total_remaining
Balance: \$$balance
Confirm Amount to Pay Now: \$$total_cost
Enter the Partial Amount You Want to Pay: \$
\n"; $pay_pal .= "\n"; #$pay_pal .= "\n"; if($by_check == 2){ $pay_pal .= "\n"; }else{ #$pay_pal .= "\n"; } #$pay_pal .= "
Make sure to Update the Payment before Paying with Credit Card
\n"; #$pay_pal .= "\n"; $pay_pal .= "
\n"; if($by_check == 1){ $user_table .= "
In order to complete registration by check…

\n"; $user_table .= "  1. Please make the check payable to “LYAA” for the above amount.
\n"; $user_table .= "  2. Please mail the check to the following address…

\n"; $user_table .= "      LYAA
\n"; $user_table .= "      PO Box 296
\n"; $user_table .= "      Wauconda, IL 60084

\n"; $user_table .= "If you have any questions contact the board by leaving a message
at: (847) 604-0270.\n"; } return $user_table, $pay_pal; } sub get_num_players_and_total_cost{ my $user_key = shift; my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my $num_players = 0; my $total_cost = 0; my $player_min = 180; foreach my $user_number (sort {$a <=> $b} (keys %player_info)){ $num_players++; my $base_cost = is_older_than_cutoff($player_info{$user_number}{"DOB"},$player_info{$user_number}{"GENDER"}); if($num_players > 2){$fundraiser_fee = 0; $fundraiser_string = "";}else{$fundraiser_fee = 30; $fundraiser_string = "+ \$30 Fundraiser";} if($num_players > 1){$discount = 15; $discount_string = "-\$15 multiplayer discount";}else{$discount = 0;$discount_string = "";} $amount_paid = $player_info{$user_number}{"PAID"}; $player_total = $base_cost + $fundraiser_fee - $discount - $amount_paid; if($player_total < $player_min){if($player_total != 0){$player_min = $player_total;}} $total_cost = $player_total + $total_cost; } return $num_players, $total_cost, $player_min; } sub admin_print_verify_pay_partial{ $active_id{"pay"} = "id=current"; my $user_key = param('userkey'); my $partial = param('partial_amount'); my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my %division_selected = get_division_data(); my ($user_table, $pay_pal) = admin_get_partial_pay_table($user_key, 2, $partial); print_steps(); $verify_form = "
\n"; $verify_form .= ""; $verify_form .= "\n"; $verify_form .= "
\n"; $pay_by_check_form = "
\n"; $pay_by_check_form .= ""; $pay_by_check_form .= "\n"; $pay_by_check_form .= "
\n"; print "\n"; print "
Step 5:Verify Partial Payment
Please enter the partial payment amount you wish to pay below.

\n"; print "
\n"; print $user_table, "
"; print $verify_form; print $pay_by_check_form; print $pay_pal; print "
\n"; } sub print_verify_pay_partial{ $active_id{"pay"} = "id=current"; my $user_key = param('userkey'); my $partial = param('partial_amount'); my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my %division_selected = get_division_data(); my ($user_table, $pay_pal) = get_partial_pay_table($user_key, 2, $partial); print_steps(); $verify_form = "
\n"; $verify_form .= ""; $verify_form .= "\n"; $verify_form .= "
\n"; $pay_by_check_form = "
\n"; $pay_by_check_form .= ""; $pay_by_check_form .= "\n"; $pay_by_check_form .= "
\n"; print "\n"; print "
Step 5:Verify Partial Payment
Please enter the partial payment amount you wish to pay below.

\n"; print "
\n"; print $user_table, "
"; print $verify_form; print $pay_by_check_form; print $pay_pal; print "
\n"; } sub admin_print_pay_partial{ $active_id{"pay"} = "id=current"; my $user_key = param('userkey'); my $partial = param('partial_amount'); my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my %division_selected = get_division_data(); my ($user_table, $pay_pal) = admin_get_partial_pay_table($user_key, 0, $partial); print_steps(); $verify_form = "
\n"; $verify_form .= ""; $verify_form .= "\n"; $verify_form .= "
\n"; $pay_by_check_form = "
\n"; $pay_by_check_form .= ""; $pay_by_check_form .= "\n"; $pay_by_check_form .= "
\n"; print "\n"; print "
Step 5: Enter Partial Payment Amount
Please enter the partial payment amount you wish to pay below.

\n"; print "
\n"; print $user_table, "
"; print $verify_form; print $pay_by_check_form; print $pay_pal; print "
\n"; } sub print_pay_partial{ $active_id{"pay"} = "id=current"; my $user_key = param('userkey'); my $partial = param('partial_amount'); my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my %division_selected = get_division_data(); my ($user_table, $pay_pal) = get_partial_pay_table($user_key, 0, $partial); print_steps(); $verify_form = "
\n"; $verify_form .= ""; $verify_form .= "\n"; $verify_form .= "
\n"; $pay_by_check_form = "
\n"; $pay_by_check_form .= ""; $pay_by_check_form .= "\n"; $pay_by_check_form .= "
\n"; print "\n"; print "
Step 5: Enter Partial Payment Amount
Please enter the partial payment amount you wish to pay below.

\n"; print "
\n"; print $user_table, "
"; print $verify_form; print $pay_by_check_form; print $pay_pal; print "
\n"; } sub print_pay{ $active_id{"pay"} = "id=current"; my $user_key = param('userkey'); my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my %division_selected = get_division_data(); my ($user_table, $pay_pal) = get_pay_table($user_key, 0); print_steps(); $full_or_partial = <<__JSCRIPT__; __JSCRIPT__ $verify_form = "
\n"; $verify_form .= ""; $verify_form .= "\n"; $verify_form .= "
\n"; $pay_by_check_form = "
\n"; $pay_by_check_form .= ""; $pay_by_check_form .= "\n"; $pay_by_check_form .= "
\n"; print "$full_or_partial
\n"; print "

Step 5:Verify Order
Please verify your registration prior to checkout.

\n"; print $user_table, "
"; print $verify_form; print $pay_by_check_form; print $pay_pal; print "
\n"; } sub admin_print_pay{ $active_id{"pay"} = "id=current"; my $user_key = param('userkey'); my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my %division_selected = get_division_data(); my ($user_table, $pay_pal) = admin_get_pay_table($user_key, 0); print_steps(); $full_or_partial = <<__JSCRIPT__; __JSCRIPT__ $verify_form = "
\n"; $verify_form .= ""; $verify_form .= "\n"; $verify_form .= "
\n"; $pay_by_check_form = "
\n"; $pay_by_check_form .= ""; $pay_by_check_form .= "\n"; $pay_by_check_form .= "
\n"; print "$full_or_partial
\n"; print "

Step 5:Verify Order
Please verify your registration prior to checkout.

\n"; print $user_table, "
"; print $verify_form; print $pay_by_check_form; print $pay_pal; print "
\n"; } sub get_db_date_format{ my $date = shift; my($month, $day, $year) = split(/\//,$date); $date = "$year-$month-$day"; return $date; } sub get_view_date_format{ my $date = shift; my($year, $month, $day) = split(/-/,$date); $date = "$month/$day/$year"; return $date; } sub remove_player{ my $player_key = shift; my $query = "UPDATE Account_Player_Info SET `Active` = '0' WHERE `Key` = '$player_key';"; #print "$query
\n"; my $dbh = get_dbh(); my $sth = $dbh->prepare($query); $sth->execute(); $sth->finish(); $dbh->disconnect; return $player_key; } ################################### # Get parameter for DB ################################### sub get_param{ my $paramter = shift; my $value = param($paramter); $value =~ s/\'/''/g; $value =~ s/\"//g; $value =~ s/\\//g; return $value; } ################################################################ ### Update player in db ################################################################ sub update_player{ $lname = get_param('lname'); $fname = get_param('fname'); $division = param('division'); $shirt_size = ""; #param(shirt_size); $pant_size = ""; #param(pant_size); $hat_size = ""; #param(hat_size); $shoe_size = ""; #param(shoe_size); $jersey = ""; #param(jersey); $age = ""; #param(age); $height = ""; #param(height); $weight = ""; #param(weight); $dob = param(dob); $gender = param(gender); $sname = get_param(sname); $grade = param(grade); $econtact = get_param(econtact); $ephone = get_param(ephone); $esphone = get_param(esphone); $erel = param(erel); $gcontact = get_param(gcontact); $gphone = get_param(gphone); $gsphone = get_param(gsphone); $grel = param(grel); $ogcontact = get_param(ogcontact); $ogphone = get_param(ogphone); $ogsphone = get_param(ogsphone); $ogrel = param(ogrel); $doctor = get_param(doctor); $dphone = get_param(dphone); $dentist = get_param(dentist); $dephone = get_param(dephone); $hospital = get_param(hospital); $insurance = get_param(insurance); $policy = get_param(policy); $history = get_param(history); $user_key = param(userkey); $player_key = param(playerkey); $returning = param(returning); $consent = param(consent); $actionsto = get_param(actionsto); $playup = param(playup); if($playup eq "on"){ $playup = "Yes"; }else{ $playup = "No"; } #`Hat_Size` = '$hat_size', Removed Hat Size because its the date $dob = get_db_date_format($dob); my $query = "UPDATE Account_Player_Info SET `Play_Up`='$playup', `Consent`= '$consent',`Consent_Actions`= '$actionsto',`Returning_Player`= '$returning', `Firstname` = '$fname', `Lastname` = '$lname', `Division_Pref` = '$division', `Shirt_Size` = '$shirt_size', `Pant_Size` = '$pant_size', `Shoe_Size` = '$shoe_size', `Jersey_Pref` = '$jersey', `DOB` = '$dob', `Gender` = '$gender', `School_Name` = '$sname', `Grade` = '$grade', `Age` = '$age', `Height` = '$height', `Weight` = '$weight', `E_Contact_Phone` = '$ephone', `E_Contact_SPhone` = '$esphone', `E_Contact_Name` = '$econtact', `E_Contact_Relationship` = '$erel', `G_Contact_Phone` = '$gphone', `G_Contact_SPhone` = '$gsphone', `G_Contact_Name` = '$gcontact', `G_Contact_Relationship` = '$grel', `OG_Contact_Phone` = '$ogphone', `OG_Contact_SPhone` = '$ogsphone', `OG_Contact_Name` = '$ogcontact', `OG_Contact_Relationship` = '$ogrel', `Preferred_Doc_Name` = '$doctor', `Preferred_Doc_Number` = '$dphone', `Preferred_Dentist_Name` = '$dentist', `Preferred_Dentist_Number` = '$dephone', `Preferred_Hospital` = '$hospital', `Insurance_Carrier` = '$insurance', `Policy_Number` = '$policy', `Medical_History` = '$history' WHERE `Key` = '$player_key';"; #print "$query
\n"; my $dbh = get_dbh(); my $sth = $dbh->prepare($query); $sth->execute(); $sth->finish(); $dbh->disconnect; return $player_key; } ################################################################ ### Create new player in db ################################################################ sub create_new_player{ $lname = get_param('lname'); $fname = get_param('fname'); $division = param(division); $shirt_size = ""; #param(shirt_size); $pant_size = ""; #param(pant_size); $hat_size = get_db_date(); #param(hat_size); CURRENTLY USING HAT SIZE FOR DATE.:) $shoe_size = ""; #param(shoe_size); $jersey = ""; #param(jersey); $age = ""; #param(age); $height = ""; #param(height); $weight = ""; #param(weight); $dob = param(dob); $gender = param(gender); $sname = get_param(sname); $grade = param(grade); $econtact = get_param(econtact); $ephone = get_param(ephone); $esphone = get_param(esphone); $erel = param(erel); $gcontact = get_param(gcontact); $gphone = get_param(gphone); $gsphone = get_param(gsphone); $grel = param(grel); $ogcontact = get_param(ogcontact); $ogphone = get_param(ogphone); $ogsphone = get_param(ogsphone); $ogrel = param(ogrel); $doctor = get_param(doctor); $dphone = get_param(dphone); $dentist = get_param(dentist); $dephone = get_param(dephone); $hospital = get_param(hospital); $insurance = get_param(insurance); $policy = get_param(policy); $history = get_param(history); $user_key = param(userkey); $returning = param(returning); $consent = param(consent); $actionsto = get_param(actionsto); my $first_player = 1; $playup = param(playup); if($playup eq "on"){ $playup = "Yes"; }else{ $playup = "No"; } $dob = get_db_date_format($dob); $height =~ s/\"/ /g; $height =~ s/\'/ /g; $first_player = check_for_first_player_for_user($user_key); my $query = "INSERT INTO Account_Player_Info (`Key`, `Account_ID`, `Firstname`, `Lastname`, `Division_Pref`, `Shirt_Size`, `Pant_Size`, `Hat_Size`, `Shoe_Size`, `Jersey_Pref`, `DOB`, `Gender`, `School_Name`, `Grade`, `Age`, `Height`, `Weight`, `E_Contact_Name`, `E_Contact_Phone`, `E_Contact_SPhone`, `E_Contact_Relationship`, `G_Contact_Name`, `G_Contact_Phone`, `G_Contact_SPhone`, `G_Contact_Relationship`, `OG_Contact_Name`, `OG_Contact_Phone`, `OG_Contact_SPhone`, `OG_Contact_Relationship`, `Preferred_Doc_Name`, `Preferred_Doc_Number`, `Preferred_Dentist_Name`, `Preferred_Dentist_Number`, `Preferred_Hospital`, `Insurance_Carrier`, `Policy_Number`, `Medical_History`, `Returning_Player`, `Paid`, `Active`, `Consent`, `Consent_Actions`, `Play_Up`) VALUES ('','$user_key', '$fname', '$lname', '$division', '$shirt_size', '$pant_size', '$hat_size', '$shoe_size', '$jersey', '$dob', '$gender', '$sname', '$grade', '$age', '$height', '$weight', '$econtact', '$ephone', '$esphone', '$erel', '$gcontact', '$gphone', '$gsphone', '$grel', '$ogcontact', '$ogphone', '$ogsphone', '$ogrel', '$doctor', '$dphone', '$dentist', '$dephone', '$hospital', '$insurance', '$policy', '$history', '$returning', '0', '1', '$consent', '$actionsto', '$playup');"; #print "$query
\n"; my $dbh = get_dbh(); my $sth = $dbh->prepare($query); $sth->execute(); ######################################### # Get the ID of the just inserted event ######################################### my $query2 = "SELECT LAST_INSERT_ID( );"; $sth = $dbh->prepare($query2); $sth->execute(); # assign fields to variables $sth->bind_columns(\$last_insert_id); while($sth->fetch()) { $user_id = $last_insert_id; } $sth->finish(); $dbh->disconnect; ######################################### # Add walk in fee if active and first player # for user. ######################################### if(($walk_in == 1)&&($first_player == 1)){ insert_walkin_adjustment($user_id, 25); } return $user_id; } sub get_player_id_from_cookie{ my $session_id = get_cookie(); my $login = get_login_from_session($session_id); return $login; } ################################################################ ### Update adjustemnt ################################################################ sub insert_walkin_adjustment{ my $player_key = shift; my $amount = shift; my $check_notes = "Walk In"; my $update_account = get_player_id_from_cookie(); my $account_id = get_account_id_by_player_key($player_key); my $date = get_date_time(); my $query = "INSERT INTO Reg_Manual_Adjustment ( `Key` , `Account_ID` , `Player_ID` , `Update_Account_ID`, `Amount`, `Check_ID`, `Date`) VALUES ('', '$account_id', '$player_key', '$update_account', '$amount', '$check_notes', '$date')"; #print "$query
\n"; my $dbh = get_dbh(); my $sth = $dbh->prepare($query); $sth->execute(); $sth->finish(); $dbh->disconnect; return $player_key; } sub check_for_first_player_for_user{ my $user_key = shift; my $dbh = get_dbh(); my $query = "SELECT `Key` FROM `Account_Player_Info` WHERE `Account_ID` = '$user_key'"; #print "$query
\n"; my $sth = $dbh->prepare($query); my $first_player = 1; $sth->execute(); $sth->bind_columns(\$Key); ################################################################ # Loop through what the db returned, if there is somthing there # it assumes success. ################################################################ while($sth->fetch()) { $first_player = 0; } return $first_player; } ################################################################ ### Update user info in db ################################################################ sub admin_update_account{ $lname = get_param(lname); $fname = get_param(fname); $email = param(user_email); $ad1 = get_param(ad1); $ad2 = get_param(ad2); $city = get_param(city); $state = param(state); $zip = param(zip); $phone = get_param(phone); $mphone = get_param(mphone); my $dbh = get_dbh(); my $query = "UPDATE `Account_Info` a, `Account_Extra_Info` b SET a.`Firstname`='$fname', a.`Lastname`='$lname', a.`Home_Phone`='$phone', a.`Mobile_Phone`='$mphone', a.`Zip_Code`='$zip', b.`Address1`='$ad1' , b.`Address2`='$ad2' , b.`City`='$city', b.`State`='$state' WHERE a.`email`='$email' AND a.`Key` = b.`Account_ID`;"; #print "Q: $query
\n"; my $sth = $dbh->prepare($query); $sth->execute(); $sth->finish(); $dbh->disconnect; return $email; } ################################################################ ### Update user info in db ################################################################ sub update_account{ $lname = get_param(lname); $fname = get_param(fname); $email = param(email); $ad1 = get_param(ad1); $ad2 = get_param(ad2); $city = get_param(city); $state = param(state); $zip = param(zip); $phone = get_param(phone); $mphone = get_param(mphone); my $dbh = get_dbh(); my $query = "UPDATE `Account_Info` a, `Account_Extra_Info` b SET a.`Firstname`='$fname', a.`Lastname`='$lname', a.`Home_Phone`='$phone', a.`Mobile_Phone`='$mphone', a.`Zip_Code`='$zip', b.`Address1`='$ad1' , b.`Address2`='$ad2' , b.`City`='$city', b.`State`='$state' WHERE a.`email`='$email' AND a.`Key` = b.`Account_ID`;"; #print "Q: $query
\n"; my $sth = $dbh->prepare($query); $sth->execute(); $sth->finish(); $dbh->disconnect; return $email; } ################################################################ ### Print verify user registration ################################################################ sub admin_print_verify_account_info{ my $email = shift; my %user_info = get_account_info_by_email($email); $active_id{"create"} = "id=current"; print "
\n"; #print_steps(); print_reg_style(); print "
\n"; my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; my $html = <<__HTML__;
Step 2: Verify Account Owner Information
Please verify your account information for the primary person responsible for payment and under whom the participants will be listed.

Account Holder Information
First Name  $user_info{"FIRSTNAME"}
Last Name  $user_info{"LASTNAME"}
Email  $user_info{"EMAIL"}
Address 1  $user_info{"ADDRESS1"}
Address 2  $user_info{"ADDRESS2"}
City  $user_info{"CITY"}
State  $user_info{"STATE"}
Zip  $user_info{"ZIP_CODE"}
Phone  $user_info{"HOMEPHONE"}
Mobile Phone  $user_info{"MOBILE_PHONE"}

The above information is correct...

The above information is not correct...
__HTML__ print $html; } ################################################################ ### Print verify user registration ################################################################ sub print_verify_account_info{ my $email = shift; my %user_info = get_account_info_by_email($email); $active_id{"create"} = "id=current"; print_steps(); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; my $html = <<__HTML__;
Step 2: Verify Account Owner Information
Please verify your account information for the primary person responsible for payment and under whom the participants will be listed.

Account Holder Information
First Name  $user_info{"FIRSTNAME"}
Last Name  $user_info{"LASTNAME"}
Email  $user_info{"EMAIL"}
Address 1  $user_info{"ADDRESS1"}
Address 2  $user_info{"ADDRESS2"}
City  $user_info{"CITY"}
State  $user_info{"STATE"}
Zip  $user_info{"ZIP_CODE"}
Phone  $user_info{"HOMEPHONE"}
Mobile Phone  $user_info{"MOBILE_PHONE"}

The above information is correct...

The above information is not correct...
__HTML__ print $html; } ################################################################ ### ADMIN Print verify Player registration ################################################################ sub admin_print_verify_register_programs{ my $player_key = shift; my $user_key = param(userkey); #my %user_info = get_account_info($user_key); my %player_info = get_player_info_by_key($player_key); $active_id{"verify"} = "id=current"; my %division_selected = get_division_data(); my %shirt_size_selected = get_shirt_size_data(); my %pant_size_selected = get_pant_size_data(); print_steps(); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; my $html = <<__HTML__;

Step 4:Verify Program Registration
Please verify the player information listed below.

Player Information
Player First Name:$player_info{"FIRSTNAME"}
Player Last Name:$player_info{"LASTNAME"}
Date of Birth:$player_info{"DOB"}
Gender:$player_info{"GENDER"}
School Name:$player_info{"SNAME"}
Current Grade Level:$player_info{"GRADE"}
Returning Player:$player_info{"RETURNING"}
Request this Player to play up a League:$player_info{"PLAY_UP"}
Guardian Information
Guardian 1 Name:$player_info{"G_CONTACT_NAME"}
Guardian 1 Primary Phone:$player_info{"G_CONTACT_PHONE"}
Guardian 1 Secondary Phone:$player_info{"G_CONTACT_SPHONE"}
Guardian 1 Relationship:$player_info{"G_CONTACT_REL"}
Guardian 2 Name:$player_info{"OG_CONTACT_NAME"}
Guardian 2 Primary Phone:$player_info{"OG_CONTACT_PHONE"}
Guardian 2 Secondary Phone:$player_info{"OG_CONTACT_SPHONE"}
Guardian 2 Relationship:$player_info{"OG_CONTACT_REL"}
Emergency Contact Information
Emergency Contact Name:$player_info{"E_CONTACT_NAME"}
Emergency Contact Primary Phone:$player_info{"E_CONTACT_PHONE"}
Emergency Contact Secondary Phone:$player_info{"E_CONTACT_SPHONE"}
Emergency Contact Relationship:$player_info{"E_CONTACT_REL"}
Medical Information
Preferred Doctor Name:$player_info{"PREF_DOC_NAME"}
Preferred Doctor Phone:$player_info{"PREF_DOC_NUMB"}
Preferred Dentist Name:$player_info{"PREF_DENT_NAME"}
Preferred Dentist Phone:$player_info{"PREF_DENT_NUMB"}
Preferred Hospital:$player_info{"PREF_HOSPITAL"}
Insurance Carrier:$player_info{"INSURANCE"}
Policy Number:$player_info{"POLICY"}
Medical History:
Allergies, Medications,
Special Condition, etc
$player_info{"MEDICAL"}
GRANT OF CONSENT
GRANT OF CONSENT:$player_info{"CONSENT"}
Actions to be taken:$player_info{"ACTIONSTO"}

The above information is correct...

The above information is not correct...
__HTML__ print $html; } ################################################################ ### Print verify Player registration ################################################################ sub print_verify_register_programs{ my $player_key = shift; my $user_key = param(userkey); #my %user_info = get_account_info($user_key); my %player_info = get_player_info_by_key($player_key); $active_id{"verify"} = "id=current"; my %division_selected = get_division_data(); my %shirt_size_selected = get_shirt_size_data(); my %pant_size_selected = get_pant_size_data(); print_steps(); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; my $html = <<__HTML__;

Step 4:Verify Program Registration
Please verify the player information listed below.

Player Information
Player First Name:$player_info{"FIRSTNAME"}
Player Last Name:$player_info{"LASTNAME"}
Date of Birth:$player_info{"DOB"}
Gender:$player_info{"GENDER"}
School Name:$player_info{"SNAME"}
Current Grade Level:$player_info{"GRADE"}
Returning Player:$player_info{"RETURNING"}
Request this Player to play up a League:$player_info{"PLAY_UP"}
Guardian Information
Guardian 1 Name:$player_info{"G_CONTACT_NAME"}
Guardian 1 Primary Phone:$player_info{"G_CONTACT_PHONE"}
Guardian 1 Secondary Phone:$player_info{"G_CONTACT_SPHONE"}
Guardian 1 Relationship:$player_info{"G_CONTACT_REL"}
Guardian 2 Name:$player_info{"OG_CONTACT_NAME"}
Guardian 2 Primary Phone:$player_info{"OG_CONTACT_PHONE"}
Guardian 2 Secondary Phone:$player_info{"OG_CONTACT_SPHONE"}
Guardian 2 Relationship:$player_info{"OG_CONTACT_REL"}
Emergency Contact Information
Emergency Contact Name:$player_info{"E_CONTACT_NAME"}
Emergency Contact Primary Phone:$player_info{"E_CONTACT_PHONE"}
Emergency Contact Secondary Phone:$player_info{"E_CONTACT_SPHONE"}
Emergency Contact Relationship:$player_info{"E_CONTACT_REL"}
Medical Information
Preferred Doctor Name:$player_info{"PREF_DOC_NAME"}
Preferred Doctor Phone:$player_info{"PREF_DOC_NUMB"}
Preferred Dentist Name:$player_info{"PREF_DENT_NAME"}
Preferred Dentist Phone:$player_info{"PREF_DENT_NUMB"}
Preferred Hospital:$player_info{"PREF_HOSPITAL"}
Insurance Carrier:$player_info{"INSURANCE"}
Policy Number:$player_info{"POLICY"}
Medical History:
Allergies, Medications,
Special Condition, etc
$player_info{"MEDICAL"}
GRANT OF CONSENT
GRANT OF CONSENT:$player_info{"CONSENT"}
Actions to be taken:$player_info{"ACTIONSTO"}

The above information is correct...

The above information is not correct...
__HTML__ print $html; } sub get_grades{ my @grades = ("K",1,2,3,4,5,6,7,8,9,10,11,12); return @grades; } sub get_relationships{ my @relationships = ("Father", "Mother", "Legal Guardian", "Grandparent", "Other"); return @relationships; } ################################################################ ### Get the HTML user table show in upper left corner ################################################################ sub get_account_table{ my $user_key = shift; my %user_info = get_account_info($user_key); my $return_html = <<__HTML__;
Account Owner
$user_info{"FIRSTNAME"} $user_info{"LASTNAME"}
$user_info{"EMAIL"}
$user_info{"ADDRESS1"}
$user_info{"ADDRESS2"}
$user_info{"CITY"}, $user_info{"STATE"} $user_info{"ZIP_CODE"}
__HTML__ return $return_html; } ################################################################ ### Get the HTML player table show in upper right corner ################################################################ sub get_player_table{ my $user_key = shift; my %player_info = get_player_info($user_key); my $user_table = "\n"; #$user_table .= "\n"; $user_table .= "\n"; my $player_number = 1; foreach my $user_number (sort {$a <=> $b} (keys %player_info)){ $player_number++; $division_id = $player_info{$user_number}{"DIVISION"}; $player_key = $player_info{$user_number}{"KEY"}; $amount_paid = $player_info{$user_number}{"PAID"}; $user_table .= "\n"; $user_table .= "\n"; $user_table .= "\n"; if($player_info{$user_number}{"PAID"} == 1){ $paid = "Yes"; }else{ $paid = "No"; } $user_table .= "\n"; $last_user = $user_number; } $user_table .= "
Registered Players
NameDivisioneditremovePaid
NameEditRemovePaid
$player_info{$user_number}{\"FIRSTNAME\"} $player_info{$user_number}{\"LASTNAME\"}\$$amount_paid
\n"; return $user_table, $player_number; } ################################################################ ### Print Player registration form ################################################################ sub admin_print_register_programs{ my $user_key = shift; my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my %division_selected = get_division_data(); my @grades = get_grades(); my @relationships = get_relationships(); my $account_table = get_account_table($user_key); my ($user_table, $player_number) = get_player_table($user_key); $active_id{"register"} = "id=current"; print "
\n"; #print_steps(); print_reg_style(); print "
\n"; #print "
\n"; my $phone_validation = get_phone_validation(); $submit_to_pay = get_admin_submit_to_pay($user_key); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; if($user_info{"ADDRESS2"} ne ""){ $address2 = "$user_info{\"ADDRESS2\"}
"; }else{ $address2 = ""; } my $html = <<__HTML__;
$account_table $user_table
$submit_to_pay

Step 3:Register for Programs
Please complete the information listed below...
    * Required Fields
Player #$player_number
Player First Name*
Player Last Name*
Date of Birth*
Gender* Male Female
School Name
Current Grade Level*
Returning Player* Yes No
Request this Player to play up a League
Guardian Information
Guardian 1 Name*
Guardian 1 Primary Phone* $phone_example
Guardian 1 Secondary Phone $phone_example
Guardian 1 Relationship*
Guardian 2 Name
Guardian 2 Primary Phone $phone_example
Guardian 2 Secondary Phone $phone_example
Guardian 2 Relationship
Emergency Contact Information
Emergency Contact Name*
Emergency Contact Primary Phone* $phone_example
Emergency Contact Secondary Phone $phone_example
Emergency Contact Relationship*
Medical Information
Preferred Doctor Name
Preferred Doctor Phone $phone_example
Preferred Dentist Name
Preferred Dentist Phone $phone_example
Preferred Hospital
Insurance Carrier
Policy Number
Medical History:
Allergies, Medications,
Special Condition, etc
GRANT OF CONSENT * (please select one for the player listed above)
GRANT OF CONSENT: In the event reasonable attempts to contact the parents or guardians have been unsuccessful, I hereby give my consent for
(1) the administration of any treatment deemed necessary by preferred Dr.
(2), or preferred Dentists or in the event designated Dr. or Dentist is not available, by another licensed physician or dentist; and
(2) the transfer of the child to preferred hospital or any hospital reasonably accessible. NOTE: This authorization does not cover major surgery unless the medical options of two other licensed physicians or dentists, concurring in necessity for such surgery are obtained BEFORE the surgery IS PERFORMED.

REFUSAL OF CONSENT: I do NOT give consent for emergency medical treatment of my child. In the event of illness or injury requiring emergency treatment, I wish that Lakes Youth Athletic Association to take no action, or perform the following actions.
Actions to be taken:


* Required Fields
__HTML__ print $html; } ################################################################ ### Print Player registration form ################################################################ sub print_register_programs{ my $user_key = shift; my %user_info = get_account_info($user_key); my %player_info = get_player_info($user_key); my %division_selected = get_division_data(); my @grades = get_grades(); my @relationships = get_relationships(); my $account_table = get_account_table($user_key); my ($user_table, $player_number) = get_player_table($user_key); $active_id{"register"} = "id=current"; print_steps(); #print "
\n"; my $phone_validation = get_phone_validation(); $submit_to_pay = get_submit_to_pay($user_key); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; if($user_info{"ADDRESS2"} ne ""){ $address2 = "$user_info{\"ADDRESS2\"}
"; }else{ $address2 = ""; } my $html = <<__HTML__;
$account_table $user_table
$submit_to_pay

Step 3:Register for Programs
Please complete the information listed below...
    * Required Fields
Player #$player_number
Player First Name*
Player Last Name*
Date of Birth*
Gender* Male Female
School Name
Current Grade Level*
Returning Player* Yes No
Request this Player to play up a League
Guardian Information
Guardian 1 Name*
Guardian 1 Primary Phone* $phone_example
Guardian 1 Secondary Phone $phone_example
Guardian 1 Relationship*
Guardian 2 Name
Guardian 2 Primary Phone $phone_example
Guardian 2 Secondary Phone $phone_example
Guardian 2 Relationship
Emergency Contact Information
Emergency Contact Name*
Emergency Contact Primary Phone* $phone_example
Emergency Contact Secondary Phone $phone_example
Emergency Contact Relationship*
Medical Information
Preferred Doctor Name
Preferred Doctor Phone $phone_example
Preferred Dentist Name
Preferred Dentist Phone $phone_example
Preferred Hospital
Insurance Carrier
Policy Number
Medical History:
Allergies, Medications,
Special Condition, etc
GRANT OF CONSENT * (please select one for the player listed above)
GRANT OF CONSENT: In the event reasonable attempts to contact the parents or guardians have been unsuccessful, I hereby give my consent for
(1) the administration of any treatment deemed necessary by preferred Dr.
(2), or preferred Dentists or in the event designated Dr. or Dentist is not available, by another licensed physician or dentist; and
(2) the transfer of the child to preferred hospital or any hospital reasonably accessible. NOTE: This authorization does not cover major surgery unless the medical options of two other licensed physicians or dentists, concurring in necessity for such surgery are obtained BEFORE the surgery IS PERFORMED.

REFUSAL OF CONSENT: I do NOT give consent for emergency medical treatment of my child. In the event of illness or injury requiring emergency treatment, I wish that Lakes Youth Athletic Association to take no action, or perform the following actions.
Actions to be taken:


* Required Fields
__HTML__ print $html; } sub get_submit_to_pay{ my $user_key = shift; my $return_val = <<__HTML__;
Register additional players below or
proceed to
__HTML__ return $return_val; } sub get_admin_submit_to_pay{ my $user_key = shift; my $return_val = <<__HTML__;
Register additional players below or
proceed to
__HTML__ return $return_val; } ################################################################ ### Creates new user account in db ################################################################ sub admin_createaccount{ $lname = get_param(lname); $fname = get_param(fname); $email = get_param(user_email); $ad1 = get_param(ad1); $ad2 = get_param(ad2); $city = get_param(city); $state = param(state); $zip = get_param(zip); $phone = get_param(phone); $mphone = get_param(mphone); $pw1 = get_param(pw1); $pw2 = get_param(pw2); my $dbh = get_dbh(); my $query = "INSERT INTO `Account_Info` ( `Key` , `Login` , `Password` , `email` , `League_ID`, `Last_Access`, `Last_Access_ID`, `Firstname`, `Lastname`, `Title`, `Home_Phone`, `Work_Phone`, `Mobile_Phone`, `Zip_Code`) VALUES ('', '$email', '$pw1', '$email', '', '', '', '$fname', '$lname', 'USER', '$phone', '', '$mphone', '$zip');"; my $sth = $dbh->prepare($query); $sth->execute(); $sth->finish(); $dbh->disconnect; my $new_key = check_for_account($email); ########################################### # Add extra Info ########################################### $dbh = get_dbh(); my $query2 = "INSERT INTO `Account_Extra_Info` ( `Key` , `Account_ID` , `Address1` , `Address2` , `City`, `State`)VALUES ('', '$new_key', '$ad1', '$ad2', '$city', '$state');"; #print "Q2:$query2
\n"; $sth = $dbh->prepare($query2); $sth->execute(); $sth->finish(); ########################################### # Link Account to Org ########################################### $dbh = get_dbh(); my $query3 = "INSERT INTO `Account_Org_Reg_Link` ( `Key` , `Account_ID` , `Org_ID`)VALUES ('', '$new_key', '$org_id');"; #print "Q2:$query2
\n"; $sth = $dbh->prepare($query3); $sth->execute(); $sth->finish(); $dbh->disconnect; #check_reg_login($email, "$pw1"); #remove_temp_password($email); return $new_key; } ################################################################ ### Creates new user account in db ################################################################ sub createaccount{ $lname = get_param(lname); $fname = get_param(fname); $email = get_param(email); $ad1 = get_param(ad1); $ad2 = get_param(ad2); $city = get_param(city); $state = param(state); $zip = get_param(zip); $phone = get_param(phone); $mphone = get_param(mphone); $pw1 = get_param(pw1); $pw2 = get_param(pw2); my $dbh = get_dbh(); my $query = "INSERT INTO `Account_Info` ( `Key` , `Login` , `Password` , `email` , `League_ID`, `Last_Access`, `Last_Access_ID`, `Firstname`, `Lastname`, `Title`, `Home_Phone`, `Work_Phone`, `Mobile_Phone`, `Zip_Code`) VALUES ('', '$email', '$pw1', '$email', '', '', '', '$fname', '$lname', 'USER', '$phone', '', '$mphone', '$zip');"; my $sth = $dbh->prepare($query); $sth->execute(); $sth->finish(); $dbh->disconnect; my $new_key = check_for_account($email); ########################################### # Add extra Info ########################################### $dbh = get_dbh(); my $query2 = "INSERT INTO `Account_Extra_Info` ( `Key` , `Account_ID` , `Address1` , `Address2` , `City`, `State`)VALUES ('', '$new_key', '$ad1', '$ad2', '$city', '$state');"; #print "Q2:$query2
\n"; $sth = $dbh->prepare($query2); $sth->execute(); $sth->finish(); ########################################### # Link Account to Org ########################################### $dbh = get_dbh(); my $query3 = "INSERT INTO `Account_Org_Reg_Link` ( `Key` , `Account_ID` , `Org_ID`)VALUES ('', '$new_key', '$org_id');"; #print "Q2:$query2
\n"; $sth = $dbh->prepare($query3); $sth->execute(); $sth->finish(); $dbh->disconnect; check_reg_login($email, "$pw1"); remove_temp_password($email); return $new_key; } ################################################################ ### Remove Temp Password from db ################################################################ sub remove_temp_password{ my $email = shift; ########################################### # Link Account to Org ########################################### my $dbh = get_dbh(); my $query = "DELETE FROM `Account_TMP_Password` WHERE `EMAIL`='$email' LIMIT 1;"; #print "Q2:$query2
\n"; my $sth = $dbh->prepare($query); $sth->execute(); $sth->finish(); $dbh->disconnect; } ################################################################ ### Check to see if the user is logged in ################################################################ sub check_reg_login{ my $user = shift; my $pass = shift; my $league_id = shift; my $success = 0; my $session = ""; my $session_id = get_cookie(); if(($user ne "") && ($pass ne "")){ $session_id = ""; } my $dbh = get_dbh(); ################################################################ # Check to see if there is a valid cookie ################################################################ if($session_id eq ""){ ################################################################ # If not a valid cookie, check the to see if the user/pass # combination is correct ################################################################ if(($user ne "") && ($pass ne "")){ print "\n"; $session_id = ""; my $query = "SELECT * FROM `Account_Info` WHERE (`Login` = '$user' OR `email` = '$user') AND `Password` = '$pass'"; my $sth = $dbh->prepare($query); $sth->execute(); $sth->bind_columns(\$Key, \$Login, \$Password, \$email, \$League_ID, \$Last_Access, \$Last_Access_ID, \$Firstname, \$Lastname, \$Title, \$Home_Phone, \$Work_Phone, \$Zip_Code); ################################################################ # Loop through what the db returned, if there is somthing there # it assumes success. ################################################################ while($sth->fetch()) { $success = 1; } ################################################################ # Login failed because incorrect Login or password ################################################################ if($success == 0){ print "

Invalid ID or Password.
Please try again.
\n"; $session_id = ""; #print "\n"; }else{ $current_date = get_date_time(); $session_id = generate_random_string(15); $update = "UPDATE `Account_Info` SET `Last_Access`='$current_date', `Last_Access_ID`='$session_id' WHERE `Key` = $Key;"; ##print "QUERY: $update
\n"; $sth = $dbh->prepare($update); $sth->execute(); print <<__HTML__; __HTML__ } }else{ ################################################################ # Login failed because no Login or password # Could be first time loggin in. ################################################################ $session_id = ""; } }else{ #print "\n"; ################################################################ # Query DB to verify Session ################################################################ $query = "SELECT * FROM `Account_Info` WHERE `Last_Access_ID` = '$session_id'"; $sth = $dbh->prepare($query); $sth->execute(); $sth->bind_columns(\$Key, \$Login, \$Password, \$email, \$League_ID, \$Last_Access, \$Last_Access_ID, \$Firstname, \$Lastname, \$Title, \$Home_Phone, \$Work_Phone, \$Zip_Code); ################################################################ # Loop through what the db returned, if there is somthing there # it assumes success. ################################################################ while($sth->fetch()) { $success = 1; } ################################################################ # If we get to this point. The cookie is invalid at least for # this league. ################################################################ if($success == 0){ #print "

Your Session has expired,
Please login again.
\n"; print "\n"; $session_id = ""; }else{ ################################################################ # Update DB to keep session active ################################################################ $current_date = get_date_time(); $update = "UPDATE `Account_Info` SET `Last_Access`='$current_date' WHERE `Key` = $Key;"; ##print "QUERY: $update
\n"; $sth = $dbh->prepare($update); $sth->execute(); ################################################################ # Update Cookie to keep session active ################################################################ print <<__HTML__; __HTML__ } } ################################################################ # Close DB connection ################################################################ $sth->finish(); # disconnect from database $dbh->disconnect; return $session_id; } sub admin_print_update_account{ my $email = shift; my %user_info = get_account_info_by_email($email); $active_id{"create"} = "id=current"; print "
\n"; #print_steps(); print_reg_style(); print "
\n"; my $email_validation = get_email_validation(); my $phone_validation = get_phone_validation(); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; my $html = <<__HTML__;
Step 2 : Modify Account
Please enter account information for the primary person responsible for payment and under whom the participants will be listed.

Modify Account Owner Information
*First Name
*Last Name
*Email
*Address 1
Address 2
*City
*State
*Zip
*Phone $phone_example
Mobile Phone $phone_example


* Required Fields
__HTML__ print $html; } sub print_update_account{ my $email = shift; my %user_info = get_account_info_by_email($email); $active_id{"create"} = "id=current"; print_steps(); my $email_validation = get_email_validation(); my $phone_validation = get_phone_validation(); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; my $html = <<__HTML__;
Step 2 : Modify Account
Please enter account information for the primary person responsible for payment and under whom the participants will be listed.

Modify Account Owner Information
*First Name
*Last Name
*Email
*Address 1
Address 2
*City
*State
*Zip
*Phone $phone_example
Mobile Phone $phone_example


* Required Fields
__HTML__ print $html; } sub admin_print_create_account{ $active_id{"create"} = "id=current"; my @states = get_states(); print "
\n"; #print_steps(); print_reg_style(); print "
\n"; my $email_validation = get_email_validation(); my $phone_validation = get_phone_validation(); my $zip_validation = get_zip_validation(); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; my $html = <<__HTML__;
Step 2 : Create Account
Please enter account information for the primary person responsible for payment and under whom the participants will be listed.

Enter Account Owner Information
*First Name
*Last Name
*Email
*Address 1
Address 2
*City
*State
*Zip
*Phone $phone_example
Mobile Phone $phone_example
*Create New Password
*Re-type Password


* Required Fields
__HTML__ print $html; } sub print_create_account{ $active_id{"create"} = "id=current"; my @states = get_states(); print_steps(); my $email_validation = get_email_validation(); my $phone_validation = get_phone_validation(); my $zip_validation = get_zip_validation(); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; my $html = <<__HTML__;
Step 2 : Create Account
Please enter account information for the primary person responsible for payment and under whom the participants will be listed.

Enter Account Owner Information
*First Name
*Last Name
*Email
*Address 1
Address 2
*City
*State
*Zip
*Phone $phone_example
Mobile Phone $phone_example
*Create New Password
*Re-type Password


* Required Fields
__HTML__ print $html; } ############################################ # Step 1. login or create new account ############################################ sub print_admin_login{ my $msg = shift; if($msg ne ""){ $alert =<<__HTML__
$msg

__HTML__ } $active_id{"login"} = "id=current"; print "
\n"; #print_steps(); print_reg_style(); my $email_validation = get_email_validation(); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; my $html = <<__HTML__;
$alert
Registration Admin Login

Admin Account
Email
Password
__HTML__ print $html; } sub format_alert{ $msg = shift; if($msg ne ""){ $alert =<<__HTML__;
$msg

__HTML__ }else{ $alert = ""; } return $alert; } sub print_send_temp_pw{ #### Send Emails my $alert = shift; my $found_email = ""; my $tmp_string = ""; $active_id{"login"} = "id=current"; $alert = format_alert($alert); ($found_email, $tmp_string) = send_tmppw($newemail); print_steps(); my $html = <<__HTML__; $alert
Step 1: Validate Your New Account
IMPORTANT!! A temporary password has been emailed to you from lyaa.org. Please enter this temporary password below to validate your new account. You will be able to change your password at a later time.

Verify New Account
Email:

Enter the temporary password emailed to you:
 
__HTML__ print $html; } sub get_email_by_x{ my $x = shift; my $return_email = ""; my $dbh = get_dbh(); ################################################################ # Query DB to verify Session ################################################################ my $query = "SELECT `Email` FROM `Account_TMP_Password` WHERE `Tmp_String` = '$x';"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Email); while($sth->fetch()) { $return_email = $Email; } # disconnect from database $sth->finish(); $dbh->disconnect; return $return_email; } sub print_temp_pw_login{ #### Does not send email my $alert = shift; $active_id{"login"} = "id=current"; my $x = param('x'); my $show_login = 0; if(!(defined($x))){ $x = ""; } #my $alert = ""; if(!(defined($newemail))){ $newemail = get_email_by_x($x); if($newemail eq ""){ $alert = "Your temporary password is no longer active, please try again."; $show_login = 1; } } if($show_login == 0){ $alert = format_alert($alert); print_steps(); my $html = <<__HTML__; $alert
Step 1: Verify Email
Please use your temporary password to log in.

Existing Account
Email
Temp Password
 
__HTML__ print $html; }else{ print_reg_login($alert); } } ############################################ # Step 1. Admin Home ############################################ sub print_admin_home{ my $msg = shift; if($msg ne ""){ $alert =<<__HTML__
$msg

__HTML__ } $active_id{"login"} = "id=current"; print "
\n"; #print_steps(); print_reg_style(); print "
\n"; my $email_validation = get_email_validation(); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; my $html = <<__HTML__; $alert
Registration Admin Menu

__HTML__ print $html; } ############################################ # Step 1. (Admin Account Creation) ############################################ sub admin_print_create_user{ my $msg = shift; if($msg ne ""){ $alert =<<__HTML__
$msg

__HTML__ } $active_id{"login"} = "id=current"; print "
\n"; #print_steps(); print_reg_style(); print "
\n"; my $email_validation = get_email_validation(); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; my $html = <<__HTML__; $alert
Step 1 : Enter New Registrant Account (Mail-in or Walk-in Registration)
This is to be used by the Registration Admin to enter a mail-in or walk-in registration. Please enter the email address for the new registrant below.

If the registrant does not have an email address, please enter a fake email address using their first and last name as follows… firstname.lastname\@lyaa.org (no spaces, special characters, all lower case, etc.)

New Account
Email

__HTML__ print $html; } ############################################ # Step 1. login or create new account ############################################ sub print_reg_login{ my $msg = shift; if($msg ne ""){ $alert =<<__HTML__
$msg

__HTML__ } $active_id{"login"} = "id=current"; print_steps(); my $email_validation = get_email_validation(); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; my $html = <<__HTML__; $alert
Step 1: User Login
Please login or create a new account. Your account is used to register your children for programs as well as tracking the status of your registration.

New Account
Email

Existing Account
Email
Password
Forget Password? Click Here
__HTML__ print $html; } ############################################ # This is for when the account already # exist, prompt for a new account ############################################ sub print_create_new_account_duplicate_email{ $active_id{"login"} = "id=current"; print_steps(); my $email_validation = get_email_validation(); my $jscript = <<__JSCRIPT__; __JSCRIPT__ print $jscript; my $html = <<__HTML__;
Step 1: User Login
There is already an account created for that email, please login or try a different account name.

New Account
Email

Existing Account
Email
Password
Forget Password? Click Here
__HTML__ print $html; } ############################################ # Get player info ############################################ sub get_player_info_by_key{ my $player_key = shift; my %return_hash = (); my $dbh = get_dbh(); ################################################################ # Query DB to verify Session ################################################################ my $query = "SELECT * FROM `Account_Player_Info` WHERE `Key` = '$player_key' AND `Active` = '1' ORDER BY `Key`"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Key, \$Account_ID, \$Firstname, \$Lastname, \$Division_Pref, \$Shirt_Size, \$Pant_Size, \$Hat_Size, \$Shoe_Size, \$Jersey_Pref, \$DOB, \$Gender, \$School_Name, \$Grade, \$Age, \$Height, \$Weight, \$E_Contact_Name, \$E_Contact_Phone, \$E_Contact_SPhone, \$E_Contact_Relationship, \$G_Contact_Phone, \$G_Contact_SPhone, \$G_Contact_Name, \$G_Contact_Relationship, \$OG_Contact_Phone, \$OG_Contact_SPhone, \$OG_Contact_Name, \$OG_Contact_Relationship, \$Preferred_Doc_Name, \$Preferred_Doc_Number, \$Preferred_Dentist_Name, \$Preferred_Dentist_Number, \$Preferred_Hospital, \$Insurance_Carrier, \$Policy_Number, \$Medical_History, \$Returning_Player, \$Paid, \$Active, \$Consent, \$Consent_Actions, \$Play_Up); $user_number = 1; while($sth->fetch()) { $return_hash{"KEY"} = $Key; $return_hash{"FIRSTNAME"} = $Firstname; $return_hash{"LASTNAME"} = $Lastname; $return_hash{"DIVISION"} = $Division_Pref; $return_hash{"SHIRT_SIZE"} = $Shirt_Size; $return_hash{"PANT_SIZE"} = $Pant_Size; $return_hash{"HAT_SIZE"} = $Hat_Size; $return_hash{"SHOE_SIZE"} = $Shoe_Size; $return_hash{"JERSEY_PREF"} = $Jersey_Pref; $return_hash{"DOB"} = get_view_date_format($DOB); $return_hash{"GENDER"} = $Gender; $return_hash{"SNAME"} = $School_Name; $return_hash{"GRADE"} = $Grade; $return_hash{"AGE"} = $Age; $return_hash{"HEIGHT"} = $Height; $return_hash{"WEIGHT"} = $Weight; $return_hash{"E_CONTACT_PHONE"} = $E_Contact_Phone; $return_hash{"E_CONTACT_SPHONE"} = $E_Contact_SPhone; $return_hash{"E_CONTACT_NAME"} = $E_Contact_Name; $return_hash{"E_CONTACT_REL"} = $E_Contact_Relationship; $return_hash{"G_CONTACT_PHONE"} = $G_Contact_Phone; $return_hash{"G_CONTACT_SPHONE"} = $G_Contact_SPhone; $return_hash{"G_CONTACT_NAME"} = $G_Contact_Name; $return_hash{"G_CONTACT_REL"} = $G_Contact_Relationship; $return_hash{"OG_CONTACT_PHONE"} = $OG_Contact_Phone; $return_hash{"OG_CONTACT_SPHONE"}= $OG_Contact_SPhone; $return_hash{"OG_CONTACT_NAME"} = $OG_Contact_Name; $return_hash{"OG_CONTACT_REL"} = $OG_Contact_Relationship; $return_hash{"PREF_DOC_NAME"} = $Preferred_Doc_Name; $return_hash{"PREF_DOC_NUMB"} = $Preferred_Doc_Number; $return_hash{"PREF_DENT_NAME"} = $Preferred_Dentist_Name; $return_hash{"PREF_DENT_NUMB"} = $Preferred_Dentist_Number; $return_hash{"PREF_HOSPITAL"} = $Preferred_Hospital; $return_hash{"INSURANCE"} = $Insurance_Carrier; $return_hash{"POLICY"} = $Policy_Number; $return_hash{"MEDICAL"} = $Medical_History; $return_hash{"RETURNING"} = $Returning_Player; $return_hash{"PAID"} = $Paid; $return_hash{"ACTIVE"} = $Active; $return_hash{"CONSENT"} = $Consent; $return_hash{"ACTIONSTO"} = $Consent_Actions; $return_hash{"PLAY_UP"} = $Play_Up; $user_number++; } #print "HELLO: $return_hash{\"G_CONTACT_NAME\"}
\n"; # disconnect from database $dbh->disconnect; $sth->finish(); return %return_hash; } ############################################ # Get player info ############################################ sub get_states{ my @states=("AL", "AK", "AS", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FM", "FL", "GA", "GU", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MH", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "MP", "OH", "OK", "OR", "PW", "PA", "PR", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VI", "VA", "WA", "WV", "WI", "WY"); return @states; } ############################################ # Get player info ############################################ sub get_player_info{ my $user_key = shift; my $return_hash = 0; my %return_hash = (); my $dbh = get_dbh(); ################################################################ # Query DB to verify Session ################################################################ my $query = "SELECT * FROM `Account_Player_Info` WHERE `Account_ID` = '$user_key' AND `Active` = '1' ORDER BY `Key`"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Key, \$Account_ID, \$Firstname, \$Lastname, \$Division_Pref, \$Shirt_Size, \$Pant_Size, \$Hat_Size, \$Shoe_Size, \$Jersey_Pref, \$DOB, \$Gender, \$School_Name, \$Grade, \$Age, \$Height, \$Weight, \$E_Contact_Name, \$E_Contact_Phone, \$E_Contact_SPhone, \$E_Contact_Relationship, \$G_Contact_Phone, \$G_Contact_SPhone, \$G_Contact_Name, \$G_Contact_Relationship, \$OG_Contact_Phone, \$OG_Contact_SPhone, \$OG_Contact_Name, \$OG_Contact_Relationship, \$Preferred_Doc_Name, \$Preferred_Doc_Number, \$Preferred_Dentist_Name, \$Preferred_Dentist_Number, \$Preferred_Hospital, \$Insurance_Carrier, \$Policy_Number, \$Medical_History, \$Returning_Player, \$Paid, \$Active, \$Consent, \$Consent_Actions, \$Play_Up); $user_number = 1; while($sth->fetch()) { $return_hash{$user_number}{"KEY"} = $Key; $return_hash{$user_number}{"FIRSTNAME"} = $Firstname; $return_hash{$user_number}{"LASTNAME"} = $Lastname; $return_hash{$user_number}{"DIVISION"} = $Division_Pref; $return_hash{$user_number}{"SHIRT_SIZE"} = $Shirt_Size; $return_hash{$user_number}{"PANT_SIZE"} = $Pant_Size; $return_hash{$user_number}{"HAT_SIZE"} = $Hat_Size; $return_hash{$user_number}{"SHOE_SIZE"} = $Shoe_Size; $return_hash{$user_number}{"JERSEY_PREF"} = $Jersey_Pref; $return_hash{$user_number}{"DOB"} = $DOB; $return_hash{$user_number}{"GENDER"} = $Gender; $return_hash{$user_number}{"SNAME"} = $School_Name; $return_hash{$user_number}{"GRADE"} = $Grade; $return_hash{$user_number}{"AGE"} = $Age; $return_hash{$user_number}{"HEIGHT"} = $Height; $return_hash{$user_number}{"WEIGHT"} = $Weight; $return_hash{$user_number}{"E_CONTACT_PHONE"} = $E_Contact_Phone; $return_hash{$user_number}{"E_CONTACT_SPHONE"} = $E_Contact_SPhone; $return_hash{$user_number}{"E_CONTACT_NAME"} = $E_Contact_Name; $return_hash{$user_number}{"E_CONTACT_REL"} = $E_Contact_Relationship; $return_hash{$user_number}{"G_CONTACT_PHONE"} = $G_Contact_Phone; $return_hash{$user_number}{"G_CONTACT_SPHONE"} = $G_Contact_SPhone; $return_hash{$user_number}{"G_CONTACT_NAME"} = $G_Contact_Name; $return_hash{$user_number}{"G_CONTACT_REL"} = $G_Contact_Relationship; $return_hash{$user_number}{"OG_CONTACT_PHONE"} = $OG_Contact_Phone; $return_hash{$user_number}{"OG_CONTACT_SPHONE"}= $OG_Contact_SPhone; $return_hash{$user_number}{"OG_CONTACT_NAME"} = $OG_Contact_Name; $return_hash{$user_number}{"OG_CONTACT_REL"} = $OG_Contact_Relationship; $return_hash{$user_number}{"PREF_DOC_NAME"} = $Preferred_Doc_Name; $return_hash{$user_number}{"PREF_DOC_NUMB"} = $Preferred_Doc_Number; $return_hash{$user_number}{"PREF_DENT_NAME"} = $Preferred_Dentist_Name; $return_hash{$user_number}{"PREF_DENT_NUMB"} = $Preferred_Dentist_Number; $return_hash{$user_number}{"PREF_HOSPITAL"} = $Preferred_Hospital; $return_hash{$user_number}{"INSURANCE"} = $Insurance_Carrier; $return_hash{$user_number}{"POLICY"} = $Policy_Number; $return_hash{$user_number}{"MEDICAL"} = $Medical_History; $return_hash{$user_number}{"RETURNING"} = $Returning_Player; $return_hash{$user_number}{"PAID"} = $Paid; $return_hash{$user_number}{"ACTIVE"} = $Active; $return_hash{$user_number}{"CONSENT"} = $Consent; $return_hash{$user_number}{"ACTIONSTO"} = $Consent_Actions; $return_hash{$user_number}{"PLAY_UP"} = $Play_Up; $user_number++; } # disconnect from database $dbh->disconnect; $sth->finish(); return %return_hash; } ############################################ # Get player info2, this one returns the # Key as the main index ############################################ sub get_player_info2{ my $user_key = shift; my $return_hash = 0; my %return_hash = (); my $dbh = get_dbh(); ################################################################ # Query DB to verify Session ################################################################ my $query = "SELECT * FROM `Account_Player_Info` WHERE `Account_ID` = '$user_key' AND `Active` = '1' ORDER BY `Key`"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Key, \$Account_ID, \$Firstname, \$Lastname, \$Division_Pref, \$Shirt_Size, \$Pant_Size, \$Hat_Size, \$Shoe_Size, \$Jersey_Pref, \$DOB, \$Gender, \$School_Name, \$Grade, \$Age, \$Height, \$Weight, \$E_Contact_Name, \$E_Contact_Phone, \$E_Contact_SPhone, \$E_Contact_Relationship, \$G_Contact_Phone, \$G_Contact_SPhone, \$G_Contact_Name, \$G_Contact_Relationship, \$OG_Contact_Phone, \$OG_Contact_SPhone, \$OG_Contact_Name, \$OG_Contact_Relationship, \$Preferred_Doc_Name, \$Preferred_Doc_Number, \$Preferred_Dentist_Name, \$Preferred_Dentist_Number, \$Preferred_Hospital, \$Insurance_Carrier, \$Policy_Number, \$Medical_History, \$Returning_Player, \$Paid, \$Active, \$Consent, \$Consent_Actions, \$Play_Up); $user_number = 1; while($sth->fetch()) { $return_hash{$Key}{"KEY"} = $Key; $return_hash{$Key}{"FIRSTNAME"} = $Firstname; $return_hash{$Key}{"LASTNAME"} = $Lastname; $return_hash{$Key}{"DIVISION"} = $Division_Pref; $return_hash{$Key}{"SHIRT_SIZE"} = $Shirt_Size; $return_hash{$Key}{"PANT_SIZE"} = $Pant_Size; $return_hash{$Key}{"HAT_SIZE"} = $Hat_Size; $return_hash{$Key}{"SHOE_SIZE"} = $Shoe_Size; $return_hash{$Key}{"JERSEY_PREF"} = $Jersey_Pref; $return_hash{$Key}{"DOB"} = $DOB; $return_hash{$Key}{"GENDER"} = $Gender; $return_hash{$Key}{"SNAME"} = $School_Name; $return_hash{$Key}{"GRADE"} = $Grade; $return_hash{$Key}{"AGE"} = $Age; $return_hash{$Key}{"HEIGHT"} = $Height; $return_hash{$Key}{"WEIGHT"} = $Weight; $return_hash{$Key}{"E_CONTACT_PHONE"} = $E_Contact_Phone; $return_hash{$Key}{"E_CONTACT_SPHONE"} = $E_Contact_SPhone; $return_hash{$Key}{"E_CONTACT_NAME"} = $E_Contact_Name; $return_hash{$Key}{"E_CONTACT_REL"} = $E_Contact_Relationship; $return_hash{$Key}{"G_CONTACT_PHONE"} = $G_Contact_Phone; $return_hash{$Key}{"G_CONTACT_SPHONE"} = $G_Contact_SPhone; $return_hash{$Key}{"G_CONTACT_NAME"} = $G_Contact_Name; $return_hash{$Key}{"G_CONTACT_REL"} = $G_Contact_Relationship; $return_hash{$Key}{"OG_CONTACT_PHONE"} = $OG_Contact_Phone; $return_hash{$Key}{"OG_CONTACT_SPHONE"}= $OG_Contact_SPhone; $return_hash{$Key}{"OG_CONTACT_NAME"} = $OG_Contact_Name; $return_hash{$Key}{"OG_CONTACT_REL"} = $OG_Contact_Relationship; $return_hash{$Key}{"PREF_DOC_NAME"} = $Preferred_Doc_Name; $return_hash{$Key}{"PREF_DOC_NUMB"} = $Preferred_Doc_Number; $return_hash{$Key}{"PREF_DENT_NAME"} = $Preferred_Dentist_Name; $return_hash{$Key}{"PREF_DENT_NUMB"} = $Preferred_Dentist_Number; $return_hash{$Key}{"PREF_HOSPITAL"} = $Preferred_Hospital; $return_hash{$Key}{"INSURANCE"} = $Insurance_Carrier; $return_hash{$Key}{"POLICY"} = $Policy_Number; $return_hash{$Key}{"MEDICAL"} = $Medical_History; $return_hash{$Key}{"RETURNING"} = $Returning_Player; $return_hash{$Key}{"PAID"} = $Paid; $return_hash{$Key}{"ACTIVE"} = $Active; $return_hash{$Key}{"CONSENT"} = $Consent; $return_hash{$Key}{"ACTIONSTO"} = $Consent_Actions; $return_hash{$Key}{"PLAY_UP"} = $Play_Up; $user_number++; } # disconnect from database $dbh->disconnect; $sth->finish(); return %return_hash; } ############################################ # Get pw info by email ############################################ sub get_pw_by_email{ my $email = shift; my $return_password = ""; my $dbh = get_dbh(); ################################################################ # Query DB to verify Session ################################################################ my $query = "SELECT `Password` FROM `Account_Info` WHERE `email` = '$email';"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Password); while($sth->fetch()) { $return_password = $Password; #print "SETTING: $Password
\n"; } # disconnect from database $sth->finish(); $dbh->disconnect; #print "RP: $return_password
\n"; return $return_password; } ############################################ # Get account info by email ############################################ sub get_users_by_org{ my $org_id = shift; my $return_hash = 0; my %return_hash = (); my $dbh = get_dbh(); ################################################################ # Query DB to verify Session ################################################################ my $query = "SELECT a.`Key`, a.`email`, a.`Firstname`, a.`Lastname`, a.`Home_Phone`, a.`Work_Phone`, a.`Mobile_Phone`, a.`Zip_Code`, b.`Address1`, b.`Address2`, b.`City`, b.`State` FROM `Account_Info` a, `Account_Extra_Info` b, `Account_Org_Reg_Link` c WHERE c.`Org_ID` = '$org_id' AND c.`Account_ID` = a.`Key` AND c.`Account_ID` = b.`Account_ID`"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Key, \$email, \$Firstname, \$Lastname, \$Home_Phone, \$Work_Phone,\$Mobile_Phone, \$Zip_Code, \$Address1, \$Address2, \$City, \$State); while($sth->fetch()) { $return_hash{$Key}{"EMAIL"} = $email; $return_hash{$Key}{"FIRSTNAME"} = $Firstname; $return_hash{$Key}{"LASTNAME"} = $Lastname; $return_hash{$Key}{"HOMEPHONE"} = $Home_Phone; $return_hash{$Key}{"WORK_PHONE"} = $Work_Phone; $return_hash{$Key}{"MOBILE_PHONE"} = $Mobile_Phone; $return_hash{$Key}{"ZIP_CODE"} = $Zip_Code; $return_hash{$Key}{"ADDRESS1"} = $Address1; $return_hash{$Key}{"ADDRESS2"} = $Address2; $return_hash{$Key}{"CITY"} = $City; $return_hash{$Key}{"STATE"} = $State; } # disconnect from database $sth->finish(); $dbh->disconnect; return %return_hash; } ############################################ # Get account info by email ############################################ sub get_account_id_by_player_key{ my $player_key = shift; my $return_id = 0; my $dbh = get_dbh(); ################################################################ # Query DB to verify Session ################################################################ my $query = "SELECT `Account_ID` FROM `Account_Player_Info` WHERE `Key` = '$player_key'"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Account_ID); while($sth->fetch()) { $return_id = $Account_ID; } # disconnect from database $sth->finish(); $dbh->disconnect; return $return_id; } ############################################ # Get account info by email ############################################ sub get_account_info_by_email{ my $email = shift; my $return_hash = 0; my %return_hash = (); my $dbh = get_dbh(); ################################################################ # Query DB to verify Session ################################################################ my $query = "SELECT a.`Key`, a.`email`, a.`Firstname`, a.`Lastname`, a.`Home_Phone`, a.`Work_Phone`, a.`Mobile_Phone`, a.`Zip_Code`, b.`Address1`, b.`Address2`, b.`City`, b.`State` FROM `Account_Info` a, `Account_Extra_Info` b WHERE b.`Account_ID` = a.`Key` and (a.`email` = '$email' OR a.`Login` = '$email')"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Key, \$email, \$Firstname, \$Lastname, \$Home_Phone, \$Work_Phone,\$Mobile_Phone, \$Zip_Code, \$Address1, \$Address2, \$City, \$State); while($sth->fetch()) { $return_hash{"KEY"} = $Key; $return_hash{"EMAIL"} = $email; $return_hash{"FIRSTNAME"} = $Firstname; $return_hash{"LASTNAME"} = $Lastname; $return_hash{"HOMEPHONE"} = $Home_Phone; $return_hash{"WORK_PHONE"} = $Work_Phone; $return_hash{"MOBILE_PHONE"} = $Mobile_Phone; $return_hash{"ZIP_CODE"} = $Zip_Code; $return_hash{"ADDRESS1"} = $Address1; $return_hash{"ADDRESS2"} = $Address2; $return_hash{"CITY"} = $City; $return_hash{"STATE"} = $State; } # disconnect from database $sth->finish(); $dbh->disconnect; return %return_hash; } ############################################ # Get account info ############################################ sub get_account_info{ my $user_key = shift; my $return_hash = 0; my %return_hash = (); my $dbh = get_dbh(); ################################################################ # Query DB to verify Session ################################################################ my $query = "SELECT a.`Key`, a.`email`, a.`Firstname`, a.`Lastname`, a.`Home_Phone`, a.`Work_Phone`, a.`Mobile_Phone`, a.`Zip_Code`, b.`Address1`, b.`Address2`, b.`City`, b.`State` FROM `Account_Info` a, `Account_Extra_Info` b WHERE b.`Account_ID` = a.`Key` and a.`Key` = '$user_key'"; my $sth = $dbh->prepare($query); #print "$query
\n"; $sth->execute(); $sth->bind_columns(\$Key, \$email, \$Firstname, \$Lastname, \$Home_Phone, \$Work_Phone,\$Mobile_Phone, \$Zip_Code, \$Address1, \$Address2, \$City, \$State); while($sth->fetch()) { $return_hash{"KEY"} = $Key; $return_hash{"EMAIL"} = $email; $return_hash{"FIRSTNAME"} = $Firstname; $return_hash{"LASTNAME"} = $Lastname; $return_hash{"HOMEPHONE"} = $Home_Phone; $return_hash{"WORK_PHONE"} = $Work_Phone; $return_hash{"MOBILE_PHONE"} = $Mobile_Phone; $return_hash{"ZIP_CODE"} = $Zip_Code; $return_hash{"ADDRESS1"} = $Address1; $return_hash{"ADDRESS2"} = $Address2; $return_hash{"CITY"} = $City; $return_hash{"STATE"} = $State; } # disconnect from database $dbh->disconnect; $sth->finish(); return %return_hash; } ############################################ # Check to see if the account exists # given the email. If it does reutrn the # key ID, otherwise return 0 ############################################ sub check_for_account{ my $new_email = shift; my $return_value = 0; my $dbh = get_dbh(); ################################################################ # Query DB to verify Session ################################################################ my $query = "SELECT `Key` FROM `Account_Info` WHERE `email` = '$new_email'"; my $sth = $dbh->prepare($query); $sth->execute(); $sth->bind_columns(\$Key); while($sth->fetch()) { $return_value = $Key; } # disconnect from database $dbh->disconnect; $sth->finish(); return $return_value; } ############################################ # return email validation javascript code ############################################ sub get_email_validation{ my $html = <<__HTML__; function validate_email(emailToValidate){ if(emailToValidate.value != ""){ atposition = emailToValidate.indexOf("@"); dotposition = emailToValidate.lastIndexOf("."); if((atposition < 1)||(dotposition - atposition <2)){ return 0; } } return 1; } __HTML__ return $html; } ############################################ # return zip validation javascript code ############################################ sub get_zip_validation{ my $html = <<__HTML__; function validate_zip(zip){ var valid = 1; len=zip.length digits="0123456789" if(len != 5){ valid = 0; } for(i=0; i<5; i++){ if (digits.indexOf(zip.charAt(i))<0){ valid = 0; } } return valid; } __HTML__ return $html; } ############################################ # return phone validation javascript code ############################################ sub get_phone_validation{ my $html = <<__HTML__; __HTML__ return $html; } sub print_reg_style{ print <<__HTML__; __HTML__ } ################################################################ ### This is a specific sort for team teams drop down option ################################################################ sub hashValueAscendingNumPlayer { $player_info{$b} <=> $player_info{$a} } sub print_text_info_box{ my $title = shift; my $text = shift; my $font_size = "10pt"; my $font_color = "black"; my $text_align = "center"; my $header_color = "#686b6e"; #my $header_color = "#666699"; my $body_color = "#ffffff"; print <<__HTML__;
$title
$text

__HTML__ } sub print_reg_info{ print "
\n"; print_text_info_box("Registration", "Welcome to on-line registration for LYAA 2008 Season!!!"); #print_text_info_box("Program", "Baseball &
Softball"); print_text_info_box("Season", "2008 Season"); #print_text_info_box("Registration Fees", "Baseball - \$145
Early Bird discount. Register by Dec 15 and get \$25 off registration."); print_text_info_box("Information", "Who to Contact for Help
Registration Fees & Info"); #print_text_info_box("About Homteamz", "Hometeamz.com provides online league services for community sports programs.
More Info"); print <<__HTML__;
__HTML__ print "
\n"; } ################################################################ ### Check to see if the user is logged in ### This is updated to only check if cookie is there. ################################################################ ################################################################ ### Check to see if the user is logged in ################################################################ sub remote_window_check_reg_login{ #### league could be a league or an org my $league_id = shift; my $login_fail_url = shift; my $return_string = 0; my $success = 0; my $session_id = get_cookie(); my $page = "admin"; # force admin for level 3 access #my $org_id = get_org($league_id); #print "SESSION ID: $session_id
\n"; my $dbh = get_dbh(); ################################################################ # Check to see if there is a valid cookie ################################################################ #print "SESSION = $session_id
\n"; if($session_id eq ""){ #print "SUCCESS: $success
\n"; $success = 0; }else{ my $login = get_login_from_session($session_id); #print "\n"; $access_level = check_permissions($login, $org_id, $league_id, $info_id, $page); #print "\n"; if(($page eq "admin")&&($access_level >=3)){ $success = 1; }elsif(($page eq "league")||($page eq "info")){ if($access_level >=2){ $success = 1; } } $success =1; } #print "SUCCESS: $success
\n"; if($success == 0){ #print "\n"; print <<__HTML__; __HTML__ exit(1); return 0; }else{ print "\n"; #print "\n"; return $session_id; } } ################################################################ ### This section prints the stylesheet as well as some ### Javascript functions ################################################################ sub print_style2{ $league_only = shift; $menu_text_color = "#ffffff"; $menu_bg_color = "#999999"; $menu_border_color = "#ffffff"; $menu_head_text_color = "#ffffff"; $menu_head_bg_color = "#686b6e"; $menu_padding = "2"; #$menu_color_hover = "#ffffff"; #$menu_color_hover = "yellow"; $menu_color_hover = "#ffffff"; $menu_bg_color_hover = "#686b6e"; $bare_domain = $hometeamz_url; $bare_domain =~ s/www\.//; if($league_only == 1){ $bg_url = ""; }else{ $bg_url = "$teamdata/hometeamz/bg_right3.gif"; } #$style_sheet = "$lib/ht.css"; print <<__HTML__; __HTML__ add_to_hit_counter($org_id); } 1;