]*?>.*?@si', // Strip out javascript '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags '@]*?>.*?@siU', // Strip style tags properly '@@' // Strip multi-line comments ); $inputx = preg_replace($search, '', $input); $inputx = trim($inputx); if(get_magic_quotes_gpc()) { $inputx = stripslashes($inputx); } $inputx = mysqli_real_escape_string($conn, $inputx); return $inputx; } ?> Admission Information Request Results - Graduate School of Arts and Sciences - Boston College<br>
 
Unable to locate the GSAS database at this time

'); # #} // set page vars $firstname = ''; $lastname = ''; $homeaddress = ''; $homeaddress2 = ''; $homecity = ''; $homestate = ''; $addressother = ''; $homezip = ''; $homecountry = ''; $email = ''; $phone = ''; $interest = ''; $department = ''; $date = date('Y-m-d'); // Create an empty array to hold the error messages. $arrErrors = array(); // Validate/Submit form if fields contain information, replaced trim with cleanxss 11/1/12 DL if(isset($_POST["submit"])){ if(trim($_POST["firstname"])=='') { $arrErrors["firstname"] ='Please provide your first name.'; } else { $firstname = cleanxss($_POST['firstname']); } if(trim($_POST["lastname"])=='') { $arrErrors["lastname"] ='Please provide your last name.'; } else { $lastname = cleanxss($_POST['lastname']); } if(trim($_POST["homeaddress"])=='') { $arrErrors["homeaddress"] ='Please provide your home street address.'; } else { $homeaddress = cleanxss($_POST['homeaddress']); } if(trim($_POST["homecity"])=='') { $arrErrors["homecity"] ='Please provide your city of residence.'; } else { $homecity = cleanxss($_POST['homecity']); } if(trim($_POST["homezip"])=='') { $arrErrors["homezip"] ='Please provide the zip code of your residence.'; } else { $homezip = cleanxss($_POST['homezip']); $homezip = ereg_replace("[^0-9]", "", $homezip); } if(trim($_POST["homestate"])=='Other' && trim($_POST["addressother"])=='') { $arrErrors["homestate"] ='Please provide your alternative residence area.'; } elseif(trim($_POST["homestate"])=='' && trim($_POST["addressother"])=='') { $arrErrors["homestate"] = 'Please provide your alternative residence area.'; } else { $homestate = cleanxss($_POST['homestate']); $addressother = cleanxss($_POST['addressother']); } if(trim($_POST["homecountry"])=='') { $arrErrors["homecountry"] ='Please provide the country of your residence.'; } else { $homecountry = cleanxss($_POST['homecountry']); } if(trim($_POST["email"])=='') { $arrErrors["email"] ='Please provide your email.'; } else { $email = cleanxss($_POST['email']); # if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) # { # $arrErrors["email"] ='Please enter a valid email.'; # } } if(trim($_POST["department"])=='') { $arrErrors["department"] ='Please provide the department in which you are interested.'; } else { $department = cleanxss($_POST['department']); } $phone = cleanxss($_POST['phone']); $phone = ereg_replace("[^0-9]", "", $phone); //Added this variable 11/1/12 DL $interest = ($_POST['interest']); if (count($arrErrors) == 0) { // clean up data - escape single quotes in open text fields $firstname=addslashes($firstname); $lastname=addslashes($lastname); $homeaddress=addslashes($homeaddress); $homecity=addslashes($homecity); $homezip=addslashes($homezip); $addressother=addslashes($addressother); $phone=addslashes($phone); $email=addslashes($email); $query = "INSERT into gsas_brochure_home (date,firstname,lastname,homeaddress,homeaddress2,homecity,homestate,addressother,homezip,homecountry,email,phone,interest,department) value ('$date','$firstname','$lastname','$homeaddress','$homeaddress2','$homecity','$homestate', '$addressother','$homezip','$homecountry','$email','$phone','$interest','$department')"; //execute SQL command $result = mysqli_query($conn, $query); if ($result === TRUE) { //get department name if($department==2) {$department_name="Biology";} if($department==4) {$department_name="Chemistry";} if($department==52) {$department_name="Geology and Geophysics";} if($department==20) {$department_name="Mathematics";} if($department==24) {$department_name="Physics";} if($department==6) {$department_name="Economics";} if($department==26) {$department_name="Political Science";} if($department==28) {$department_name="Psychology";} if($department==32) {$department_name="Sociology";} if($department==18) {$department_name="Classical Studies";} if($department==10) {$department_name="English";} if($department==17) {$department_name="History";} if($department==25) {$department_name="Philosophy";} if($department==42) {$department_name="Romance Languages and Literatures";} if($department==29) {$department_name="Slavic Languages and Literatures";} if($department==36) {$department_name="Theology";} //send email to user confirming request $to = $email; $subject = "Admission Information Request"; $headers = "From: Boston College GSAS \r\n"; $body = 'Your request for a brochure for the '.$department_name.' department from the Boston College Graduate School of Arts and Sciences has been submitted. It will be sent to: '.$firstname.' '.$lastname.' '.$homeaddress.' '.$homeaddress2.' '.$homecity.', '.$homestate.$addressother.' '.$homecountry.' '; mail($to, $subject, $body, $headers); //display the requested brochures echo ' You requested a brochure for the '.$department_name.' department sent to the following adddress:

'.$firstname.' '.$lastname.'
'.$homeaddress.' '.$homeaddress2.'
'.$homecity.', '.$homestate.$addressother.'
'.$homecountry.'

An email confirming this has also been sent to the address provided. '; } else { echo "Could not input data into database at this time. Please contact site administrator"; echo mysqli_error(); } } else { echo "Go back and correct the following errors:

\n
    \n"; //display errors foreach ($arrErrors as $error) { echo "
  • "; print_r($error); echo "
  • \n"; } echo ""; } } } elseif ($type == 'download') { //connect to databse require_once ('/opt/app-conf/vars/gsas_vars.php'); $host = GSAS_DB_HOST; $user = GSAS_DB_USER; $pwd = GSAS_DB_PASSWORD; $db = GSAS_DB_NAME; $conn=mysqli_connect($host, $user, $pwd, $db); #mysql_select_db($db, $conn); if (!$conn){ die("Database connection failed: " . mysql_error()); } # if (!mysql_select_db('gsas')) { # #exit('

    Unable to locate the GSAS database at this time

    '); # #} // set page vars $firstname = ''; $lastname = ''; $homeaddress = ''; $homecity = ''; $homestate = ''; $homezip = ''; $homecountry = ''; $email = ''; $phone = ''; $Biology = ''; $Chemistry = ''; $GeologyGeophysics = ''; $Mathematics = ''; $Physics = ''; $Economics = ''; $PoliticalScience = ''; $Psychology = ''; $Sociology = ''; $ClassicalStudies = ''; $English = ''; $History = ''; $Philosophy = ''; $RomanceLanguages = ''; $SlavicLanguages = ''; $Theology = ''; $date = date('Y-m-d'); // Create an empty array to hold the error messages. $arrErrors = array(); // Validate/Submit form if fields contain information if(isset($_POST["submit"])){ if(trim($_POST["firstname"])=='') { $arrErrors["firstname"] ='Please provide your first name.'; } else { $firstname = trim($_POST['firstname']); } if(trim($_POST["lastname"])=='') { $arrErrors["lastname"] ='Please provide your last name.'; } else { $lastname = trim($_POST['lastname']); } if(trim($_POST["homeaddress"])=='') { $arrErrors["homeaddress"] ='Please provide your home street address.'; } else { $homeaddress = trim($_POST['homeaddress']); } if(trim($_POST["homecity"])=='') { $arrErrors["homecity"] ='Please provide your city of residence.'; } else { $homecity= trim($_POST['homecity']); } if(trim($_POST["homestate"])=='') { $arrErrors["homestate"] ='Please provide your state of residence.'; } else { $homestate = trim($_POST['homestate']); } if(trim($_POST["homezip"])=='') { $arrErrors["homezip"] ='Please provide the zip code of your residence.'; } else { $homezip = trim($_POST['homezip']); $homezip = ereg_replace("[^0-9]", "", $homezip); } if(trim($_POST["homecountry"])=='') { $arrErrors["homecountry"] ='Please provide the country of your residence.'; } else { $homecountry = trim($_POST['homecountry']); } if(trim($_POST["email"])=='') { $arrErrors["email"] ='Please provide your email.'; } else { $email = trim($_POST['email']); if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) { $arrErrors["email"] ='Please enter a valid email.'; } } if(trim($_POST["phone"])=='') { $arrErrors["phone"] ='Please provide your phone number.'; } else { $phone = trim($_POST['phone']); $phone = ereg_replace("[^0-9]", "", $phone); } $Biology = $_POST["Biology"]; $Chemistry = $_POST["Chemistry"]; $GeologyGeophysics = $_POST["GeologyGeophysics"]; $Mathematics = $_POST["Mathematics"]; $Physics = $_POST["Physics"]; $Economics = $_POST["Economics"]; $PoliticalScience = $_POST["PoliticalScience"]; $Psychology = $_POST["Psychology"]; $Sociology = $_POST["Sociology"]; $ClassicalStudies = $_POST["ClassicalStudies"]; $English = $_POST["English"]; $History = $_POST["History"]; $Philosophy = $_POST["Philosophy"]; $RomanceLanguages = $_POST["RomanceLanguages"]; $SlavicLanguages = $_POST["SlavicLanguages"]; $Theology = $_POST["Theology"]; $all = $Biology.$Chemistry.$GeologyGeophysics.$Mathematics.$Physics.$Economics.$PoliticalScience.$Psychology.$Sociology.$ClassicalStudies.$English.$History.$Philosophy.$RomanceLanguages.$SlavicLanguages.$Theology; if ($all == 0) { $arrErrors["brochureselect"] ='Please select at least one department.'; } if (count($arrErrors) == 0) { // clean up data - escape single quotes in open text fields $firstname=addslashes($firstname); $lastname=addslashes($lastname); $homeaddress=addslashes($homeaddress); $homecity=addslashes($homecity); $homezip=addslashes($homezip); $phone=addslashes($phone); $email=addslashes($email); $query = "INSERT into gsas_brochure_download (date,firstname,lastname,homeaddress,homecity,homestate,homezip,homecountry,email,phone,request_biology,request_chemistry,request_geology,request_mathematics,request_physics,request_economics,request_politicalscience,request_psychology,request_sociology,request_classicalstudies,request_english,request_history,request_philosophy,request_romancelanguages,request_slaviclanguages,request_theology) value ('$date','$firstname','$lastname','$homeaddress','$homecity','$homestate','$homezip','$homecountry','$email','$phone','$Biology','$Chemistry','$GeologyGeophysics','$Mathematics','$Physics','$Economics','$PoliticalScience','$Psychology','$Sociology','$ClassicalStudies','$English','$History','$Philosophy','$RomanceLanguages','$SlavicLanguages','$Theology')"; //execute SQL command $result = mysqli_query($conn, $query); if ($result === TRUE) { //display pdf links if variables are set (one for email, and one for browser) $for_email = ''; $for_browser = ''; if($Biology == 1) { $for_email .= "Biology: http://web.bc.edu/gsas/pdfs/biology09.pdf\n"; $for_browser .= "Biology (PDF)
    "; } if($Chemistry == 1) { $for_email .= "Chemistry: http://web.bc.edu/gsas/pdfs/chemistry09.pdf \n"; $for_browser .= "Chemistry (PDF)
    "; } if($GeologyGeophysics == 1) { $for_email .= "Geology and Geophysics: http://web.bc.edu/gsas/pdfs/geology09.pdf \n"; $for_browser .= "Geology and Geophysics (PDF)
    "; } if($Mathematics == 1) { $for_email .= "Mathematics: http://gsas.bc.edu/pdfs/math09.pdf\n"; $for_browser .= "Mathematics (PDF)
    "; } if($Physics == 1) { $for_email .= "Physics: http://web.bc.edu/gsas/pdfs/physics09.pdf \n"; $for_browser .= "Physics (PDF)
    "; } if($Economics == 1) { $for_email .= "Economics: http://web.bc.edu/gsas/pdfs/econ09.pdf \n"; $for_browser .= "Economics (PDF)
    "; } if($PoliticalScience == 1) { $for_email .= "Political Science: http://web.bc.edu/gsas/pdfs/political_science09.pdf \n"; $for_browser .= "Political Science (PDF)
    "; } if($Psychology == 1) { $for_email .= "Psychology: http://web.bc.edu/gsas/pdfs/psychology09.pdf \n"; $for_browser .= "Psychology (PDF)
    "; } if($Sociology == 1) { $for_email .= "Sociology: http://web.bc.edu/gsas/pdfs/sociology09.pdf \n"; $for_browser .= "Sociology (PDF)
    "; } if($ClassicalStudies == 1) { $for_email .= "Classical Studies: http://web.bc.edu/gsas/pdfs/classics09.pdf \n"; $for_browser .= "Classical Studies (PDF)
    "; } if($English == 1) { $for_email .= "English: http://web.bc.edu/gsas/pdfs/english09.pdf \n"; $for_browser .= "English (PDF)
    "; } if($History == 1) { $for_email .= "History: http://web.bc.edu/gsas/pdfs/history09.pdf \n"; $for_browser .= "History (PDF)
    "; } if($Philosophy == 1) { $for_email .= "Philosophy: http://web.bc.edu/gsas/pdfs/philosophy09.pdf \n"; $for_browser .= "Philosophy (PDF)
    "; } if($RomanceLanguages == 1) { $for_email .= "Romance Languages: http://web.bc.edu/gsas/pdfs/romance09.pdf \n"; $for_browser .= "Romance Languages (PDF)
    "; } if($SlavicLanguages == 1) { $for_email .= "Slavic Languages: http://web.bc.edu/gsas/pdfs/slavic09.pdf \n"; $for_browser .= "Slavic Languages (PDF)
    "; } if($Theology == 1) { $for_email .= "Theology: http://web.bc.edu/gsas/pdfs/theology09.pdf \n"; $for_browser .= "Theology (PDF)
    "; } //send email to user with links $to = $email; $subject = "Admission Information Request"; $headers = "From: Boston College GSAS \r\n"; $body = 'The links to the Boston College Graduate School of Arts and Sciences brochures you requested are below: '.$for_email.' PDF files require Adobe Acrobat Reader. If you cannot open them, download the free reader now: http://www.adobe.com/products/acrobat/readstep2.html '; mail($to, $subject, $body, $headers); //display the requested brochures echo ' The links to the brochures you requested are below

    An email with this information has also been sent to the address you provided

    '.$for_browser.'

    PDF files require Adobe Acrobat Reader. If you cannot open them, download the free reader now. '; } else { echo "Could not input data into database at this time. Please contact site administrator"; echo mysqli_error(); } } else { echo "Go back and correct the following errors:

    \n
      \n"; //display errors foreach ($arrErrors as $error) { echo "
    • "; print_r($error); echo "
    • \n"; } echo ""; } } } else { echo "Didn't work, sorry. Contact site admin"; } ?>