include 'inc/global.php'; include $config['include_path'] . "/functions.php"; $ip = $_SERVER['REMOTE_ADDR']; $action = trim($_REQUEST['action']); $errors = array(); $err_msg = ''; $error_upload = FALSE; $activities = array(); if($action == 'upload') { $name = trim($_POST['name']); $lastName = trim($_POST['lastName']); $email = trim($_POST['email']); $email = strtolower($email); $phone = trim($_POST['phone']); $cellphone = trim($_POST['cellphone']); $bdate = trim($_POST['bdate']); $address = trim($_POST['address']); $city = trim($_POST['city']); $state = trim($_POST['state']); $zip = trim($_POST['zip']); $occupation = trim($_POST['occupation']); $activities = $_POST['activities']; if(is_array($activities) === FALSE) { $activities = array(); } $consentName = trim($_POST['consentName']); $participantname = trim($_POST['participantname']); $participantphone = trim($_POST['participantphone']); $healtcard = trim(num_only($_POST['healtcard'])); $emergencyContact = trim($_POST['emergencyContact']); $relationship = trim($_POST['relationship']); $emergencyPhone = trim($_POST['emergencyPhone']); $allergies = trim($_POST['allergies']); $healthConditions = trim($_POST['healthConditions']); $accept = $_POST['accept']; if(strlen($name) == 0) { $errors[] = "Please enter your first name"; } if(strlen($lastName) == 0) { $errors[] = "Please enter your last name"; } if(strlen($email) == 0) { $errors[] = "Please enter a valid email address"; } elseif(validate_email($email) === FALSE) { $errors[] = "Please enter a valid email address"; } if(strlen($phone) == 0) { $errors[] = "Please enter your phone number"; } elseif(validate_phone($phone) === FALSE) { $errors[] = "Please enter a valid phone number"; } if(strlen($cellphone) == 0) { $errors[] = "Please enter parents cell phone number"; } elseif(validate_phone($cellphone) === FALSE) { $errors[] = "Please enter a valid cell phone number"; } if($bdate == 0) { $errors[] = "Please enter your date of birth"; } if(strlen($address) == 0) { $errors[] = "Please enter your address"; } if(strlen($city) == 0) { $errors[] = "Please enter your city"; } elseif(preg_match("/^[a-zA-Z\s-]+$/i", $city) === 0) { $errors[] = "City must only include letters, dashes, or spaces"; } if(strlen($state) == 0) { $errors[] = "Please select your state"; } if(strlen($zip) == 0) { $errors[] = "Please enter your zip (numbers only)"; } if(strlen($occupation) == 0) { $errors[] = "Please enter Parent's occupation"; } if(sizeof($activities) == 0) { $errors[] = "You didn't select any activities"; } if(strlen($consentName) == 0) { $errors[] = "Please enter Parent's or Guardian's name in consent form"; } if(strlen($participantname) == 0) { $errors[] = "Please enter participant's name"; } if(strlen($participantphone) == 0) { $errors[] = "Please enter Parent's or Guardian's phone number"; } elseif(validate_phone($participantphone) === FALSE) { $errors[] = "Please enter a valid Parent's or Guardian's phone number"; } if(strlen($healtcard) == 0) { $errors[] = "Please enter the health card number (numbers only no spaces )"; } if(strlen($emergencyContact) == 0) { $errors[] = "Please enter emergency contact's name"; } if(strlen($relationship) == 0) { $errors[] = "Please enter the relationship of emergency contact"; } if(strlen($emergencyPhone) == 0) { $errors[] = "Please enter emergency phone number"; } elseif(validate_phone($emergencyPhone) === FALSE) { $errors[] = "Please enter a valid emergency phone number"; } if($accept !== '1') { $errors[] = "You have to accept the terms & conditions"; } $db_activities = implode(', ', $activities); if(sizeof($errors) == 0) { $sql = " INSERT INTO upis ( name, lastName, email, phone, cellphone, bdate, address, city, state, zip, occupation, activities, consentName, participantname, participantphone, healtcard, emergencyContact, relationship, emergencyPhone, allergies, healthConditions, log_ip ) values ( :name, :lastName, :email, :phone, :cellphone, :bdate, :address, :city, :state, :zip, :occupation, :activities, :consentName, :participantname, :participantphone, :healtcard, :emergencyContact, :relationship, :emergencyPhone, :allergies, :healthConditions, :log_ip ); "; $sql = $dbh->prepare($sql); $sql->bindValue(':name', $name); $sql->bindValue(':lastName', $lastName); $sql->bindValue(':email', $email); $sql->bindValue(':phone', $phone); $sql->bindValue(':cellphone', $cellphone); $sql->bindValue(':bdate', $bdate); $sql->bindValue(':address', $address); $sql->bindValue(':city', $city); $sql->bindValue(':state', $state); $sql->bindValue(':zip', $zip); $sql->bindValue(':occupation', $occupation); $sql->bindValue(':activities', $db_activities); $sql->bindValue(':consentName', $consentName); $sql->bindValue(':participantname', $participantname); $sql->bindValue(':participantphone', $participantphone); $sql->bindValue(':healtcard', $healtcard); $sql->bindValue(':emergencyContact', $emergencyContact); $sql->bindValue(':relationship', $relationship); $sql->bindValue(':emergencyPhone', $emergencyPhone); $sql->bindValue(':allergies', $allergies); $sql->bindValue(':healthConditions', $healthConditions); $sql->bindValue(':log_ip', $ip); $sql->execute(); $to = "info@oplenac.ca"; $subject = "Oplenac - Upisnica"; $headers = "From: info@oplenac.ca"; $message = "Stigla je nova upisnica za Oplenac.\nZa proveru podataka kliknite:\n\nhttp://oplenac.ca/upis/data"; $sent = mail($to, $subject, $message, $headers); header('Location: thanks.php'); exit; } else { $err_msg = join('', $errors); $err_msg =<< {$err_msg} EOD; } } ?> Oplenac Registration Form / Upisnica REGISTRATION FORM / УПИСНИЦА Fields marked with * are required. First Name / Име * Last Name / Презиме * Email / Електрoнска пошта * Date of Birth / Датум Рођења * Address / Адреса * City/Town * State / Province * Choose a Province Ontario Alberta British Columbia Manitoba New Brunswick Newfoundland and Labrador Nova Scotia Prince Edward Island Quebec Saskatchewan Northwest Territories Nunavut Yukon Zip/Postal Code * Кућни Телефон / Home Phone * (Please use this format: 555-555-5555) Мобилни Родитеља / Parent's Mobile * (Please use this format: 555-555-5555) Занимање Родитеља / Parent's Occupation * Activities/Секције Please Make Your Selection *
Fields marked with * are required.