Beispiel #1
0
function validate_reset_password_form()
{
    $errors = array();
    // Validate email field
    if ($_POST['email']) {
        if (validate_email(format_trim($_POST['email']))) {
            //Do Nothing
        } else {
            $errors[] = "Email is not valid.";
        }
    } else {
        $errors[] = "Must provide a valid email address.";
    }
    return $errors;
}
Beispiel #2
0
function validate_seasonregistration_form()
{
    $errors = array();
    #Firstname Validation
    if (isset($_POST['firstname']) && $_POST['firstname']) {
        if (strlen($_POST['firstname']) < 2) {
            $errors[] = "First name must be at least 2 characters long.";
        }
        if (!valid_text($_POST['firstname'])) {
            $errors[] = "First name contains invalid characters. Check for quotes.";
        }
    } else {
        $errors[] = "First name is a required field";
    }
    #Lastname Validation
    if (isset($_POST['lastname']) && $_POST['lastname']) {
        if (strlen($_POST['lastname']) < 2) {
            $errors[] = "Last name must be at least 2 characters long.";
        }
        if (!valid_text($_POST['lastname'])) {
            $errors[] = "Last name contains invalid characters. Check for quotes.";
        }
    } else {
        $errors[] = "Last name is a required field";
    }
    #Address One Validation
    if (isset($_POST['addressOne']) && $_POST['addressOne']) {
        //Do nothing  .. Not doing any AVS checks, so hopefully they give us a good address
    } else {
        $errors[] = "Address Field One is required";
    }
    #City Validation
    if (isset($_POST['city']) && $_POST['city']) {
        //Do nothing  .. Not doing any AVS checks, so hopefully they give us a good city
    } else {
        $errors[] = "City is required";
    }
    #State Validation
    if (isset($_POST['state']) && $_POST['state']) {
        //Do nothing  .. Not doing any AVS checks, so hopefully they give us a good state
    } else {
        $errors[] = "State is required";
    }
    #Postal Code Validation
    if (isset($_POST['postalCode']) && $_POST['postalCode']) {
        //Do nothing  .. Not doing any AVS checks, so hopefully they give us a good zip
    } else {
        $errors[] = "Zipcode is required";
    }
    #Email Validation
    if (isset($_POST['email']) && $_POST['email']) {
        if (validate_email(format_trim($_POST['email']))) {
            //Do nothing .. its a valid email, i guess
        } else {
            $errors[] = "Email is not valid.";
        }
    }
    #Position Validation
    if (isset($_POST['goalie']) && $_POST['goalie'] == "on" || isset($_POST['defense']) && $_POST['defense'] == "on" || isset($_POST['center']) && $_POST['center'] == "on" || isset($_POST['wing']) && $_POST['wing'] == "on") {
        //Do nothing .. At least one position is checked
    } else {
        $errors[] = "Must provide at least one position you would like to play. (Goalie, Defense, Center, Wing)";
    }
    #Jersey Information Validation
    #Jersey Choice 1 Validation
    //(isset($_POST['jerseyNumChoiceTwo']) && $_POST['jerseyNumChoiceTwo']) || $_POST['jerseyNumChoiceTwo'] == 0
    if (isset($_POST['jerseyNumChoiceOne']) && $_POST['jerseyNumChoiceOne'] > -1 || $_POST['jerseyNumChoiceOne'] == 0) {
        //if (is_numeric($_POST['jerseyNumChoiceOne']) && is_int(intval($_POST['jerseyNumChoiceOne']))) {
        if (strlen($_POST['jerseyNumChoiceOne']) == strlen(intval($_POST['jerseyNumChoiceOne']))) {
            if (intval($_POST['jerseyNumChoiceOne']) < 0 || intval($_POST['jerseyNumChoiceOne']) > 99) {
                $errors[] = "Jersey Number Choice 1 must be between 0 - 99.";
            }
        } else {
            $errors[] = "Must provide a valid jersey number for Choice 1. (0 - 99)";
        }
    } else {
        $errors[] = "Must provide a valid jersey number for Choice 1. (0 - 99)";
    }
    #Jersey Choice 2 Validation
    if (isset($_POST['jerseyNumChoiceTwo']) && $_POST['jerseyNumChoiceTwo'] > -1 || $_POST['jerseyNumChoiceTwo'] == 0) {
        if (strlen($_POST['jerseyNumChoiceTwo']) == strlen(intval($_POST['jerseyNumChoiceTwo']))) {
            if (intval($_POST['jerseyNumChoiceTwo']) < 0 || intval($_POST['jerseyNumChoiceTwo']) > 99) {
                $errors[] = "Jersey Number Choice 2 must be between 0 - 99.";
            }
        } else {
            $errors[] = "Must provide a valid jersey number for Choice 2. (0 - 99)";
        }
    } else {
        $errors[] = "Must provide a valid jersey number for Choice 2. (0 - 99)";
    }
    #Jersey Choice 3 Validation
    if (isset($_POST['jerseyNumChoiceThree']) && $_POST['jerseyNumChoiceThree'] > -1 || $_POST['jerseyNumChoiceThree'] == 0) {
        if (strlen($_POST['jerseyNumChoiceThree']) == strlen(intval($_POST['jerseyNumChoiceThree']))) {
            if (intval($_POST['jerseyNumChoiceThree']) < 0 || intval($_POST['jerseyNumChoiceThree']) > 99) {
                $errors[] = "Jersey Number Choice 3 must be between 0 - 99.";
            }
        } else {
            $errors[] = "Must provide a valid jersey number for Choice 3. (0 - 99)";
        }
    } else {
        $errors[] = "Must provide a valid jersey number for Choice 3. (0 - 99)";
    }
    #Will Sub? Validation
    if (isset($_POST['willSub']) && $_POST['willSub'] == "Y") {
        if (isset($_POST['sunSub']) && $_POST['sunSub'] == "on" || isset($_POST['monSub']) && $_POST['monSub'] == "on" || isset($_POST['tueSub']) && $_POST['tueSub'] == "on" || isset($_POST['wedSub']) && $_POST['wedSub'] == "on" || isset($_POST['thuSub']) && $_POST['thuSub'] == "on" || isset($_POST['friSub']) && $_POST['friSub'] == "on" || isset($_POST['satSub']) && $_POST['satSub'] == "on") {
            //Do nothing, they picked a day that they can sub
        } else {
            $errors[] = "Since you answered yes to: Will you sub?, you must indicate at least one day you are willing to sub.";
        }
    } else {
        //Do nothing .. they indicated "NO" for Will they sub?
    }
    #Return Errors
    return $errors;
}
Beispiel #3
0
 public function formValidation()
 {
     if ($_POST['boardMemberFirstName']) {
         if (strlen($_POST['boardMemberFirstName']) < 2) {
             $this->boardMemberFormErrors[] = "First name must be at least 2 characters long.";
         }
         if (!valid_text($_POST['boardMemberFirstName'])) {
             $this->boardMemberFormErrors[] = "First name contains invalid characters. Check for quotes.";
         }
     } else {
         $this->boardMemberFormErrors[] = "First name is a required field";
     }
     if ($_POST['boardMemberLastName']) {
         if (strlen($_POST['boardMemberLastName']) < 2) {
             $this->boardMemberFormErrors[] = "Last name must be at least 2 characters long.";
         }
         if (!valid_text($_POST['boardMemberLastName'])) {
             $this->boardMemberFormErrors[] = "Last name contains invalid characters. Check for quotes.";
         }
     } else {
         $this->boardMemberFormErrors[] = "Last name is a required field";
     }
     if ($_POST['boardMemberEmail']) {
         if (validate_email(format_trim($_POST['boardMemberEmail']))) {
             //Do nothing
         } else {
             $this->boardMemberFormErrors[] = "Email is not valid.";
         }
     }
     if (isset($_FILES['boardMemberImage']['type']) && $_FILES['boardMemberImage']['size'] > 0) {
         if ($_FILES['boardMemberImage']['type'] != 'image/jpeg' && $_FILES['boardMemberImage']['type'] != 'image/gif') {
             $this->boardMemberFormErrors[] = "Board member image can only be a GIF or JPEG.  Attempted file is '" . $_FILES['boardMemberImage']['type'] . "'.";
         }
     }
     return $this->get_boardMemberFormErrors();
 }
Beispiel #4
0
 private function formProcess()
 {
     if (isset($_POST['firstname']) && $_POST['firstname']) {
         $this->set_fname(format_uppercase_text($_POST['firstname']));
     }
     // Required
     if (isset($_POST['lastname']) && $_POST['lastname']) {
         $this->set_lname(format_uppercase_text($_POST['lastname']));
     }
     // Required
     if (isset($_POST['addressOne']) && $_POST['addressOne']) {
         $this->set_addressOne(format_text($_POST['addressOne']));
     }
     // Required
     if (isset($_POST['addressTwo']) && $_POST['addressTwo']) {
         $this->set_addressTwo(format_text($_POST['addressTwo']));
     } else {
         $this->set_addressTwo("");
     }
     if (isset($_POST['city']) && $_POST['city']) {
         $this->set_city(format_uppercase_text($_POST['city']));
     }
     //Required
     if (isset($_POST['state']) && $_POST['state']) {
         $this->set_state(format_text($_POST['state']));
     }
     //Required
     if (isset($_POST['postalCode']) && $_POST['postalCode']) {
         $this->set_postalcode(format_text($_POST['postalCode']));
     }
     //Required
     if (isset($_POST['email']) && $_POST['email']) {
         $this->set_email(format_text(strtolower($_POST['email'])));
     } else {
         $this->set_email("");
     }
     if (isset($_POST['homePhone']) && $_POST['homePhone']) {
         $this->set_homephone(format_text($_POST['homePhone']));
     } else {
         $this->set_homephone("");
     }
     if (isset($_POST['workPhone']) && $_POST['workPhone']) {
         $this->set_workphone(format_text($_POST['workPhone']));
     } else {
         $this->set_workphone("");
     }
     if (isset($_POST['cellPhone']) && $_POST['cellPhone']) {
         $this->set_cellphone(format_text($_POST['cellPhone']));
     } else {
         $this->set_cellphone("");
     }
     /**
     if (isset($_POST['goalie']) && $_POST['goalie'] == "on") {
     	$goalie = "Y";
     } else {
     	$goalie = "N";
     }
     if (isset($_POST['defense']) && $_POST['defense'] == "on") {
     	$defense = "Y";
     } else {
     	$defense = "N";
     }
     if (isset($_POST['center']) && $_POST['center'] == "on") {
     	$center = "Y";
     } else {
     	$center = "N";
     }
     if (isset($_POST['wing']) && $_POST['wing'] == "on") {
     	$wing = "Y";
     } else {
     	$wing = "N";
     }
     */
     if (isset($_POST['position']) && $_POST['position']) {
         $this->set_position($_POST['position']);
     }
     //Required
     if (isset($_POST['jerseySize']) && $_POST['jerseySize']) {
         $this->set_jerseysize($_POST['jerseySize']);
     }
     //Required
     if (isset($_POST['jerseyNumChoiceOne']) && $_POST['jerseyNumChoiceOne'] || $_POST['jerseyNumChoiceOne'] == 0) {
         $this->set_jerseyNumberOne($_POST['jerseyNumChoiceOne']);
     }
     //Required
     if (isset($_POST['jerseyNumChoiceTwo']) && $_POST['jerseyNumChoiceTwo'] || $_POST['jerseyNumChoiceTwo'] == 0) {
         $this->set_jerseyNumberTwo($_POST['jerseyNumChoiceTwo']);
     }
     //Required
     if (isset($_POST['jerseyNumChoiceThree']) && $_POST['jerseyNumChoiceThree'] || $_POST['jerseyNumChoiceThree'] == 0) {
         $this->set_jerseyNumberThree($_POST['jerseyNumChoiceThree']);
     }
     //Required
     if (isset($_POST['travelWith']) && $_POST['travelWith']) {
         $this->set_travelingWithWho(format_text($_POST['travelWith']));
     } else {
         $this->set_travelingWithWho("");
     }
     if (isset($_POST['additionalNotes']) && $_POST['additionalNotes']) {
         $this->set_notes(format_text($_POST['additionalNotes']));
     } else {
         $this->set_notes("");
     }
     if (isset($_POST['skillLevel']) && $_POST['skillLevel']) {
         $this->set_skilllevel($_POST['skillLevel']);
     }
     //Required
     if (isset($_POST['willSub']) && $_POST['willSub'] == "Y") {
         $this->set_wantToSub(1);
         if (isset($_POST['sunSub']) && $_POST['sunSub'] == "on") {
             $this->set_subSunday(1);
         } else {
             $this->set_subSunday(0);
         }
         if (isset($_POST['monSub']) && $_POST['monSub'] == "on") {
             $this->set_subMonday(1);
         } else {
             $this->set_subMonday(0);
         }
         if (isset($_POST['tueSub']) && $_POST['tueSub'] == "on") {
             $this->set_subTuesday(1);
         } else {
             $this->set_subTuesday(0);
         }
         if (isset($_POST['wedSub']) && $_POST['wedSub'] == "on") {
             $this->set_subWednesday(1);
         } else {
             $this->set_subWednesday(0);
         }
         if (isset($_POST['thuSub']) && $_POST['thuSub'] == "on") {
             $this->set_subThursday(1);
         } else {
             $this->set_subThursday(0);
         }
         if (isset($_POST['friSub']) && $_POST['friSub'] == "on") {
             $this->set_subFriday(1);
         } else {
             $this->set_subFriday(0);
         }
         if (isset($_POST['satSub']) && $_POST['satSub'] == "on") {
             $this->set_subSaturday(1);
         } else {
             $this->set_subSaturday(0);
         }
     } else {
         $this->set_wantToSub(0);
         $this->set_subSunday(0);
         $this->set_subMonday(0);
         $this->set_subTuesday(0);
         $this->set_subWednesday(0);
         $this->set_subThursday(0);
         $this->set_subFriday(0);
         $this->set_subSaturday(0);
     }
     if (isset($_POST['teamRep']) && $_POST['teamRep'] == "Y") {
         $this->set_wantToBeATeamRep(1);
     } else {
         $this->set_wantToBeATeamRep(0);
     }
     if (isset($_POST['referee']) && $_POST['referee'] == "Y") {
         $this->set_wantToBeARef(1);
     } else {
         $this->set_wantToBeARef(0);
     }
     if (isset($_POST['paymentPlan']) && $_POST['paymentPlan'] == "1") {
         $this->set_paymentPlan(1);
     } else {
         if (isset($_POST['paymentPlan']) && $_POST['paymentPlan'] == "2") {
             $this->set_paymentPlan(2);
         } else {
             if (isset($_POST['paymentPlan']) && $_POST['paymentPlan'] == "3") {
                 $this->set_paymentPlan(3);
             } else {
                 if (isset($_POST['paymentPlan']) && $_POST['paymentPlan'] == "4") {
                     $this->set_paymentPlan(4);
                 } else {
                     if (isset($_POST['paymentPlan']) && $_POST['paymentPlan'] == "5") {
                         $this->set_paymentPlan(1);
                     }
                 }
             }
         }
     }
     #Setup the positions comma separated value
     /** - This is no longer needed.  We set positions directly above.
     		$positions = "";		
     		if($goalie == "Y") {
     			if($defense == "Y" || $center == "Y" || $wing == "Y") {
     				$positions .= "G, ";
     			} else {
     				$positions .= "G";
     			}
     		}
     		if($defense == "Y") {
     			if($center == "Y" || $wing == "Y") {
     				$positions .= "D, ";
     			} else {
     				$positions .= "D";
     			}
     		}
     		if($center == "Y") {
     			if($wing == "Y") {
     				$positions .= "C, ";
     			} else {
     				$positions .= "C";
     			}
     		}
     		if($wing == "Y") {
     			$positions .= "W";
     		}
     		$this->set_position($positions);
     		*/
     if (isset($_POST['drilLeague']) && $_POST['drilLeague']) {
         $this->set_drilLeague($_POST['drilLeague']);
     }
     //Required
     if (isset($_POST['payToday']) && $_POST['payToday'] == "on") {
         $this->set_payToday(1);
     } else {
         $this->set_payToday(0);
     }
     if (isset($_POST['usaHockeyMembership']) && $_POST['usaHockeyMembership']) {
         $this->set_usaHockeyMembership(format_trim(strtoupper($_POST['usaHockeyMembership'])));
     } else {
         $this->set_usaHockeyMembership("");
     }
 }
Beispiel #5
0
function send_admin_email()
{
    require_once 'com/tcshl/mail/Mail.php';
    $emailAddress = SITEREG_EMAIL;
    $VerificationLink = DOMAIN_NAME . '/account.php';
    $fn = format_uppercase_text($_POST['firstname']);
    $ln = format_uppercase_text($_POST['lastname']);
    $em = format_trim(strtolower($_POST['email']));
    $emailBody = $fn . ' ' . $ln . '(' . $em . ') has just registered for TCSHL site membership.  Click on the following link if you need to give this account admin privileges: ';
    $emailBody .= $VerificationLink;
    //$sender,$recipients,$subject,$body
    $Mail = new Mail(VERIFICATION_EMAIL_SENDER, $emailAddress, VERIFICATION_EMAIL_SUBJECT, $emailBody);
    $Mail->sendMail();
}