</script>";
	}
	else {
		$form1Display = 'none';
		$form2Display = 'none';
		$page3Display = '';
	}
}
else {
	$form1Display = '';
	$form2Display = 'none';
	$page3Display = 'none';
}
*/
if ($thankyouDisplay == "") {
    $territoryInfo = getTerritoryInfo($_POST['state'], $territories);
    $fields_recruiter = $territoryInfo['fields_recruiter'];
    //$_POST['counselor'];
    $email = $email;
    $doRedir = $territoryInfo['doRedir'];
    // HEADS UP THIS IS A MAJOR HACK... We are giving all NY and PA to Joel for this formn, since we only get state and not the futher area breakdown
    if ($_POST['state'] == "NY" || $_POST['state'] == "PA") {
        $redir = "joel-pitt";
        $fields_recruiter = "pitt";
        $recruiter_email_handle = "*****@*****.**";
    }
    //			$redirStr = "http://www.simons-rock.edu/admission/thankyou/?email=$email&couns=$fields_recruiter&tid=$db_id";
    $redirStr = "http://www.simons-rock.edu/admission/thankyou/?email={$email}&couns={$fields_recruiter}";
    //	header("Location: $redirStr");
    ?>
<script>
function makeSQL($postArray, $formNum)
{
    foreach ($postArray as $k => $v) {
        ${$k} = $v;
    }
    if ($formNum == "0") {
        $fname = safe($fname);
        $mname = safe($mname);
        $lname = safe($lname);
        $nickname = safe($nickname);
        $street_address = safe($street_address);
        $city = safe($city);
        $state = safe($state);
        $zip = safe($zip);
        $country = safe($country);
        $email = safe($email);
        $phone = safe($phone);
        $high_school = safe($high_school);
        $high_school_city = safe($high_school_city);
        $high_school_state = safe($high_school_state);
        $high_school_country = safe($high_school_country);
        $anticipated_grad_year = safe($anticipated_grad_year);
        if (isset($nycounty) && $nycounty != "") {
            $nycounty = safe($nycounty);
        }
        if (isset($paArea) && $paArea != "") {
            $paArea = safe($paArea);
        }
        $role = "student";
        // ('student','parent','donor','alumni')
        if ($gender == "male") {
            $gender = "m";
        } else {
            if ($gender == "female") {
                $gender = "f";
            } else {
                $gender = "";
            }
        }
        $dob = $dob_year;
        $dob .= '-';
        $dob .= $dob_month;
        $dob .= '-';
        $dob .= $dob_day;
        $hash_id = makeHash($fname, $lname, $dob_year, $dob_month, $dob_day);
        $this_ethnicity = "";
        foreach ($postArray['ethnicities'] as $ethnicity) {
            if ($postArray[$ethnicity] != "") {
                $this_ethnicity .= $ethnicity . ":" . $postArray[$ethnicity];
                $this_ethnicity .= ",";
            }
        }
        if ($this_ethnicity != "") {
            $this_ethnicity = substr($this_ethnicity, 0, strlen($this_ethnicity) - 1);
        }
        // clean up for db insert
        $academic_interests = safe($academic_interests);
        $extra_curricular = safe($extra_interests);
        $three_words = safe($three_words);
        $questions_and_comments = safe($questions_and_comments);
        $ethnicity = $this_ethnicity;
        $parent1_fname = safe($parent1_fname);
        $parent1_lname = safe($parent1_lname);
        $parent1_relationship = substr($parent1_type, 0, 1);
        $parent1_email = safe($parent1_email);
        $parent1_phone = safe($parent1_phone);
        $parent1_phonetype = $parent1_phonetype;
        $parent2_fname = safe($parent2_fname);
        $parent2_lname = safe($parent2_lname);
        $parent2_relationship = substr($parent2_type, 0, 1);
        $parent2_email = safe($parent2_email);
        $parent2_phone = safe($parent2_phone);
        $parent2_phonetype = $parent2_phonetype;
        if ($mailinglist != "") {
            $mail_list = "1";
        } else {
            $mail_list = "0";
        }
        if ($additional_questions != "") {
            $call = "1";
        } else {
            $call = "0";
        }
        $sql = "INSERT INTO forms.admission_form_submission \n\t\t\t(form_id, firstname, middlename, lastname, nickname, email, role, gender, street_address, street_address_2, \n\t\t\t city, state, country, postal_code, phone, dob, high_school, high_school_city, high_school_state, \n\t\t\t high_school_country, anticipated_grad_year, academic_interests, extra_curricular, three_words, ethnicity, \n\t\t\t reference, mail_list, `call`, comment, date_submitted, vr_email, vr_campaign, vr_term, hash_id, \n\t\t\t parent1_fname, parent1_lname, parent1_relationship, parent1_email, parent1_phone, parent1_phonetype, \n\t\t\t parent2_fname, parent2_lname, parent2_relationship, parent2_email, parent2_phone, parent2_phonetype, \n\t\t\t dup_flag, typage_wedcall, typage_thcall, typage_question, counselor) \n\t\t\t   VALUES (\n\t\t\t {$formNum}, '{$fname}', '{$mname}', '{$lname}', '{$nickname}', '{$email}', '{$role}', '{$gender}', '{$street_address}', \n\t\t\t '{$street_address_2}', '{$city}', '{$state}', '{$country}', '{$zip}', '{$phone}', '{$dob}', '{$high_school}', '{$high_school_city}', \n\t\t\t '{$high_school_state}', '{$high_school_country}', '{$anticipated_grad_year}', '{$academic_interests}', '{$extra_curricular}', \n\t\t\t '{$three_words}', '{$ethnicity}', '{$how_did_you_hear}', '{$mail_list}', '{$call}', '{$questions_and_comments}', NOW(), \n\t\t\t '', '', '', '{$hash_id}', '{$parent1_fname}', '{$parent1_lname}', '{$parent1_relationship}', '{$parent1_email}', \n\t\t\t '{$parent1_phone}', '{$parent1_phonetype}', '{$parent2_fname}', '{$parent2_lname}', '{$parent2_relationship}', \n\t\t\t '{$parent2_email}', '{$parent2_phone}', '{$parent2_phonetype}', '{$dup_flag}', '', '', '', '{$counselor}')";
    } else {
        if ($formNum == "1") {
            $fname = safe($fname);
            $mname = safe($mname);
            $lname = safe($lname);
            $nickname = safe($nickname);
            $street_address = safe($street_address);
            $city = safe($city);
            $state = safe($state);
            $zip = safe($zip);
            $country = safe($country);
            $email = safe($email);
            $phone = safe($phone);
            $high_school = safe($high_school);
            $high_school_city = safe($high_school_city);
            $high_school_state = safe($high_school_state);
            $high_school_country = safe($high_school_country);
            $anticipated_grad_year = safe($anticipated_grad_year);
            if (isset($nycounty) && $nycounty != "") {
                $nycounty = safe($nycounty);
            }
            if (isset($paArea) && $paArea != "") {
                $paArea = safe($paArea);
            }
            $role = "student";
            // ('student','parent','donor','alumni')
            if ($gender == "male") {
                $gender = "m";
            } else {
                if ($gender == "female") {
                    $gender = "f";
                } else {
                    $gender = "";
                }
            }
            $dob = getDOB($dob_y, $dob_m, $dob_d);
            $hash_id = makeHash($fname, $lname, $dob_y, $dob_m, $dob_d);
            $tinfo = getTerritoryInfo($high_school_state, $territories);
            $counselor = $tinfo['fields_recruiter'];
            $sql = "INSERT INTO forms.admission_form_submission\n(form_id, firstname, middlename, lastname, nickname, email, role, gender, street_address, street_address_2, city, state, country, postal_code, phone, dob, high_school, high_school_city, high_school_state, high_school_country, anticipated_grad_year, date_submitted, vr_email, vr_campaign, vr_term, hash_id, dup_flag,counselor) \nVALUES ({$formNum}, '{$fname}', '{$mname}', '{$lname}', '{$nickname}', '{$email}', '{$role}', '{$gender}', '{$street_address}', '{$street_address_2}', '{$city}', '{$state}', '{$country}', '{$zip}', '{$phone}', '{$dob}', '{$high_school}', '{$high_school_city}', '{$high_school_state}', '{$high_school_country}', '{$anticipated_grad_year}', NOW(), '{$vr_email}', '{$vr_campaign}', '{$vr_term}', '{$hash_id}','{$dup_flag}','{$counselor}');\n";
        } else {
            $this_ethnicity = "";
            foreach ($postArray['ethnicities'] as $ethnicity) {
                if ($postArray[$ethnicity] != "") {
                    $this_ethnicity .= $ethnicity . ":" . $postArray[$ethnicity];
                    $this_ethnicity .= ",";
                }
            }
            if ($this_ethnicity != "") {
                $this_ethnicity = substr($this_ethnicity, 0, strlen($this_ethnicity) - 1);
            }
            // clean up for db insert
            $academic_interests = safe($academic_interests);
            $extra_curricular = safe($extra_interests);
            $three_words = safe($three_words);
            $additional_questions = safe($questions_and_comments);
            $ethnicity = $this_ethnicity;
            $parent1_fname = safe($parent1_fname);
            $parent1_lname = safe($parent1_lname);
            $parent1_relationship = substr($parent1_type, 0, 1);
            $parent1_email = safe($parent1_email);
            $parent1_phone = safe($parent1_phone);
            $parent1_phonetype = $parent1_phonetype;
            $parent2_fname = safe($parent2_fname);
            $parent2_lname = safe($parent2_lname);
            $parent2_relationship = substr($parent2_type, 0, 1);
            $parent2_email = safe($parent2_email);
            $parent2_phone = safe($parent2_phone);
            $parent2_phonetype = $parent2_phonetype;
            $db_id = $db_id;
            $counselor = $counselor;
            $sql = "UPDATE forms.admission_form_submission SET \n\t\t\tacademic_interests = '{$academic_interests}',\n\t\t\textra_curricular = '{$extra_curricular}',\n\t\t\tthree_words = '{$three_words}',\n\t\t\tcomment = '{$additional_questions}',\n\t\t\tethnicity = '{$ethnicity}',\n\t\t\tparent1_fname = '{$parent1_fname}',\n\t\t\tparent1_lname = '{$parent1_lname}',\n\t\t\tparent1_relationship = '{$parent1_relationship}',\n\t\t\tparent1_email = '{$parent1_email}',\n\t\t\tparent1_phone = '{$parent1_phone}',\n\t\t\tparent1_phonetype = '{$parent1_phonetype}',\n\t\t\tparent2_fname = '{$parent2_fname}',\n\t\t\tparent2_lname = '{$parent2_lname}',\n\t\t\tparent2_relationship = '{$parent2_relationship}',\n\t\t\tparent2_email = '{$parent2_email}',\n\t\t\tparent2_phone = '{$parent2_phone}',\n\t\t\tparent2_phonetype = '{$parent2_phonetype}',\n\t\t\tcounselor = '{$counselor}' \n\t\t\t\tWHERE id = {$db_id}";
        }
    }
    return $sql;
}
            $headers = "From: {$from}\r\n";
            $headers .= 'Cc: recruit@simons-rock.edu' . "\r\n";
            $headers .= 'Bcc: dscheff@simons-rock.edu' . "\r\n";
            if (!$test_env) {
                if (!isset($recruiter_email_handle)) {
                    $recruiter_email_handle = getCounselorEmailHandle($_POST['counselor']);
                }
                mail($recruiter_email_handle, $emailArray['subj'], $emailArray['body'], $headers);
            }
            $emailArray['body'] .= "\n\nRECRUITER EMAIL HANDLE: {$recruiter_email_handle}\n\n";
            $emailArray['body'] .= "\n\nPATH: {$redirStr}\n\n";
            $headers = "From: {$from}\r\n";
            mail("*****@*****.**", $emailArray['subj'], $emailArray['body'], $headers);
        }
        if ($doRedir == true && $formNum == 2) {
            $territoryInfo = getTerritoryInfo($territory, $territories);
            $fields_recruiter = $_POST['counselor'];
            $email = $email;
            $doRedir = $territoryInfo['doRedir'];
            $redirStr = "http://forms.simons-rock.edu/admission/thankyou.php?email={$email}&couns={$fields_recruiter}&tid={$db_id}";
            header("Location: {$redirStr}");
        }
    }
}
if ($doRedir) {
    if ($formNum == '1') {
        $form1Display = 'none';
        $form2Display = '';
        echo "\r\n\t\t\t<script>\r\n\t\t\t\tdocument.getElementById('left').style.display='none';\r\n\t\t\t\tdocument.getElementById('right').style.width='1020px';\r\n\t\t\t\tdocument.getElementById('right').style.float='left';\r\n\t\t\t\tdocument.getElementById('righttop').style.width='1018px';\r\n\t\t\t\t\r\n\t\t\t</script>";
        $page3Display = 'none';
    } else {
Exemple #4
0
<?php

$email = $_REQUEST['email'];
$couns = $_REQUEST['couns'];
$tinfo = getTerritoryInfo($_REQUEST['state'], $territories);
$couns = $tinfo['fields_recruiter'];
if ($couns == "davidson") {
    $pic = "leslie-globe.gif";
    $couns_name = "Leslie Davidson";
    $couns_fname = "Leslie";
    $couns_pron = "her";
} elseif ($couns == "pitt") {
    $pic = "joel-sml.jpg";
    $couns_name = "Joel Pitt";
    $couns_fname = "Joel";
    $couns_pron = "him";
} elseif ($couns == "dubrowski") {
    $pic = "amanda-thumb.jpg";
    $couns_name = "Amanda Dubrowski";
    $couns_fname = "Amanda";
    $couns_pron = "her";
} elseif ($couns == "corso") {
    $pic = "joe-sml.jpg";
    $couns_name = "Joe Corso";
    $couns_fname = "Joe";
    $couns_pron = "him";
} elseif ($couns == "taylor") {
    $pic = "aft-headshot.jpg";
    $couns_name = "Alexandra Taylor";
    $couns_fname = "Alexandra";
    $couns_pron = "her";