]*?>.*?@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; } ?>
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) { #echo "Result2 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)