uniformsubmit

“; print_r($_POST); print_r($_FILES); echo “

“;
exit;*/

// TO AND FROM
$email_to = “[email protected]”;
$email_subject = “Message from Education Providers!”;

function died($error) {
// ERROR MESSAGES TO THE USER
echo “We are very sorry, but there were error(s) found with the form you submitted. “;
echo “These errors appear below.

“;
echo $error.”

“;
echo “Please go back and fix these errors.

“;
die();
}

// VALIDATION ON EXPECTED DATA
if(!isset($_POST[‘university_name’], $_POST[‘university_email’]) ||
!isset($_POST[‘country_name’]) ||
!isset($_POST[‘university_website’]) ||
!isset($_POST[‘university_address’]) ||
!isset($_POST[‘contact_person’]) ||
!isset($_POST[‘overview’]) ||
!isset($_POST[‘intakes’]) ||
!isset($_POST[‘requirements’])) {
died(‘We are sorry, but there appears to be a problem with the form you submitted.’);
}

$name_from = $_POST[‘university_name’]; // required
$email_from = $_POST[‘university_email’]; // required
$country_name=$_POST[‘country_name’];
$university_website=$_POST[‘university_website’];
$university_address=$_POST[‘university_address’];
$contact_person=$_POST[‘contact_person’];
$overview=$_POST[‘overview’];
$intakes=$_POST[‘intakes’];
$requirements=$_POST[‘requirements’];
$partnership_form = $_FILES[‘partnership_form’]; // not required
$prospectus = $_FILES[‘prospectus’]; // not required
$admission_form = $_FILES[‘admission_form’]; // not required

// MANDATORY FIELDS
$error_message = “”;
$email_exp = ‘/^[A-Za-z0-9._%-][email protected][A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/’;
/*
$emil_exp = filter_var($email_from, FILTER_VALIDATE_EMAIL);
*/
if(!preg_match($email_exp,$email_from)) {
$error_message .= ‘The email address you entered does not appear to be valid.
‘;
}
$string_exp = “/^[A-Za-z .’-]+$/”;
if(!preg_match($string_exp,$name_from)) {
$error_message .= ‘The name you entered does not appear to be valid.
‘;
}

if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = “Services Form.\n\n”;

function clean_string($string) {
$bad = array(“content-type”,”bcc:”,”to:”,”cc:”,”href”);
return str_replace($bad,””,$string);
}

$email_message .= “University Name: “.clean_string($name_from).”\n”;
$email_message .= “University Email: “.clean_string($email_from).”\n”;
$email_message .= “Country: “.clean_string($country_name).”\n”;
$email_message .= “Website: “.clean_string($university_website).”\n”;
$email_message .= “Address: “.clean_string($university_address).”\n”;
$email_message .= “Contact Person: “.clean_string($contact_person).”\n”;
$email_message .= “University Overview: “.clean_string($overview).”\n”;
$email_message .= “Intakes: “.clean_string($intakes).”\n”;
$email_message .= “Requirements: “.clean_string($requirements).”\n”;
/*$email_message .= “Partnership Form: “.clean_string($partnership_form).”\n”;
$email_message .= “Prospectus: “.clean_string($prospectus).”\n”;
$email_message .= “Admission Form: “.clean_string($admission_form).”\n”;*/

// FILE UPLOADS
$allowedExts = array(“doc”, “docx”, “gif”, “jpeg”, “jpg”, “pdf”, “png”, “psd”);

$extension = pathinfo($_FILES[‘partnership_form’][‘name’], PATHINFO_EXTENSION);
$extensionb = pathinfo($_FILES[‘prospectus’][‘name’], PATHINFO_EXTENSION);
$extensionc = pathinfo($_FILES[‘admission_form’][‘name’], PATHINFO_EXTENSION);

/*$extension = end(explode(“.”, $_FILES[“partnership_form”][“name”]));
$extensionb = end(explode(“.”, $_FILES[“prospectus”][“name”]));
$extensionc = end(explode(“.”, $_FILES[“admission_form”][“name”]));*/
$path = ‘upload/’;

if (($_FILES[“partnership_form”][“size”] < 5000000) && in_array(strtolower($extension), $allowedExts)){ if ($_FILES["partnership_form"]["error"] == 0) { $partnsership_file = "Partnership-".date('Ymdhis').rand(0,99).$extension;