Careers Current Openings Apply Now
if(isset($_POST["Submit"]))
{
check_form();
}
function check_email_address($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 check_form()
{
// Read POST request params into global vars
$to = "jobs@neostructo.com";
$from = $_POST["Email"] ;
$fname = $_POST["FName"] ;
$lname = $_POST["LName"] ;
$phone = $_POST["Phone"] ;
$qualification = $_POST["Qualification"] ;
$ypassing = $_POST["YPassing"] ;
$institute = $_POST["Institute"] ;
$experience = $_POST["Experience"] ;
$organization = $_POST["Organization"] ;
$from_date = $_POST["From_Date"] ;
$to_date = $_POST["To_Date"] ;
$designation = $_POST["Designation"] ;
$location = $_POST["Location"] ;
$remuneration = $_POST["Remuneration"] ;
$headers = "From: $from";
$subject = "From: Website Application";
$fields = array();
$fields{"FName"} = "FName";
$fields{"LName"} = "LName";
$fields{"Phone"} = "Phone";
$fields{"Email"} = "Email";
$fields{"Qualification"} = "Qualification";
$fields{"YPassing"}= "YPassing";
$fields{"Institute"} = "Institute";
$fields{"Experience"}= "Experience";
$fields{"Organization"} = "Organization";
$fields{"From_Date"}= "From_Date";
$fields{"To_Date"} = "To_Date";
$fields{"Designation"}= "Designation";
$fields{"Location"} = "Location";
$fields{"Remuneration"}= "Remuneration";
$body = "We have received the following information:\n\n";
foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$body .= $check_msg;
$headers2 = "From: jobs@neostructo.com";
$subject2 = "Thank you for applying to Neo Structo";
$autoreply = "Thank you for contacting us. Your information has been submitted. A Neo Structo team member will contact you soon.";
$fileatt = $_FILES['fileatt']['tmp_name'];
$fileatt_type = $_FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];
if (is_uploaded_file($fileatt)) {
// Read the file to be attached ('rb' = read binary)
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
// Generate a boundary string
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Add the headers for a file attachment
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
// Add a multipart boundary above the plain message
$body = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$body . "\n\n";
// Base64 encode the file data
$data = chunk_split(base64_encode($data));
// Add file attachment to the message
$body .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
}
if($fname=="")
{
$message="Please type in your First Name to proceed!
"; } elseif($lname=="") { $message.="Please type in your Last Name to proceed!
"; } elseif(!check_email_address($from)) { $message.="Please enter a valid email address to proceed!
"; $_POST["Email"] = ""; } elseif($phone=="") { $message="Please type in your Phone No to proceed!
"; } elseif($qualification=="") { $message="Please type in your Qualification to proceed!
"; } elseif($ypassing=="") { $message="Please type in your Year of Pssing to proceed!
"; } elseif($institute=="") { $message="Please type in your Institute to proceed!
"; } elseif($experience=="" ) { $message="Please select if you have experience to proceed!
"; } elseif($experience=="Yes" && $organization=="") { $message="Please type in your current Organization to proceed!
"; } elseif($experience=="Yes" && $from_date=="") { $message="Please type in your From Date to proceed!
"; } elseif($experience=="Yes" && $to_date=="") { $message="Please type in your To_Date to proceed!
"; } elseif($experience=="Yes" && $designation=="") { $message="Please type in your current Designation to proceed!
"; } elseif($experience=="Yes" && $location=="") { $message="Please type in your current Location to proceed!
"; } elseif($experience=="Yes" && $remuneration=="") { $message="Please type in your current remuneration to proceed!
"; } elseif($fileatt=="") { $message.="Please attach your resume!
"; } else { $send = @mail($to, $subject, $body, $headers); $send2 = mail($from, $subject2, $autoreply, $headers2); if($send) { $message="Thank you for contacting Neo Structo."; $_POST["FName"] = ""; $_POST["LName"] = ""; $_POST["Phone"] = ""; $_POST["Email"] = ""; $_POST["YPassing"] = ""; $_POST["Institute"] = ""; $_POST["Qualification"] = ""; } else {$message= "Oops! We encountered an error while sending emailing you. Please notify webmaster@gepil.in"; } } ?>
"; } elseif($lname=="") { $message.="Please type in your Last Name to proceed!
"; } elseif(!check_email_address($from)) { $message.="Please enter a valid email address to proceed!
"; $_POST["Email"] = ""; } elseif($phone=="") { $message="Please type in your Phone No to proceed!
"; } elseif($qualification=="") { $message="Please type in your Qualification to proceed!
"; } elseif($ypassing=="") { $message="Please type in your Year of Pssing to proceed!
"; } elseif($institute=="") { $message="Please type in your Institute to proceed!
"; } elseif($experience=="" ) { $message="Please select if you have experience to proceed!
"; } elseif($experience=="Yes" && $organization=="") { $message="Please type in your current Organization to proceed!
"; } elseif($experience=="Yes" && $from_date=="") { $message="Please type in your From Date to proceed!
"; } elseif($experience=="Yes" && $to_date=="") { $message="Please type in your To_Date to proceed!
"; } elseif($experience=="Yes" && $designation=="") { $message="Please type in your current Designation to proceed!
"; } elseif($experience=="Yes" && $location=="") { $message="Please type in your current Location to proceed!
"; } elseif($experience=="Yes" && $remuneration=="") { $message="Please type in your current remuneration to proceed!
"; } elseif($fileatt=="") { $message.="Please attach your resume!
"; } else { $send = @mail($to, $subject, $body, $headers); $send2 = mail($from, $subject2, $autoreply, $headers2); if($send) { $message="Thank you for contacting Neo Structo."; $_POST["FName"] = ""; $_POST["LName"] = ""; $_POST["Phone"] = ""; $_POST["Email"] = ""; $_POST["YPassing"] = ""; $_POST["Institute"] = ""; $_POST["Qualification"] = ""; } else {$message= "Oops! We encountered an error while sending emailing you. Please notify webmaster@gepil.in"; } } ?>



