Guest User

Untitled

a guest
Mar 8th, 2019
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.32 KB | None | 0 0
  1. <?php
  2. $parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );
  3. require_once( $parse_uri[0] . 'wp-load.php' );
  4.  
  5. date_default_timezone_set("Asia/Kolkata");
  6. global $wpdb;
  7.  
  8. function test_input($data) {
  9. $data = trim($data);
  10. $data = stripslashes($data);
  11. $data = htmlspecialchars($data);
  12. return $data;
  13. }
  14.  
  15. $name = test_input($_POST['name']);
  16. $email = test_input($_POST['email']);
  17. $phone = test_input($_POST['phone']);
  18. $occupation = test_input($_POST['occupation']);
  19. $company = test_input($_POST['company']);
  20.  
  21. $leadutmsource = $_POST['leadutmsource'];
  22. $leadutmmedium = $_POST['leadutmterm'];
  23. $leadutmcampaign = $_POST['leadutmcampaign'];
  24. $leadutmterm = $_POST['leadutmterm'];
  25. $leadutmcontent = $_POST['leadutmcontent'];
  26.  
  27. $leadqueryurl = $_POST['leadqueryurl'];
  28. $leadpagetitle = $_POST['leadpagetitle'];
  29. $leaduseragent = $_POST['leaduseragent'];
  30. $ip = $_POST['leadip'];
  31. $download_pdf=$_POST['download_pdf'];
  32.  
  33. $contacteddate = date("Y-m-d H:i:s");
  34. $json = json_encode($_POST);
  35. error_log($json);
  36. if(isset($_POST['uttamisawesome']) && $_POST['uttamisawesome'] == 'uttamisawesome'){
  37.  
  38. $table = $wpdb->prefix."tracker";
  39. $runquery = $wpdb->insert(
  40. $table,
  41. array(
  42. 'name' => $name,
  43. 'email' => $email,
  44. 'phone' => $phone,
  45. 'occupation' => $occupation,
  46. 'company' => $company,
  47. 'registeredon' => $contacteddate,
  48. 'leadip' => $ip,
  49. 'leaduseragent' => $leaduseragent,
  50. 'leadutmsource' => $leadutmsource,
  51. 'leadutmmedium' => $leadutmmedium,
  52. 'leadutmcampaign' => $leadutmcampaign,
  53. 'leadutmterm' => $leadutmterm,
  54. 'leadutmcontent' => $leadutmcontent,
  55. 'leadqueryurl' => $leadqueryurl,
  56. 'leadpagetitle' => $leadpagetitle,
  57. 'status' => 'Lead',
  58. 'formdata' => $json
  59. )
  60. );
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. /******** CURL method for Leadstore *********/
  68. $input_params=array(
  69. 'firstname'=>$name,
  70. 'email'=>$email,
  71. 'phone'=>$phone,
  72. 'city'=> '',
  73. 'message'=>'',
  74. 'udf1'=>'Occupation: '.$occupation,
  75. 'udf2'=>'Company: '.$company,
  76. 'udf3'=>'',
  77. 'udf4'=>'',
  78. 'udf5'=>'',
  79. 'udf6'=>'',
  80. 'udf7'=>'',
  81. 'udf8'=>'',
  82. 'udf9'=>'',
  83. 'udf10'=>'',
  84. 'ua_ip'=>$ip,
  85. 'ua_device'=>$leaduseragent,
  86. 'ua_query_url'=>$leadqueryurl,
  87. 'landing_page_title'=>$leadpagetitle,
  88. 'utm_source'=>$leadutmsource,
  89. 'utm_medium'=>$leadutmmedium,
  90. 'utm_campaign'=>$leadutmcampaign,
  91. 'utm_content'=>$leadutmcontent,
  92. 'utm_term'=>$leadutmterm,
  93. 'ua_city'=>'',
  94. 'ua_country'=>'',
  95. 'form_data'=>$json,
  96. );
  97. $fields = $input_params;
  98. $postvars = '';
  99. foreach($fields as $key=>$value) {
  100. $postvars .= $key . "=" . $value . "&";
  101. }
  102. $ch = curl_init();
  103. curl_setopt($ch, CURLOPT_URL,"http://leadstore.in/capture_leads/capture/19");
  104. curl_setopt($ch, CURLOPT_POST, 1);
  105. curl_setopt($ch, CURLOPT_POSTFIELDS,$postvars);
  106. // in real life you should use something like:
  107. // curl_setopt($ch, CURLOPT_POSTFIELDS,
  108. //http_build_query(array('postvar1' => 'value1')));
  109. // receive server response ...
  110. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  111. $server_output = curl_exec ($ch);
  112. curl_close ($ch);
  113. /****************End CURL CALL**********************/
  114.  
  115.  
  116. //$wpdb->print_error();
  117. $headers = "From: Uttam Blastech <salessupport@uttamblastech.com> \r\n";
  118. $headers .= "Reply-To: salessupport@uttamblastech.com \r\n";
  119. $headers .= "MIME-Version: 1.0\r\n";
  120. $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
  121.  
  122. if($download_pdf=="nopdf")
  123. {
  124. $subject = 'Uttam Blastech';
  125. $message = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><META http-equiv="Content-Type" content="text/html; charset=utf-8"></head><center><body><div width="550px" style="width:550px;margin:0 auto;border:1px solid #d2d2d2"><div style="font-family:Arial,sans-serif;font-size:12px;line-height:160%;color:#6b6b6b;"><table cellpadding="12" cellspacing="0" width="550" border="0" style="background:#ffffff;border-bottom:1px solid #d2d2d2;font-size:12px;font-family:Arial,sans-serif"><tr><td><img src="https://i.imgur.com/85fkTKg.png" alt=""></td></tr></table><table width="550" border="0" style="border-collapse:collapse;"><tr><td><img src="http://i.imgur.com/kvAMUdi.png" alt=""></td></tr></table><table cellpadding="15" cellspacing="0" width="550" border="0" style="background:#ffffff;font-size:12px;font-family:Arial,sans-serif"><tr><td style="padding:25px 35px 25px 15px"><span style="color:#817452;font-family:Arial,sans-serif;font-size:15px;"><b>Hello there!</b></span><br/><br/><span style="color:#686868;font-family:Arial,sans-serif;font-size:14px;line-height:130%">Thank you for reaching out to us. Our team will contact you soon.</span><br/><br></td></tr></table><table cellpadding="18" cellspacing="0" width="550" border="0" style="background:#ffffff;font-size:12px;font-family:Arial,sans-serif"><tr><td><p style="color:#6b6b6b;font-size:15px;">Regards,<br/>Uttam Blastech</p></td></tr><tr><td cellpadding="15" bgcolor="#505050"><p style="color:#fff;font-size:11px;font-family:Arial,sans-serif;text-align:center;">&copy; 2018 Uttam Blastech Pvt. Ltd.</p></td></tr></table></div></div></body></center></html>';
  126.  
  127. }
  128. else
  129. {
  130.  
  131. $subject ="Uttam Blastech | " .ucwords($leadpagetitle);
  132. if($leadpagetitle=="Blasting and Controlled Blasting" || $leadpagetitle=="Seismograph" || $leadpagetitle=="Vibration Measurement & Consultancy Services.")
  133. {
  134. $message = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><META http-equiv="Content-Type" content="text/html; charset=utf-8"></head><center><body><div width="550px" style="width:550px;margin:0 auto;border:1px solid #d2d2d2"><div style="font-family:Arial,sans-serif;font-size:12px;line-height:160%;color:#6b6b6b;"><table cellpadding="12" cellspacing="0" width="550" border="0" style="background:#ffffff;border-bottom:1px solid #d2d2d2;font-size:12px;font-family:Arial,sans-serif"><tr><td><img src="https://i.imgur.com/85fkTKg.png" alt=""></td></tr></table><table width="550" border="0" style="border-collapse:collapse;"><tr><td><img src="http://i.imgur.com/kvAMUdi.png" alt=""></td></tr></table><table cellpadding="15" cellspacing="0" width="550" border="0" style="background:#ffffff;font-size:12px;font-family:Arial,sans-serif"><tr><td style="padding:25px 35px 25px 15px"><span style="color:#817452;font-family:Arial,sans-serif;font-size:15px;"><b>Hello there!</b></span><br/><br/><span style="color:#686868;font-family:Arial,sans-serif;font-size:14px;line-height:130%">Thank you for reaching out to us. Our team will contact you soon.</span><br/><br><br><p style="text-align:center"><a href="'.$download_pdf.'" style="text-decoration:none;text-align:center;padding: 15px;color: #fff;background: #00A256;">Download PDF</a></p></td></tr></table><table cellpadding="18" cellspacing="0" width="550" border="0" style="background:#ffffff;font-size:12px;font-family:Arial,sans-serif"><tr><td><p style="color:#6b6b6b;font-size:15px;">Regards,<br/>Uttam Blastech</p></td></tr><tr><td cellpadding="15" bgcolor="#505050"><p style="color:#fff;font-size:11px;font-family:Arial,sans-serif;text-align:center;">&copy; 2018 Uttam Blastech Pvt. Ltd.</p></td></tr></table></div></div></body></center></html>';
  135. }
  136. else
  137. {
  138. $subject = 'Download Controlled Blasting Brochure';
  139. $message = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><META http-equiv="Content-Type" content="text/html; charset=utf-8"></head><center><body><div width="550px" style="width:550px;margin:0 auto;border:1px solid #d2d2d2"><div style="font-family:Arial,sans-serif;font-size:12px;line-height:160%;color:#6b6b6b;"><table cellpadding="12" cellspacing="0" width="550" border="0" style="background:#ffffff;border-bottom:1px solid #d2d2d2;font-size:12px;font-family:Arial,sans-serif"><tr><td><img src="https://i.imgur.com/85fkTKg.png" alt=""></td></tr></table><table width="550" border="0" style="border-collapse:collapse;"><tr><td><img src="http://i.imgur.com/kvAMUdi.png" alt=""></td></tr></table><table cellpadding="15" cellspacing="0" width="550" border="0" style="background:#ffffff;font-size:12px;font-family:Arial,sans-serif"><tr><td style="padding:25px 35px 25px 15px"><span style="color:#817452;font-family:Arial,sans-serif;font-size:15px;"><b>Hello there!</b></span><br/><br/><span style="color:#686868;font-family:Arial,sans-serif;font-size:14px;line-height:130%">Thank you for reaching out to us. Our team will contact you soon.</span><br/><br><br><p style="text-align:center"><a href="http://uttamblastech.com/l/controlled-blasting/controlled-blasting.pdf" style="text-decoration:none;text-align:center;padding: 15px;color: #fff;background: #00A256;">Download PDF</a></p></td></tr></table><table cellpadding="18" cellspacing="0" width="550" border="0" style="background:#ffffff;font-size:12px;font-family:Arial,sans-serif"><tr><td><p style="color:#6b6b6b;font-size:15px;">Regards,<br/>Uttam Blastech</p></td></tr><tr><td cellpadding="15" bgcolor="#505050"><p style="color:#fff;font-size:11px;font-family:Arial,sans-serif;text-align:center;">&copy; 2018 Uttam Blastech Pvt. Ltd.</p></td></tr></table></div></div></body></center></html>';
  140. }
  141. }
  142.  
  143. $sendemail = wp_mail($email, $subject, $message, $headers);
  144.  
  145.  
  146. $subject1 =ucwords($leadpagetitle)." | New Enquiry ";
  147. $to = 'salessupport@uttamblastech.com';
  148. $headers1 = "From: Uttam Blastech <salessupport@uttamblastech.com> \r\n";
  149. $headers1 .= "Reply-To: salessupport@uttamblastech.com \r\n";
  150. $headers1 .= "MIME-Version: 1.0\r\n";
  151. $headers1 .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
  152. $headers1 .= "Cc :Srikant<srikant@uttamblastech.com>,amarnath<amarnath@deepredink.com>\r\n" ;
  153. //$headers1 .= "Cc : Venkat<venkat@deepredink.com>\r\n" ;
  154. //$headers1 .= "Bcc : Rudra<rudra@deepredink.com>\r\n";
  155. $message1 = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta charset="UTF-8"><title>Excel To HTML using codebeautify.org</title></head><body><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"xmlns="http://www.w3.org/1999/xhtml" style=" line-height: 1.6; margin: 0; padding: 0;"><head><meta content="text/html;charset=utf-8" http-equiv="Content-Type"/><style type="text/css">#wrapper{width: 550px; margin: 0 auto; background:#fff;}}</style><center><div id="wrapper" style="border-bottom:10px solid #333333;width:550px;margin:0 auto;border-collapse:collapse;"><table bgcolor="#fffff" border="0" cellpadding="0" cellspacing="0" style="font-size:12px;font-family:Arial,sans-serif;display: inline-table;" width="550"><tbody><tr style="height:100px;"><td align="left" colspan="2"><img src="https://i.imgur.com/OIuX4rm.png" alt="Uttam Blastech"/></td></tr><tr bgcolor="#fafafa"><td colspan="2" valign="top"><span style="font-size:14px;">Hello, </span></span><br/><br/><span style="font-size:14px;line-height:130%;">We have a new lead from our langing page '.ucwords($leadpagetitle).'. Following are the details: <br/><br/><span style="font-family:Arial,sans-serif;color:#000;font-size:16px;line-height:130%;"><span style="font-size:14px"><strong>Name: </strong>'.ucfirst($name).'<br><strong>Email: </strong>'.$email.'<br><strong>Phone: </strong>'.$phone.'<br><strong>Occupation: </strong>'.$occupation.'<br><strong>Company: </strong>'.$company.'<br></span></span><br/><br/><span style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20.8px; background-color: rgb(250, 250, 250);">Regards, </span><br style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20.8px; background-color: rgb(250, 250, 250);"/><span style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20.8px; background-color: rgb(250, 250, 250);">Uttam Blastech</span><br/></td></tr></tbody></table></div></center></body></html></body></html>';
  156.  
  157. $sendemail1 = wp_mail($to, $subject1, $message1, $headers1);
  158.  
  159. }
  160. else {
  161. header('Location: ' . $_SERVER['HTTP_REFERER']);
  162. exit;
  163. }
  164.  
  165. if($sendemail) {
  166. //show thankyoupage
  167. header('Location: ' . $_POST['thankyouurl']);
  168. }
  169. else {
  170. //show error page
  171. echo "Something went wrong. Please try again later.";
  172. //header('Location: ' . get_home_url() .'/ambassadors-connect/?status=error');
  173. }
  174. error_reporting(-1);
  175. ini_set('display_errors', 'On');
  176. ?>
Add Comment
Please, Sign In to add comment