Advertisement
Guest User

Untitled

a guest
Aug 12th, 2016
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.26 KB | None | 0 0
  1. <?php
  2. if (count($_POST)) {
  3. $name = $_POST['name'];
  4. $email = $_POST['email'];
  5. $message = $_POST['message'];
  6. $from = 'Søgne Elektriske AS Kontakt Skjema';
  7. $to = 'thomasstrommen@hotmail.com';
  8. $subject = 'Melding fra kontakt skjema';
  9.  
  10. $body = sprintf(file_get_contents('mailtemplate.html'), $name, $email, $message);
  11.  
  12. if ($_POST['name']) {
  13. if ($_POST['email'] || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
  14. if ($_POST['text']) {
  15. require 'PHPMailer/PHPMailerAutoload.php';
  16.  
  17. $mail = new PHPMailer;
  18.  
  19. //$mail->SMTPDebug = 3; // Enable verbose debug output
  20. $mail->CharSet = "UTF-8";
  21. $mail->isSMTP(); // Set mailer to use SMTP
  22. $mail->Host = "smtp.live.com"; // Specify main and backup SMTP servers
  23. $mail->SMTPAuth = true; // Enable SMTP authentication
  24. $mail->Username = 'thomasstrommen@hotmail.com'; // SMTP username
  25. $mail->Password = 'dont even dare to try'; // SMTP password
  26. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  27. $mail->Port = 25; // TCP port to connect to
  28.  
  29. $mail->setFrom($email, $name);
  30. $mail->addAddress('thomasstrommen@hotmail.com'); // Add a recipient
  31. $mail->isHTML(true); // Set email format to HTML
  32.  
  33. $mail->Subject = $subject;
  34. $mail->AltBody = $body;
  35. $mail->Body = $body;
  36.  
  37.  
  38. if(!$mail->send()) {
  39. echo 'Meldingen kunne ikke bli sendt';
  40. echo 'PHPMailer error: ' . $mail->ErrorInfo;
  41. } else {
  42. echo 'Meldingen din ble sendt!';
  43. }
  44. exit;
  45. }
  46. }
  47. }
  48.  
  49. }
  50. ?>
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. <!DOCTYPE html>
  62. <html lang="en">
  63.  
  64. <head>
  65. <meta charset="utf-8">
  66. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  67. <meta name="viewport" content="width=device-width, initial-scale=1">
  68. <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
  69. <title>Søgne Elektriske AS</title>
  70.  
  71. <!-- Bootstrap -->
  72. <link href="css/bootstrap.min.css" rel="stylesheet">
  73. <link href="css/common.css" rel="stylesheet">
  74. <link href="css/kontakt.css" rel="stylesheet">
  75. <link href="css/footer.css" rel="stylesheet">
  76.  
  77. <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
  78. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  79. <!-- Include all compiled plugins (below), or include individual files as needed -->
  80. <script src="js/bootstrap.min.js"></script>
  81. <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDEleDca0HX6XBjOSsVSefpUqD_Di_TpxM&callback=initMap" async defer></script>
  82.  
  83.  
  84.  
  85. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  86. <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  87. <!--[if lt IE 9]>
  88. <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  89. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  90. <![endif]-->
  91.  
  92.  
  93. </head>
  94.  
  95. <body>
  96.  
  97. <div id="loading">
  98. <br><br><br><br>
  99. <img src="ring.gif">
  100. </div>
  101.  
  102.  
  103. <div class="navbar navbar-default navbar-static-top" role="navigation">
  104. <div class="container">
  105. <div class="navbar-header">
  106. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
  107. <span class="icon-bar"></span>
  108. <span class="icon-bar"></span>
  109. <span class="icon-bar"></span>
  110. </button>
  111. <a class="navbar-brand" href="index.php">
  112. <img src="img/logo.png"></a>
  113. </div>
  114. <div class="navbar-collapse collapse">
  115. <ul class="nav navbar-nav navbar-right">
  116. <li><a href="index.php"><h4>Hjem</h4></a></li>
  117. <li><a href="tjenester.php"><h4>Tjenester</h4></a></li>
  118. <li class="active"><a href="kontakt.php"><h4>Kontakt oss</h4></a></li>
  119. </ul>
  120. </div>
  121. </div>
  122. </div>
  123.  
  124.  
  125. <div class="container">
  126. <h1>Kontakt oss</h1>
  127. <div class="form-group" style="padding-top:30px;">
  128. <div class="col-sm-4">
  129. <label for="contact-name" class="control-label">Navn</label>
  130. <input type="text" name="name" class="form-control" id="contact-name" placeholder="Ola Nordmann">
  131. </div>
  132. <div class="col-sm-4">
  133. <label for="contact-email" class="control-label">E-post</label>
  134. <input type="text" name="email" class="form-control" id="contact-email" placeholder="Ola.Nordmann@eksempel.com">
  135. </div>
  136. </div>
  137. <div class="form-group" style="padding-top:50px;">
  138. <div class="col-sm-8">
  139. <label for="contact-email" class="control-label">Melding</label>
  140. <textarea class="form-control" id="text" rows="6"></textarea>
  141. </div>
  142. </div>
  143.  
  144. <div class="form-group">
  145. <div class="col-sm-12">
  146. <button id="send" class="btn btn-success" style="margin-top:15px;">Send</button>
  147. </div>
  148. </div>
  149.  
  150.  
  151.  
  152. </div>
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161. <script type="text/javascript">
  162. $(function() {
  163. $('#send').click(function() {
  164. // Todo: Vis loading-animasjon.
  165. $.ajax({
  166. method: 'post',
  167. url: 'kontakt.php', // Todo: Bruk riktig filnavn her.
  168. data: {
  169. name: $('#contact-name').val(),
  170. email: $('#contact-email').val(),
  171. message: $('#text').val()
  172. },
  173. success: function() {
  174. alert("hei");
  175. // Todo: Skjul loading-animasjon.
  176. }
  177. });
  178. });
  179. });
  180.  
  181. </script>
  182.  
  183.  
  184. <div class="container" style="padding-top:100px;">
  185. <iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d4341.3207922519!2d7.812949102615593!3d58.091660889347864!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x4637f659f607af17%3A0x8a75f6f8919488c5!2sLinnegr%C3%B8van+24%2C+4640+S%C3%B8gne!5e0!3m2!1sno!2sno!4v1471002377754" width="100%" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>
  186. </div>
  187.  
  188.  
  189.  
  190.  
  191.  
  192. <footer class="footer-distributed">
  193.  
  194. <div class="footer-left">
  195.  
  196. <h3>Søgne Elektriske AS</h3>
  197.  
  198. <p class="footer-links">
  199. <a href="index.html">Hjem</a> ·
  200. <a href="tjenester.html">Tjenester</a> ·
  201. <a href="kontakt.html">Kontakt oss</a>
  202. </p>
  203.  
  204. <p class="footer-company-name">Søgne Elektriske AS &copy; 2016</p>
  205. </div>
  206.  
  207. <div class="footer-center">
  208.  
  209. <div>
  210. <i class="fa fa-map-marker"></i>
  211. <p><span>Linnegrøvan 24</span> 4640 Søgne</p>
  212. </div>
  213.  
  214. <div>
  215. <i class="fa fa-phone"></i>
  216. <p>38 05 30 30</p>
  217. </div>
  218.  
  219. <div>
  220. <i class="fa fa-envelope"></i>
  221. <p>E-post: post@sogneelektriske.no</p>
  222. </div>
  223.  
  224. </div>
  225.  
  226. <div class="footer-right">
  227.  
  228. <p class="footer-company-about">
  229. <span>Om oss</span> Søgne Elektriske AS ble opprettet i 1999 og tilbyr elektriske installasjoner i boliger og næringsbygg. Vi holder til i Søgne utenfor Kristiansand.
  230. </p>
  231.  
  232. </div>
  233.  
  234. </footer>
  235. </body>
  236.  
  237. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement