Advertisement
Guest User

Untitled

a guest
Mar 18th, 2017
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.66 KB | None | 0 0
  1. <?php
  2.  
  3. if($_POST['id_email'] == '') {
  4. header('Location: applynow.php?failure');
  5. }
  6. else {
  7.  
  8. require('admin/fpdf.php');
  9.  
  10. class PDF extends FPDF
  11. {
  12. // Page header
  13. function Header()
  14. {
  15. // Logo
  16. $this->Image('admin/logo.png',10,6,30);
  17. // Arial bold 15
  18. $this->SetFont('Arial','B',15);
  19. // Move to the right
  20. $this->Cell(80);
  21. // Title
  22. $this->Cell(50,10,'Job Application',1,0,'C');
  23. // Line break
  24. $this->Ln(20);
  25. }
  26.  
  27. // Page footer
  28. function Footer()
  29. {
  30. // Position at 1.5 cm from bottom
  31. $this->SetY(-15);
  32. // Arial italic 8
  33. $this->SetFont('Arial','I',8);
  34. // Page number
  35. $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
  36. }
  37. }
  38.  
  39. function mail_attachment ($to, $subject, $message, $attachment){
  40. $from = 'abc@domain.com';#
  41. $fileatt = $attachment; // Path to the file
  42. $fileatt_type = "application/octet-stream"; // File Type
  43.  
  44. $start = strrpos($attachment, '/') == -1 ?
  45. strrpos($attachment, '//') : strrpos($attachment, '/')+1;
  46.  
  47. $fileatt_name = substr($attachment, $start, strlen($attachment));
  48.  
  49. $email_from = $from; // Who the email is from
  50. //$subject = "New Attachment Message";
  51.  
  52. $email_subject = $subject; // The Subject of the email
  53. $email_txt = $message; // Message that the email has in it
  54. #$email_to = $to; // Who the email is to
  55. $email_to = $_POST['id_email'];
  56.  
  57. $headers = "From: abc@domain.com";
  58. $file = fopen($fileatt,'rb');
  59. $data = fread($file,filesize($fileatt));
  60. fclose($file);
  61.  
  62. $msg_txt="nn You have recieved a new attachment message from $from";
  63. $semi_rand = md5(time());
  64. $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
  65. $headers .= "nMIME-Version: 1.0n" . "Content-Type: multipart/mixed;n" . "
  66. boundary="{$mime_boundary}"";
  67.  
  68. $email_txt .= $msg_txt;
  69.  
  70. $email_message = "This is a multi-part message in MIME format.nn" .
  71. "--{$mime_boundary}n" . "Content-Type:text/html;
  72. charset = "iso-8859-1"n" . "Content-Transfer-Encoding: 7bitnn" .
  73. $email_txt . "nn";
  74.  
  75. $data = chunk_split(base64_encode($data));
  76.  
  77. $ok = mail($email_to, $email_subject, $email_message, $headers);
  78.  
  79. if($ok) {
  80. echo "File Sent Successfully.";
  81. unlink($attachment); // delete a file after attachment sent.
  82. }else {
  83. die("Sorry but the email could not be sent. Please go back and try again!");
  84. }
  85. }
  86.  
  87. $title= $_POST['id_title'];
  88. $first_name = $_POST['id_first_name'];
  89. $last_name= $_POST['id_last_name'];
  90. $dob = $_POST['id_checkin'];
  91. $slide= (isset($_POST['id_slide'])) ? $_POST['id_slide'] : 0;
  92. $hear= $_POST['txt_hear'];
  93. $refer= $_POST['txt_refer'];
  94. $salary= $_POST['txt_salary'];
  95. $exp_sal= $_POST['txt_exp_sal'];
  96. $notice= $_POST['txt_notice'];
  97. $exp= $_POST['txt_exp'];
  98. $txt_desgination= $_POST['txt_design'];
  99. $blood= $_POST['txt_blood'];
  100. $email= $_POST['id_email'];
  101. $phone= $_POST['id_phone'];
  102. $address = $_POST['id_address'];
  103.  
  104. $degree= $_POST['txt_degree'];
  105. $school = $_POST['txt_school'];
  106. $year= $_POST['txt_year'];
  107. $marks= $_POST['txt_marks'];
  108.  
  109. $scholarship= $_POST['txt_scholarship'];
  110. $training= $_POST['txt_training'];
  111.  
  112. $langg= $_POST['txt_langg'];
  113. $speak= (isset($_POST['speakk'])) ? $_POST['speakk'] : '';
  114. $read= (isset($_POST['read'])) ? $_POST['read'] : '';
  115. $write= (isset($_POST['write'])) ? $_POST['write'] : '';
  116.  
  117. $companynane= $_POST['txt_companyname'];
  118. $position= $_POST['txt_position'];
  119. $comp= $_POST['txt_comp'];
  120. $super= $_POST['txt_super'];
  121. $period= $_POST['txt_period'];
  122. $salary= $_POST['txt_salary'];
  123. $job_desc= $_POST['txt_job_desc'];
  124. $emp= $_POST['txt_emp'];
  125.  
  126. $members= $_POST['txt_members'];
  127. $accident= $_POST['txt_accident'];
  128. $litigation= $_POST['txt_litigation'];
  129.  
  130. $ref_name= $_POST['pro_ref_name'];
  131. $ref_add= $_POST['pro_ref_add'];
  132. $ref_how= $_POST['pro_ref_how'];
  133.  
  134. /*$date=date('d-M-Y');
  135. $datee=date('Y-m-d');*/
  136.  
  137. //$to = $email;
  138. $to = "tomail@gmail.com";
  139. $to_mail="webenquiry@forceindiapharma.com";
  140. $subject = "Contact Us";
  141. $subject2 = "Copy of your form submission";
  142. $headers = 'MIME-Version: 1.0' . "rn";
  143. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
  144. $headers .= "From: webenquiry@forceindiapharma.com ";
  145.  
  146. $pdf = new PDF();
  147. $pdf->AliasNbPages();
  148. $pdf->AddPage();
  149. $pdf->SetFont('Times','',12);
  150.  
  151. $pdf->Cell(90,7,'Name',0,0,'L');
  152. $pdf->Cell(100,7, $title.' '.$first_name.' '.$last_name,0,0,'L');
  153. $pdf->Ln();
  154. $pdf->Cell(90,7,'Date of Birth',0,0,'L');
  155. $pdf->Cell(100,7, $dob,0,0,'L');
  156. $pdf->Ln();
  157. $pdf->Cell(90,7,'Marital Status',0,0,'L');
  158. $maritalStatus = ($slide == 1) ? 'Yes': 'No';
  159. $pdf->Cell(100,7, $maritalStatus,0,0,'L');
  160. $pdf->Ln();
  161. $pdf->Cell(90,7,'How did you hear about us?',0,0,'L');
  162. $pdf->Cell(100,7, $hear,0,0,'L');
  163. $pdf->Ln();
  164. $pdf->Cell(90,7,'Reference',0,0,'L');
  165. $pdf->Cell(100,7, $refer,0,0,'L');
  166. $pdf->Ln();
  167. $pdf->Cell(90,7,'Current Salary',0,0,'L');
  168. $pdf->Cell(100,7, $salary,0,0,'L');
  169. $pdf->Ln();
  170. $pdf->Cell(90,7,'Expected Salary',0,0,'L');
  171. $pdf->Cell(100,7, $exp_sal,0,0,'L');
  172. $pdf->Ln();
  173. $pdf->Cell(90,7,'Notice Period',0,0,'L');
  174. $pdf->Cell(100,7, $notice,0,0,'L');
  175. $pdf->Ln();
  176. $pdf->Cell(90,7,'Total Experience',0,0,'L');
  177. $pdf->Cell(100,7, $exp,0,0,'L');
  178. $pdf->Ln();
  179. $pdf->Cell(90,7,'Current Designation',0,0,'L');
  180. $pdf->Cell(100,7, $txt_desgination,0,0,'L');
  181. $pdf->Ln();
  182. $pdf->Cell(90,7,'Blood Group',0,0,'L');
  183. $pdf->Cell(100,7, $blood,0,0,'L');
  184. $pdf->Ln();
  185. $pdf->Cell(90,7,'Email',0,0,'L');
  186. $pdf->Cell(100,7, $email,0,0,'L');
  187. $pdf->Ln();
  188. $pdf->Cell(90,7,'Phone',0,0,'L');
  189. $pdf->Cell(100,7, $phone,0,0,'L');
  190. $pdf->Ln();
  191. $pdf->Cell(90,7,'Address',0,0,'L');
  192. $pdf->MultiCell(100,10, $address);
  193. $pdf->Ln();
  194. $pdf->Cell(0,7,'Qualifications (S S C ONWARDS)',0,0,'C');
  195. $pdf->Ln();
  196. $pdf->Cell(40,7,'Degree / Diploma',1,0,'C');
  197. $pdf->Cell(80,7, 'School / College / University',1,0,'C');
  198. $pdf->Cell(30,7,'Year of Passing',1,0,'C');
  199. $pdf->Cell(40,7, '% of mark',1,0,'C');
  200. $pdf->Ln();
  201. for($i = 0; $i < count(array_filter($_POST['txt_langg'])); $i++) {
  202. $pdf->Cell(40,7,$_POST['txt_degree'][$i],1,0,'L');
  203. $pdf->Cell(80,7, $_POST['txt_school'][$i],1,0,'L');
  204. $pdf->Cell(30,7,$_POST['txt_year'][$i],1,0,'L');
  205. $pdf->Cell(40,7,$_POST['txt_marks'][$i],1,0,'L');
  206. $pdf->Ln();
  207. }
  208. $pdf->Ln();
  209. $pdf->Cell(0,7,'OTHER ACHIEVEMENTS (Scholarships / Prizes Won, Papers Published / Professional Approvals)',0,0,'L');
  210. $pdf->Ln();
  211. $pdf->MultiCell(0,10, $_POST['txt_scholarship']);
  212. $pdf->Ln();
  213. $pdf->Cell(0,7,'Special Training Received / Project Work Done',0,0,'L');
  214. $pdf->Ln();
  215. $pdf->MultiCell(0,10, $_POST['txt_training']);
  216. $pdf->Ln();
  217. $pdf->Cell(0,7,'Languages Known',0,0,'C');
  218. $pdf->Ln();
  219. $pdf->Cell(40,7,'Language',1,0,'C');
  220. $pdf->Cell(80,7, 'Speak',1,0,'C');
  221. $pdf->Cell(30,7,'Read',1,0,'C');
  222. $pdf->Cell(40,7, 'Write',1,0,'C');
  223. $pdf->Ln();
  224. for($i = 0; $i < count(array_filter($_POST['txt_langg'])); $i++) {
  225. $pdf->Cell(40,7,$_POST['txt_langg'][$i],1,0,'L');
  226.  
  227. $speak = (isset($_POST['speakk'][$i])) ? 'Yes' : 'No';
  228. $read = (isset($_POST['read'][$i])) ? 'Yes' : 'No';
  229. $write = (isset($_POST['write'][$i])) ? 'Yes' : 'No';
  230.  
  231. $pdf->Cell(80,7, $speak,1,0,'L');
  232. $pdf->Cell(30,7, $read,1,0,'L');
  233. $pdf->Cell(40,7, $write,1,0,'L');
  234. $pdf->Ln();
  235. }
  236. $pdf->Ln();
  237. $pdf->Cell(0,7,'Work Experience',0,0,'C');
  238. $pdf->Ln();
  239. for($i=0; $i < count(array_filter($_POST['txt_companyname'])); $i++) {
  240. $pdf->Cell(190,0,'','T');
  241. $pdf->Ln();
  242. $pdf->Cell(50,7,'Company Name & Address','LR',0,'L');
  243. $pdf->Cell(140,7, $_POST['txt_companyname'][$i],'LR',0,'L');
  244. $pdf->Ln();
  245. $pdf->Cell(50,7,'Position Held','LR',0,'L');
  246. $pdf->Cell(140,7, $_POST['txt_position'][$i],'LR',0,'L');
  247. $pdf->Ln();
  248. $pdf->Cell(50,7,'Company Phone Number','LR',0,'L');
  249. $pdf->Cell(140,7, $_POST['txt_comp'][$i],'LR',0,'L');
  250. $pdf->Ln();
  251. $pdf->Cell(50,7,'Immediate Supervisor name','LR',0,'L');
  252. $pdf->Cell(140,7, $_POST['txt_super'][$i],'LR',0,'L');
  253. $pdf->Ln();
  254. $pdf->Cell(50,7,'Period (From - To)','LR',0,'L');
  255. $pdf->Cell(140,7, $_POST['txt_period'][$i],'LR',0,'L');
  256. $pdf->Ln();
  257. $pdf->Cell(50,7,'Gross Salary','LR',0,'L');
  258. $pdf->Cell(140,7, $_POST['txt_gross_salary'][$i],'LR',0,'L');
  259. $pdf->Ln();
  260. $pdf->Cell(50,7,'Brief Job Description','LR',0,'L');
  261. $pdf->Cell(140,7, $_POST['txt_job_desc'][$i],'LR',0,'L');
  262. $pdf->Ln();
  263. $pdf->Cell(50,7,'Can we contact employer?','LR',0,'L');
  264. $pdf->Cell(140,7, $_POST['txt_emp'][$i],'LR',0,'L');
  265. $pdf->Ln();
  266. $pdf->Cell(190,0,'','T');
  267. $pdf->Ln();
  268. /* $pdf->Cell(25,7,'Company Name',1,0,'C');
  269. $pdf->Cell(25,7, 'Position',1,0,'C');
  270. $pdf->Cell(25,7,'Ph Num',1,0,'C');
  271. $pdf->Cell(25,7, 'Supervisor',1,0,'C');
  272. $pdf->Cell(25,7,'Period',1,0,'C');
  273. $pdf->Cell(25,7, 'Salary',1,0,'C');
  274. $pdf->Cell(25,7,'Job Description',1,0,'C');
  275. $pdf->Cell(25,7, 'Can we contact this employer?',1,0,'C');
  276. $pdf->Ln(); */
  277. }
  278.  
  279. $pdf->Cell(0,7,'Membership of Professional / Political / Social Bodies',0,0,'L');
  280. $pdf->Ln();
  281. $pdf->Cell(0,7, $_POST['txt_members'],0,0,'L');
  282. $pdf->Ln();
  283. $pdf->Cell(0,7,'Any Major Sickness or Accident (If Applicable, give details)',0,0,'L');
  284. $pdf->Ln();
  285. $pdf->Cell(0,7, $_POST['txt_accident'],0,0,'L');
  286. $pdf->Ln();
  287. $pdf->Cell(0,7,'Were you involved in any litigation? (If Applicable, give details)',0,0,'L');
  288. $pdf->Ln();
  289. $pdf->Cell(0,7, $_POST['txt_litigation'],0,0,'L');
  290. $pdf->Ln();
  291. $pdf->Cell(0,7,'PROFESSIONAL REFERENCES (OTHER THAN RELATIVES & FAMILY FRIENDS)',0,0,'C');
  292. $pdf->Ln();
  293. $pdf->Cell(60,7,'Name',1,0,'C');
  294. $pdf->Cell(90,7, 'Address / Mobile',1,0,'C');
  295. $pdf->Cell(40,7,'How do you know',1,0,'C');
  296. $pdf->Ln();
  297. for($i = 0; $i < count(array_filter($_POST['pro_ref_name'])); $i++) {
  298. $pdf->Cell(60,7, $_POST['pro_ref_name'][$i],1,0,'L');
  299. $pdf->Cell(90,7, $_POST['pro_ref_add'][$i],1,0,'L');
  300. $pdf->Cell(40,7, $_POST['pro_ref_how'][$i],1,0,'L');
  301. $pdf->Ln();
  302. }
  303. $pdf->Ln();
  304. $file = $pdf->Output('S');
  305.  
  306. require("includes/class.phpmailer.php");
  307.  
  308. $mail = new PHPMailer();
  309.  
  310. $mail->IsSMTP(); // telling the class to use SMTP
  311.  
  312. /*$mail->SMTPDebug = 0;
  313. $mail->Host = "smtp.gmail.com";
  314. $mail->SMTPAuth = true;
  315. $mail->Username = "webenquiry@forceindiapharma.com";
  316. $mail->Password = "password@1234";
  317. $mail->SMTPSecure = "tls";
  318. $mail->Port = 587;*/
  319.  
  320. $mail->From = "webenquiry@forceindiapharma.com";
  321. $mail->FromName = 'Force India Pharma';
  322. $mail->AddAddress("support@codesensesoftsolutions.com");
  323.  
  324. $mail->Subject = "Job Application";
  325. $mail->Body = "Hi! nn You have received a job application Please find the attachment.";
  326. $mail->WordWrap = 50;
  327. $mail->addStringAttachment($file,'Job Application','base64', 'application/pdf');
  328. $mail->send();
  329.  
  330. }
  331.  
  332. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement