$value) { if (!isset($_POST['home_address']) OR empty($_POST['home_address'])) { $errors['home_address'] = "Please enter your home address"; } } } if (!checkPostcode($_POST['home_pcode'])) { $errors['home_pcode'] = "Please enter a valid home postcode"; } if ($_POST['term_address']) { foreach($_POST['term_address'] as $key=>$value) { if (!isset($_POST['term_address']) OR empty($_POST['term_address'])) { $errors['term_address'] = "Please enter your term address"; } } } if (!checkPostcode($_POST['term_pcode'])) { $errors['term_pcode'] = "Please enter a valid term postcode"; } if (!checkUKTelephone($_POST['home_phone'], &$intError, &$strError)) { $errors['home_phone'] = $strError; } if (!checkUKTelephone($_POST['mob_phone'], &$intError, &$strError)) { $errors['mob_phone'] = $strError; } if (!checkEmail($_POST['email'])) { $errors['email'] = "Please enter a valid email address"; } if (!isset($_POST['country']) OR empty($_POST['country'])) { $errors['country'] = "Please select your nationality"; } if (!isset($_POST['dobDay']) OR empty($_POST['dobDay'])) { $errors['dobDay'] = "Please select the day of your Date of Birth"; } if (!isset($_POST['dobMonth']) OR empty($_POST['dobMonth'])) { $errors['dobMonth'] = "Please select the month of your Date of Birth"; } if (!isset($_POST['dobYear']) OR empty($_POST['dobYear'])) { $errors['dobYear'] = "Please enter the year of your Date of Birth"; } if (!isset($_POST['objective']) OR empty($_POST['objective'])) { $errors['objective'] = "Please state your objective"; } if (!isset($_POST['preference']) OR empty($_POST['preference'])) { $errors['preference'] = "Please state your preference"; } if (!isset($_POST['skills']) OR empty($_POST['skills'])) { $errors['skills'] = "Please state your skills"; } if (!isset($_POST['photograph']) && empty($_POST['photograph'])) { $errors['photograph'] = "Please upload your photograph"; } if($_FILES['photograph']['size'] < $_POST['MAX_FILE_SIZE']) { if(($_FILES['photograph']['type'] != 'image/gif') && ($_FILES['photograph']['type'] != 'image/jpeg')) { $errors['photograph'] = "The photograph must be a jpg/gif"; } } return $errors; var_dump($_POST['photograph']); } function print_errors($errors) { echo "

"; print_form(); } function process_form() { echo ""; foreach($_FILES['photograph'] as $key=>$value) { echo ""; } echo "
". $key . "". $value . "
"; // if (is_uploaded_file($_FILES['photograph']['tmp_name'])) // { // echo "File ". $_FILES['photograph']['name'] ." uploaded successfully.\n"; // } // else // { // echo "Possible file upload attack: "; // echo "filename '". $_FILES['photograph']['tmp_name'] . "'."; // } } function checkUKTelephone (&$strTelephoneNumber, &$intError, &$strError) { // Copy the parameter and strip out the spaces $strTelephoneNumberCopy = str_replace (' ', '', $strTelephoneNumber); // Convert into a string and check that we were provided with something if (empty($strTelephoneNumberCopy)) { $intError = 1; $strError = 'Telephone number not provided'; return false; } // Don't allow country codes to be included (assumes a leading "+") if (ereg('^(\+)[\s]*(.*)$',$strTelephoneNumberCopy)) { $intError = 2; $strError = 'UK telephone number without the country code, please'; return false; } // Remove hyphens - they are not part of a telephine number $strTelephoneNumberCopy = str_replace ('-', '', $strTelephoneNumberCopy); // Now check that all the characters are digits if (!ereg('^[0-9]{10,11}$',$strTelephoneNumberCopy)) { $intError = 3; $strError = 'UK telephone numbers should contain 10 or 11 digits'; return false; } // Now check that the first digit is 0 if (!ereg('^0[0-9]{9,10}$',$strTelephoneNumberCopy)) { $intError = 4; $strError = 'The telephone number should start with a 0'; return false; } // Finally, check that the telephone number is appropriate. if (!ereg('^(01|02|03|05|070|077|07624|078|079)[0-9]+$',$strTelephoneNumberCopy)) { $intError = 5; $strError = 'The telephone number is either invalid or inappropriate'; return false; } // Seems to be valid - return the stripped telephone number $strTelephoneNumber = $strTelephoneNumberCopy; $intError = 0; $strError = ''; return true; } function checkEmail($email) { // First, we check that there's one @ symbol, and that the lengths are right if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. return false; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } function checkPostcode (&$toCheck) { // Permitted letters depend upon their position in the postcode. $alpha1 = "[abcdefghijklmnoprstuwyz]"; // Character 1 $alpha2 = "[abcdefghklmnopqrstuvwxy]"; // Character 2 $alpha3 = "[abcdefghjkstuw]"; // Character 3 $alpha4 = "[abehmnprvwxy]"; // Character 4 $alpha5 = "[abdefghjlnpqrstuwxyz]"; // Character 5 // Expression for postcodes: AN NAA, ANN NAA, AAN NAA, and AANN NAA $pcexp[0] = '^('.$alpha1.'{1}'.$alpha2.'{0,1}[0-9]{1,2})([0-9]{1}'.$alpha5.'{2})$'; // Expression for postcodes: ANA NAA $pcexp[1] = '^('.$alpha1.'{1}[0-9]{1}'.$alpha3.'{1})([0-9]{1}'.$alpha5.'{2})$'; // Expression for postcodes: AANA NAA $pcexp[2] = '^('.$alpha1.'{1}'.$alpha2.'[0-9]{1}'.$alpha4.')([0-9]{1}'.$alpha5.'{2})$'; // Exception for the special postcode GIR 0AA $pcexp[3] = '^(gir)(0aa)$'; // Standard BFPO numbers $pcexp[4] = '^(bfpo)([0-9]{1,4})$'; // c/o BFPO numbers $pcexp[5] = '^(bfpo)(c\/o[0-9]{1,3})$'; // Load up the string to check, converting into lowercase and removing spaces $postcode = strtolower($toCheck); $postcode = str_replace (' ', '', $postcode); // Assume we are not going to find a valid postcode $valid = false; // Check the string against the six types of postcodes foreach ($pcexp as $regexp) { if (ereg($regexp,$postcode, $matches)) { // Load new postcode back into the form element $toCheck = strtoupper ($matches[1] . ' ' . $matches [2]); // Take account of the special BFPO c/o format $toCheck = ereg_replace ('C\/O', 'c/o ', $toCheck); // Remember that we have found that the code is valid and break from loop $valid = true; break; } } // Return with the reformatted valid postcode in uppercase if the postcode was // valid if ($valid){return true;} else {return false;}; } function print_form() { $days = ''; for ($x = 1; $x <= 31; $x++) { $days .= ""; } $months = ''; for ($x = 1; $x <= 12; $x++) { $months .= ""; } $current_year = date('Y'); $min_age = 5; $max_age = 99; $y = $current_year - $min_age; $years = ""; for ($x = $y; $x >= ($current_year - $max_age); $x--) { $years .= ""; } printf(' Erasmus CV Generator

Erasmus CV Generator


Gender:
Full Name:
Course:
Home Address:
 
 
 
Postcode:
Term Address:
 
 
 
Postcode:
Home Phone Number:
Mobile Phone Number:
Email:
Nationality:
Date of Birth:
Objective:
Placement Preference:
Transferable skills:

Please upload your photograph. The file must be gif/jpeg format and less than 80 KB in size.

Select Picture:
 
', $_SERVER["PHP_SELF"], $days, $months, $years); } ?>