daily pastebin goal
34%
SHARE
TWEET

Untitled

AndreasEnemyr Jan 21st, 2018 118 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $servername = ".loopiase";
  4. $username = "@";
  5. $password = "";
  6. $dbname = "";
  7.        
  8. $levdatum = $_POST['levdatum'];
  9. $namn = $_POST['namn'];
  10. $adress = $_POST['adress'];
  11. $postnr = $_POST['postnr'];
  12. $telefonnummer = $_POST['telefonnummer'];
  13. $lada = $_POST['lada'];
  14. $val = $_POST['val'];
  15. $inskickat = $_POST['inskickat'];
  16. $pris = $_POST['pris'];
  17. $saljare = $_POST['saljare'];
  18. $email = $_POST['email'];
  19. $ovrigt = $_POST['ovrigt'];
  20.  
  21. try {
  22.     $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
  23.     $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  24.     $conn->exec("set names utf8");
  25.     $sql = "INSERT INTO `orders` (`id`, `levdatum`, `namn`, `adress`, `telefon`, `loda`, `val`, `inskickat`, `pris`, `saljare`, `ovrigt`, `email`) VALUES (NULL, '$levdatum', '$namn', '$adress, $postnr', '$telefonnummer', '$lada', '$val', '$inskickat', '$pris', '$saljare', '$ovrigt', '$email')";
  26.     $conn->exec($sql);
  27.     echo "";
  28.     }
  29. catch(PDOException $e)
  30.     {
  31.     echo $sql . "<br>" . $e->getMessage();
  32.     }
  33.  
  34. $conn = null;
  35. ?>
  36.  
  37. <?php
  38. header('Content-type: text/plain; charset=utf-8');
  39. require 'phpmailer/PHPMailerAutoload.php';
  40. $mail = new PHPMailer();
  41. $mail->CharSet = 'UTF-8';
  42. $mail->isHTML(true);
  43. $mail->isSMTP();
  44. $mail->SMTPDebug = 0;
  45. $mail->SMTPAuth = true;
  46. $mail->SMTPSecure = "ssl";
  47. $mail->Port = 465;
  48.  
  49. $mail->addAddress($email);
  50.  
  51. //
  52. $mail->Host = ".loopia.se";
  53. $mail->Username = "@.se";
  54. $mail->Password = "";
  55.  
  56. $mail->setFrom('@.se','Kött på riktigt');
  57. $mail->AddReplyTo('@.se','Kött på ');
  58.  
  59. $mail->Subject = "Leveransbekräftelse";
  60.  
  61. $mail->Body = "Hej $namn! <br> Tack för din beställning! <br><br>Mvh Kött !";
  62.         //
  63.  
  64.     if ($mail->send())
  65.         echo "Skickat!";
  66.         header('Location: index.html');
  67.     else
  68.         echo $mail->ErrorInfo;
  69. ?>
RAW Paste Data
Top