/
var
/
www
/
html
/
stengineers
/
admin
/
api
/
Upload FileeE
HOME
<?php header('Access-Control-Allow-Origin: *'); require_once('dbconnection.php'); error_reporting(0); // print_r($_POST);exit; $action = $_POST['action']; $ref = $_POST['referer']; if($ref=='ezioaws') { if($action=='addcareer') { $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $ufile = $_POST['ufile']; $designation = $_POST['sdesig']; $dates = date("Y-m-d"); require "mailer/PHPMailerAutoload.php"; $mail = new PHPMailer; $mail->IsSMTP(); $mail->Host = 'smtp.hostinger.com'; // Specify main and backup server $mail->Port = 465; // Set the SMTP port $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'contact@stengineers.com'; // SMTP username $mail->Password = 'Contact@ST24'; // SMTP password $mail->SMTPSecure = 'ssl'; // Enable encryption, 'ssl' also accepted $mail->setFrom('contact@stengineers.com',"Thank You for Applying"); $mail->AddAddress($email, "Thank You for Applying"); // Add a recipient $mail->IsHTML(true); // Set email format to HTML $mail->Subject = "Thank You for Applying"; $mail->Body = "<p>Hi <b>$name</b>,</p><p>Thanks for taking the time to apply for the position of $designation. We appreciate your interest in <b>Desher Publishing Services, </b><br>Our HR Department will be in contact with you. <br><br>Take care!<br><b>Team, Desher Publishing Services!</b> </p>"; if(!$mail->send()) { $json['status']= 'failed'; $json['message']= "We were unable to send your request.Please try again"; } else { $mail = new PHPMailer; $mail->IsSMTP(); $mail->Host = 'smtp.hostinger.com'; // Specify main and backup server $mail->Port = 465; // Set the SMTP port $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'contact@stengineers.com'; // SMTP username $mail->Password = 'Contact@ST24'; // SMTP password $mail->SMTPSecure = 'ssl'; // Enable encryption, 'ssl' also accepted $mail->setFrom('contact@stengineers.com',"Job Application"); $mail->AddAddress("onlinesupport@stengineers.com", "Job Application"); // Add a recipient $mail->addAttachment($ufile); $mail->IsHTML(true); // Set email format to HTML $mail->Subject = "Job Application - $designation "; $mail->Body = "<p> Good News! Received a new Job Application today for the position of <b>$designation.</b> <br><br></p><p> <b>Details :</b><br> Name : $name <br> Email ID : $email <br> Phone : $phone <br> Designation : $designation <br> <br> Take care!<br> <b>Team, Desher Publishing Services!</b></p>"; if(!$mail->send()) { $json['status']= 'failed'; $json['message']= "We were unable to send your request.Please try again"; } else { $json['status']= 'success'; $json['message']= "Your request has been sent successfully"; } } echo json_encode($json); } if($action=='resume_upload') { if ( 0 < $_FILES['file']['error'] ) { $json['status']= 'failed'; $json['message']= "Failed to Upload"; } else { if(move_uploaded_file($_FILES['file']['tmp_name'], 'career-resumes/' . $_FILES['file']['name'])) { $fname = 'career-resumes/' . $_FILES['file']['name']; $json['status']= 'success'; $json['message']= $fname; } else { $json['status']= 'failed'; $json['message']= "Failed to Upload"; } } echo json_encode($json); } if($action=='add_job_details') { $jobcode = $_POST['jobcode']; $msgs = $_POST['jobdesc']; $designation = $_POST['designation']; $experience = $_POST['experience']; $jobtype = $_POST['jobtype']; $education = $_POST['education']; $location = $_POST['location']; $fieldexp = $_POST['fieldexp']; $status = $_POST['status']; $msgs = str_replace("'", "", $msgs); //$msgs = str_replace("div", "p", $msgs); $msgs = preg_replace('/font-family.+?;/', "", $msgs); $msgs = preg_replace('/font-size.+?;/', "", $msgs); $dates = date("Y-m-d"); $sql = "INSERT INTO job_details (jobcode,jobdesc,designation,experience,jobtype,education,location,fieldexp,status,created_at) VALUES ('$jobcode','$msgs','$designation','$experience','$jobtype','$education','$location','$fieldexp','$status','$dates')"; $sqlres = mysqli_query($con, $sql); if ($sqlres) { $json['status']= 'success'; $json['message']= "Added Successfully"; }else{ $json['status']= 'failed'; $json['message']= "Failed to Add"; } echo json_encode($json); } if($action=='delete') { $id=$_POST['id']; $sql = "DELETE FROM job_details WHERE id='$id'"; $msg = mysqli_query($con, $sql); if($msg) { $json['status']='success'; $json['message']="Deleted Successfully"; } else { $json['status']='failed'; $json['message']="Failed to Delete"; } echo json_encode($json); } if($action=='edit') { $id = $_POST['id']; $ss = "select * from job_details as a where a.id='$id'"; $ress = mysqli_query($con, $ss); $nums = mysqli_num_rows($ress); if ($nums == 0) { $json['status']='failed'; $json['message']="No Pages Found"; echo json_encode($json); } else { $carrs = array(); $sqls = "select * from job_details as a where a.id='$id'"; $selecteds = mysqli_query($con, $sqls); $rows = mysqli_fetch_assoc($selecteds); $carrs[] = $rows; $tvals = json_encode($carrs); print_r($tvals); } } if($action=='update_job_details') { $jobcode = $_POST['jobcode']; $msgs = $_POST['jobdesc']; $designation = $_POST['designation']; $experience = $_POST['experience']; $jobtype = $_POST['jobtype']; $education = $_POST['education']; $location = $_POST['location']; $fieldexp = $_POST['fieldexp']; $status = $_POST['status']; $dates = date("Y-m-d"); $id = $_POST['id']; $msgs = str_replace("'", "", $msgs); //$msgs = str_replace("div", "p", $msgs); $blog_img = $_POST['blog_img']; $thumb_img = $_POST['thumb_img']; $msgs = preg_replace('/font-family.+?;/', "", $msgs); $msgs = preg_replace('/font-size.+?;/', "", $msgs); $sql = "UPDATE job_details SET jobcode='$jobcode', jobdesc='$msgs', designation='$designation', experience='$experience', location='$location', fieldexp='$fieldexp', status='$status', jobtype='$jobtype', education='$education' WHERE id='$id'"; $msg = mysqli_query($con, $sql); if($msg) { $json['status']='success'; $json['message']="Updated Successfully"; } else { $json['status']='failed'; $json['message']="Failed to Update"; } echo json_encode($json); } if($action=='selectcareer') { $s = "SELECT * FROM job_details"; $res = mysqli_query($con, $s); $num = mysqli_num_rows($res); if ($num == 0) { $json['status']='failed'; $json['message']="No Data Found"; echo json_encode($json); } else { $carr = array(); $sql = "SELECT * FROM job_details"; $selected = mysqli_query($con, $sql); while($row = mysqli_fetch_assoc($selected)) { $carr[] = $row; } $tvals = json_encode($carr); print_r($tvals); } } if($action=='selectcareerforwebsite') { $s = "SELECT * FROM job_details where status='active'"; $res = mysqli_query($con, $s); $num = mysqli_num_rows($res); if ($num == 0) { $json['status']='failed'; $json['message']="No Data Found"; echo json_encode($json); } else { $carr = array(); $sql = "SELECT * FROM job_details where status='active'"; $selected = mysqli_query($con, $sql); while($row = mysqli_fetch_assoc($selected)) { $carr[] = $row; } $tvals = json_encode($carr); print_r($tvals); } } if($action=='designation_list') { $s = "SELECT * FROM job_details where status='active'"; $res = mysqli_query($con, $s); $num = mysqli_num_rows($res); if ($num == 0) { $json['status']='failed'; $json['message']="No Data Found"; echo json_encode($json); } else { $carr = array(); $sql = "SELECT id,designation,'' as designation_count FROM job_details where status='active'"; $selected = mysqli_query($con, $sql); while($row = mysqli_fetch_assoc($selected)) { $carr[] = $row; } for ($i=0; $i <count($carr) ; $i++) { $id = $carr[$i]['id']; $row3=mysqli_query($con,"select COUNT(id) as des_count from careers as a where a.designation_id='$id'"); $row4=mysqli_fetch_array($row3); $carr[$i]['designation_count'] = $row4['des_count']; } $tvals = json_encode($carr); print_r($tvals); } } if($action=='careerlist') { $id = $_POST['designation_id']; $s = "SELECT * FROM careers where designation_id='$id'"; $res = mysqli_query($con, $s); $num = mysqli_num_rows($res); if ($num == 0) { $json['status']='failed'; $json['message']="No Data Found"; echo json_encode($json); } else { $carr = array(); $sql = "SELECT * FROM careers where designation_id='$id'"; $selected = mysqli_query($con, $sql); while($row = mysqli_fetch_assoc($selected)) { $carr[] = $row; } $tvals = json_encode($carr); print_r($tvals); } } }else{ $json['status']='failed'; $json['message']="Access Denied"; echo json_encode($json); } ?>