<?php
include_once ("include/main.inc.php"); 
$referer = $_SERVER['HTTP_REFERER'];
$ip=$_SERVER['REMOTE_ADDR'];
$mobileNumber = "";

if (isset($_POST['submit-careers']))
{
    
$name = !empty($_POST['name'])?$_POST['name']:'';
$email = !empty($_POST['email'])?$_POST['email']:'';
$mobile = !empty($_POST['mobile'])?$_POST['mobile']:'';
$message = !empty($_POST['message'])?$_POST['message']:'';
    
    
    $docname = $_FILES['docname']['name'];
    $type = $_FILES['docname']['type'];
    $tmp_name = $_FILES['docname']['tmp_name'];
    $type = $_FILES['docname']['size'];
    $allowed_ext = ['pdf','docx','doc','jpeg','jpg','rtf'];
    $ext = pathinfo($docname, PATHINFO_EXTENSION);
    $docname_new = str_replace(' ','-',$docname);
    
    $target_path = SITE_DIR_PATH.'/uploaded-files/resumes/'.$docname_new;
    
  if(strpos($message,'#')!==false || strpos($message,'%')!==false || strpos($message,'@')!==false || strpos($message,'&')!==false || strpos($message,'~')!==false || strpos($message,'https')!==false || strpos($message,'http')!==false || strpos($message,'www')!==false || strpos($message,'?')!==false){
      $resp = [
          'message_response' => 'URL(s) and special characters are not allowed!',
          'status' => false
      ];
      echo json_encode($resp);
      exit;
  } else {    
if($name != '' && $email != '' && $mobile != '' && $message != '' && $ip != ''){
    
    //  if(in_array($ext,$allowed_ext))
    //  {

//reCAPTCHA validation
if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])) {    
     $secret = '6Ld_T_sdAAAAABDPce5lEgKlKyuBFD1fxFGluR1-';
    //get verify response data
    $data = array( 'secret' => $secret, 'response' => $_POST['g-recaptcha-response'] ); $verify = curl_init(); curl_setopt($verify, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify"); curl_setopt($verify, CURLOPT_POST, true); curl_setopt($verify, CURLOPT_POSTFIELDS, http_build_query($data)); curl_setopt($verify, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($verify, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($verify); //var_dump($response);
    $response = json_decode($response);        
if (!$response->success) { $errMsgs = 'Please click on the reCAPTCHA box.'; }         
if($response->success) { $sql_ens="insert into tbl_enquiry set en_name='$name',Enq_type='2', en_email='$email', en_mobile='$mobile', en_comment='$message', en_doc_name='$docname_new', en_url='$referer', en_ip='$ip', en_date=now()";
$qry=mysqli_query($dbcon,$sql_ens);
                        
move_uploaded_file($tmp_name, $target_path);
$subject = utf8_encode('Webpulseindia.com '.' - '. $admin_res['subject']);
$htmlContent = "
Customer Details:
Url: ".$referer."
Name: ".$name."
Email: ".$email."
Mobile: ".$mobile."
Message: ".$message."";            
/*$to = $admin_res['email'];
$to2 = $admin_res['cc'];
$to3 = 'webpulseindia@gmail.com'; */ 
 $to3 = 'webpul.webprogrammer102@gmail.com';
                     

$headers = 'From: '.'Webpulseindia.com'.' enquiry@webpulseindia.com' . "\r\n" .
'Reply-To:  '.$name.'<'.$email.'>' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($to,$subject,$htmlContent,$headers);
@mail($to2,$subject,$htmlContent,$headers);
@mail($to3,$subject,$htmlContent,$headers);
$resp = [
  'message_response' => 'Thank you for your enquiry. Our team will contact you soon.',
  'status' => true
];
echo json_encode($resp);
exit;
}  
} else { 
  $resp = [
    'message_response' => 'Robot verification failed, please try again.',
    'status' => false
  ];
  echo json_encode($resp);
  exit;
}
        //  } else { 
        //   $resp = [
        //     'message_response' => 'Please upload valid file(pdf,doc,jpeg)',
        //     'status' => false
        //   ];
        //   echo json_encode($resp);
        //   exit;
        // }
} else { 
  $resp = [
    'message_response' => 'All the fields are Mandatory!',
    'status' => false
  ];
  echo json_encode($resp);
  exit;
}
} 
}

?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="canonical" href="http://www.mangla-plastic.webpulse.site">
   <title>Careers - Mangla Plastic Industries</title>
      <meta name="description" content="Careers - Mangla Plastic Industries" />
      <meta name="keywords" content="Careers - Mangla Plastic Industries" />
  <?php include "top.php"; ?>
	
</head>
<body>
    <div class="webpulse-main-wrapper wrapper-wide" id="top">
        <?php include "header.php"; ?>
    <div class="clearfix"></div>
	<section class="heading_banner about_us_banner" style="background-image: url('<?=SITE_URL_PATH;?>/images/careers.jpg')">
  <div class="container">
    <div class="row">
      <div class="col-sm-12 col-lg-12 col-md-12 col-xl-12 col-xxl-12 text-center">
        <h1 class="cat_title">APPLY NOW</h1>
        <div class="clearfix"></div>
      </div>
    </div>
  </div>
</section>
<div class="inner_breadcrumb hidden-xs">
  <div class="container">
    <div class="row">
      <div class="col-xxl-12 col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12 col-12">
      <ul class="breadcrumb">
          <li><a href="<?=SITE_URL_PATH;?>" title="Home">Home</a></li>
           <li><a href="<?=SITE_URL_PATH;?>/career.htm" title="Our Products">Career</a></li>
        <li class="active">APPLY NOW</li>
        </ul>
      </div>
    </div>
  </div>
</div>
<section class="about_page">
  <div class="webpulse_tm_universal_title_holder">
    <div class="container">
      <div class="row">
       <div class="col-md-9 col-md-push-3">
<div class="right_side">
<h1>Apply Now</h1>
<div class="wps_right">
<p>Please submit the application for according your location area. Our admin staff of location contact you call back to you.</p>
<form method="post" id="apply_form" enctype="multipart/form-data">
                                
                    <div class="alert alert-danger career-error-message d-none"></div>
                    <div class="alert alert-success career-success-message d-none"></div>
<div class="row">
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <input tabindex="201" class="form-control" name="name" type="text"
                                                    placeholder="Your Name*" onkeypress="return ValidateAlpha(event)" required>
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                            <div class="form-group">
                                            <input type="hidden" class="countryName countryName" name="countryName" value="">
                                                <input tabindex="202" class="form-control telePhone mobile" name="mobile" type="tel"
                                                    placeholder="Your Phone No*"  required>
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <input tabindex="203" class="form-control" name="email" type="text"
                                                    placeholder="Your Email ID*" required>
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <input tabindex="207" class="form-control" value="" type="file" name="docname" id="docname" accept=
"application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint,
text/plain, application/pdf, image/*">
                                                <p class="upload">Upload Resume</p>
                                            </div>
                                        </div>
                                        <div class="col-md-12">
                                            <div class="form-group">
                                                <textarea tabindex="212" onkeypress="return ValidateAlpha(event)" class="form-control"  name="message"
                                                    placeholder="Your Message*" rows="9"></textarea>
                                            </div>
                                        </div>

                                        <div class="col-md-12">
                                            <div class="form-group" style="margin-bottom: 0;">
                                                <div tabindex="113" class="g-recaptcha"
                                                    data-sitekey="6Ld_T_sdAAAAAJYYygzCQ9I068mGeRCu_Boz7ecO"></div>
                                            </div>
                                        </div>

                                        <div class="col-md-12">
                                            <div class="form-group">
                                                <button tabindex="114" class="modal_btn" type="submit" id="submit-careers"
                                                    name="submit-careers">Submit</button>
                                            </div>
                                        </div>
                                    </div>
</form>


</div>
</div>
    </div>
          <?php include 'about-left.php';?>
          </div>
    </div>
  </div>
</section>
<?php include 'testimonail.php';?>

         <?php include "footer.php"; ?>
</div>
      <?php include "bottom.php"; ?>
</body>
</html>