Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (count($_POST)) {
- $name = $_POST['name'];
- $email = $_POST['email'];
- $message = $_POST['message'];
- $from = 'Søgne Elektriske AS Kontakt Skjema';
- $to = 'thomasstrommen@hotmail.com';
- $subject = 'Melding fra kontakt skjema';
- $body = sprintf(file_get_contents('mailtemplate.html'), $name, $email, $message);
- if ($_POST['name']) {
- if ($_POST['email'] || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
- if ($_POST['text']) {
- require 'PHPMailer/PHPMailerAutoload.php';
- $mail = new PHPMailer;
- //$mail->SMTPDebug = 3; // Enable verbose debug output
- $mail->CharSet = "UTF-8";
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = "smtp.live.com"; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'thomasstrommen@hotmail.com'; // SMTP username
- $mail->Password = 'dont even dare to try'; // SMTP password
- $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = 25; // TCP port to connect to
- $mail->setFrom($email, $name);
- $mail->addAddress('thomasstrommen@hotmail.com'); // Add a recipient
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = $subject;
- $mail->AltBody = $body;
- $mail->Body = $body;
- if(!$mail->send()) {
- echo 'Meldingen kunne ikke bli sendt';
- echo 'PHPMailer error: ' . $mail->ErrorInfo;
- } else {
- echo 'Meldingen din ble sendt!';
- }
- exit;
- }
- }
- }
- }
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
- <title>Søgne Elektriske AS</title>
- <!-- Bootstrap -->
- <link href="css/bootstrap.min.css" rel="stylesheet">
- <link href="css/common.css" rel="stylesheet">
- <link href="css/kontakt.css" rel="stylesheet">
- <link href="css/footer.css" rel="stylesheet">
- <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
- <!-- Include all compiled plugins (below), or include individual files as needed -->
- <script src="js/bootstrap.min.js"></script>
- <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDEleDca0HX6XBjOSsVSefpUqD_Di_TpxM&callback=initMap" async defer></script>
- <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
- <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
- <!--[if lt IE 9]>
- <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
- <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
- <![endif]-->
- </head>
- <body>
- <div id="loading">
- <br><br><br><br>
- <img src="ring.gif">
- </div>
- <div class="navbar navbar-default navbar-static-top" role="navigation">
- <div class="container">
- <div class="navbar-header">
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- <a class="navbar-brand" href="index.php">
- <img src="img/logo.png"></a>
- </div>
- <div class="navbar-collapse collapse">
- <ul class="nav navbar-nav navbar-right">
- <li><a href="index.php"><h4>Hjem</h4></a></li>
- <li><a href="tjenester.php"><h4>Tjenester</h4></a></li>
- <li class="active"><a href="kontakt.php"><h4>Kontakt oss</h4></a></li>
- </ul>
- </div>
- </div>
- </div>
- <div class="container">
- <h1>Kontakt oss</h1>
- <div class="form-group" style="padding-top:30px;">
- <div class="col-sm-4">
- <label for="contact-name" class="control-label">Navn</label>
- <input type="text" name="name" class="form-control" id="contact-name" placeholder="Ola Nordmann">
- </div>
- <div class="col-sm-4">
- <label for="contact-email" class="control-label">E-post</label>
- <input type="text" name="email" class="form-control" id="contact-email" placeholder="Ola.Nordmann@eksempel.com">
- </div>
- </div>
- <div class="form-group" style="padding-top:50px;">
- <div class="col-sm-8">
- <label for="contact-email" class="control-label">Melding</label>
- <textarea class="form-control" id="text" rows="6"></textarea>
- </div>
- </div>
- <div class="form-group">
- <div class="col-sm-12">
- <button id="send" class="btn btn-success" style="margin-top:15px;">Send</button>
- </div>
- </div>
- </div>
- <script type="text/javascript">
- $(function() {
- $('#send').click(function() {
- // Todo: Vis loading-animasjon.
- $.ajax({
- method: 'post',
- url: 'kontakt.php', // Todo: Bruk riktig filnavn her.
- data: {
- name: $('#contact-name').val(),
- email: $('#contact-email').val(),
- message: $('#text').val()
- },
- success: function() {
- alert("hei");
- // Todo: Skjul loading-animasjon.
- }
- });
- });
- });
- </script>
- <div class="container" style="padding-top:100px;">
- <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>
- </div>
- <footer class="footer-distributed">
- <div class="footer-left">
- <h3>Søgne Elektriske AS</h3>
- <p class="footer-links">
- <a href="index.html">Hjem</a> ·
- <a href="tjenester.html">Tjenester</a> ·
- <a href="kontakt.html">Kontakt oss</a>
- </p>
- <p class="footer-company-name">Søgne Elektriske AS © 2016</p>
- </div>
- <div class="footer-center">
- <div>
- <i class="fa fa-map-marker"></i>
- <p><span>Linnegrøvan 24</span> 4640 Søgne</p>
- </div>
- <div>
- <i class="fa fa-phone"></i>
- <p>38 05 30 30</p>
- </div>
- <div>
- <i class="fa fa-envelope"></i>
- <p>E-post: post@sogneelektriske.no</p>
- </div>
- </div>
- <div class="footer-right">
- <p class="footer-company-about">
- <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.
- </p>
- </div>
- </footer>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement