Advertisement
Guest User

Untitled

a guest
Apr 11th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.91 KB | None | 0 0
  1. <?php
  2.  
  3. require '../../PHPMailer/PHPMailerAutoload.php';
  4.  
  5. function isValidEmail($email){
  6. return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
  7. }
  8.  
  9. $mail = new PHPMailer;
  10.  
  11. //$mail->SMTPDebug = 3; // Enable verbose debug output
  12.  
  13. $host = 'cloud307.mxserver.ro';
  14. $username = 'comenzi@zamo.ro';
  15. $password = '+e[z%{BkW9rQ';
  16.  
  17. $mail->isSMTP(); // Set mailer to use SMTP
  18. $mail->Host = $host; // Specify main and backup SMTP servers
  19. $mail->SMTPAuth = true; // Enable SMTP authentication
  20. $mail->Username = $username; // SMTP username
  21. $mail->Password = $password; // SMTP password
  22. $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
  23. $mail->Port = 465; // TCP port to connect to
  24.  
  25. $skipConfirmation = false;
  26. if (!isValidEmail($_POST['email'])) {
  27. $email = 'office@zamo.ro';
  28. $skipConfirmation = true;
  29. } else {
  30. $email = $_POST['email'];
  31. }
  32.  
  33. $mail->From = $email;
  34. $mail->FromName = $email;
  35. $mail->addAddress('office@zamo.ro'); // Add a recipient
  36. $mail->addAddress('z4m0lx3@gmail.com'); // Name is optional
  37. $mail->addAddress('comenzi@zamo.ro'); // Name is optional
  38. $mail->addReplyTo($email);
  39.  
  40. $mail->isHTML(true); // Set email format to HTML
  41. $mail->Subject = 'Comanda pe albirea-dintilor.com';
  42.  
  43. $body = '';
  44.  
  45. $body .= 'Nume: ';
  46.  
  47. $body .= $_POST['nume'];
  48.  
  49. $body .= "<br />";
  50.  
  51. $body .= 'Prenume: ';
  52.  
  53. $body .= $_POST['prenume'];
  54.  
  55. $body .= "<br />";
  56.  
  57. $body .= 'Strada: ';
  58.  
  59. $body .= $_POST['strada'];
  60.  
  61. $body .= "<br />";
  62.  
  63. $body .= 'Adresa: ';
  64.  
  65. $body .= $_POST['adresa'];
  66.  
  67. $body .= "<br />";
  68.  
  69. $body .= 'Oras: ';
  70.  
  71. $body .= $_POST['oras'];
  72.  
  73. $body .= "<br />";
  74.  
  75. $body .= 'Judet: ';
  76.  
  77. $body .= $_POST['judet'];
  78.  
  79. $body .= "<br />";
  80.  
  81. $body .= 'Cod Postal: ';
  82.  
  83. $body .= $_POST['cod-postal'];
  84.  
  85. $body .= "<br />";
  86.  
  87. $body .= 'Tara: ';
  88.  
  89. $body .= $_POST['tara'];
  90.  
  91. $body .= "<br />";
  92.  
  93. $body .= 'Telefon: ';
  94.  
  95. $body .= $_POST['telefon'];
  96.  
  97. $body .= "<br />";
  98.  
  99. $body .= 'E-Mail: ';
  100.  
  101. $body .= $_POST['email'];
  102.  
  103. $body .= "<br />";
  104.  
  105. $body .= 'Produs: ';
  106.  
  107. $body .= "<br />";
  108.  
  109. $body .= $_POST['pachet'];
  110.  
  111. $body .= "<br />";
  112.  
  113. $body .= $_POST['1hour'];
  114.  
  115. $body .= "<br />";
  116.  
  117. $body .= $_POST['1hour-buc'];
  118.  
  119. $body .= "<br />";
  120.  
  121. $body .= $_POST['vivid'];
  122.  
  123. $body .= "<br />";
  124.  
  125. $body .= $_POST['vivid-buc'];
  126.  
  127. $body .= "<br />";
  128.  
  129. $body .= $_POST['effects'];
  130.  
  131. $body .= "<br />";
  132.  
  133. $body .= $_POST['effects-buc'];
  134.  
  135. $body .= "<br />";
  136.  
  137. $body .= $_POST['flexfit'];
  138.  
  139. $body .= "<br />";
  140.  
  141. $body .= $_POST['flexfit-buc'];
  142.  
  143. $body .= "<br />";
  144.  
  145. $body .= $_POST['stain'];
  146.  
  147. $body .= "<br />";
  148.  
  149. $body .= $_POST['stain-buc'];
  150.  
  151. $body .= "<br />";
  152.  
  153. $body .= $_POST['gentle'];
  154.  
  155. $body .= "<br />";
  156.  
  157. $body .= $_POST['gentle-buc'];
  158.  
  159. $body .= "<br />";
  160.  
  161. $body .= $_POST['advanced'];
  162.  
  163. $body .= "<br />";
  164.  
  165. $body .= $_POST['advanced-buc'];
  166.  
  167. $body .= "<br />";
  168.  
  169. $body .= $_POST['supreme'];
  170.  
  171. $body .= "<br />";
  172.  
  173. $body .= $_POST['supreme-buc'];
  174.  
  175. $body .= "<br />";
  176.  
  177. $body .= $_POST['pasta'];
  178.  
  179. $body .= "<br />";
  180.  
  181. $body .= $_POST['scope2pack'];
  182.  
  183. $body .= "<br />";
  184.  
  185. $body .= $_POST['xtrawhite'];
  186.  
  187. $body .= "<br />";
  188.  
  189. $body .= $_POST['bakingsoda'];
  190.  
  191. $body .= "<br />";
  192.  
  193. $body .= $_POST['scope-outlast'];
  194.  
  195. $body .= "<br />";
  196.  
  197. $body .= $_POST['naturalwhite'];
  198.  
  199. $body .= "<br />";
  200.  
  201. $body .= $_POST['dazzling'];
  202.  
  203. $body .= "<br />";
  204.  
  205. $body .= $_POST['aquafresh'];
  206.  
  207. $body .= "<br />";
  208.  
  209. $body .= $_POST['aquafreshmulaj'];
  210.  
  211. $body .= "<br />";
  212.  
  213. $body .= $_POST['pluswhite'];
  214.  
  215. $body .= "<br />";
  216.  
  217. $body .= $_POST['pluswhite-defect'];
  218.  
  219. $body .= "<br />";
  220.  
  221. $body .= $_POST['cinnamon'];
  222.  
  223. $body .= "<br />";
  224.  
  225. $body .= $_POST['brilliance'];
  226.  
  227. $body .= "<br />";
  228.  
  229. $body .= $_POST['colgate'];
  230.  
  231. $body .= "<br />";
  232.  
  233. $body .= $_POST['cool'];
  234.  
  235. $body .= "<br />";
  236.  
  237. $body .= $_POST['cool-plic'];
  238.  
  239. $body .= "<br />";
  240.  
  241. $body .= $_POST['shine'];
  242.  
  243. $body .= "<br />";
  244.  
  245. $body .= $_POST['wonder'];
  246.  
  247. $body .= "<br />";
  248.  
  249.  
  250. $body .= 'Impachetare Cadou: ';
  251.  
  252. $body .= $_POST['cadou'];
  253.  
  254. $body .= "<br />";
  255.  
  256. $body .= 'Expediere: ';
  257.  
  258. $body .= $_POST['expediere'];
  259.  
  260. $body .= "<br />";
  261.  
  262. $body .= 'Comentarii: ';
  263.  
  264. $body .= $_POST['comentarii'];
  265.  
  266. $body .= "<br />";
  267.  
  268. $body .= 'Sursa: ';
  269.  
  270. $body .= $_POST['sursa'];
  271.  
  272. $body .= "<br />";
  273.  
  274. $body .= 'CNP/CUI: ';
  275.  
  276. $body .= $_POST['cnp'];
  277.  
  278. $body .= "<br />";
  279.  
  280. $body .= 'CUPON REDUCERE: ';
  281.  
  282. $body .= $_POST['cupon'];
  283.  
  284. $body .= "<br />";
  285.  
  286. $mail->Body = $body;
  287.  
  288. if(!$mail->send()) {
  289. $send = false;
  290. } else {
  291. $send = true;
  292. }
  293.  
  294. // Confirmare Client
  295.  
  296. if (!$skipConfirmation) {
  297. $confirmation_mail = new PHPMailer;
  298.  
  299. //$confirmation_mail->SMTPDebug = 3; // Enable verbose debug output
  300.  
  301. $confirmation_mail->isSMTP(); // Set mailer to use SMTP
  302. $confirmation_mail->Host = $host; // Specify main and backup SMTP servers
  303. $confirmation_mail->SMTPAuth = true; // Enable SMTP authentication
  304. $confirmation_mail->Username = $username; // SMTP username
  305. $confirmation_mail->Password = $password; // SMTP password
  306. $confirmation_mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
  307. $confirmation_mail->Port = 465; // TCP port to connect to
  308.  
  309. $confirmation_mail->From = 'comenzi@zamo.ro';
  310. $confirmation_mail->FromName = 'albirea-dintilor.com';
  311. $confirmation_mail->addAddress($email); // Add a recipient
  312. $confirmation_mail->addReplyTo('comenzi@zamo.ro');
  313.  
  314. $confirmation_mail->isHTML(true); // Set email format to HTML
  315. $confirmation_mail->Subject = 'Confirmare comanda pe www.albirea-dintilor.com';
  316.  
  317. $confirmation_mail->Body = "Buna ziua,<br /><br /> Va multumim pentru comanda dumneavoastra. In scurt timp un operator o sa va contacteze la telefon. <br />Din cauza volumului mare de cereri, confirmarea comenzii poate dura pana la 24 de ore de la trimitere.<br /><br />Daca nu doriti sa asteptati confirmarea telefonica, pur si simplu raspundeti la acest mesaj sau sunati la telefon 0726 465 732.<br /><br /> Program Luni-Vineri : 10:00 - 18:00.<br />ATENTIE: Daca ati facut comanda in timpul Weekendului, aceasta va fi procesata si livrata a doua zi lucratoare (Luni).<br /><br />Va dorim o zi minunata.<br />www.albirea-dintilor.com";
  318.  
  319. if(!$confirmation_mail->send()) {
  320. $send = false;
  321. } else {
  322. $send = true;
  323. }
  324. }
  325.  
  326. // Redirect user to your homepage ...
  327.  
  328.  
  329. if ($send) {
  330. header('Location: http://www.albirea-dintilor.com/succes-comanda.html');
  331. } else {
  332. header('Location: http://www.albirea-dintilor.com/succes-comanda.html');
  333. }
  334.  
  335. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement