Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Import PHPMailer classes into the global namespace
- // These must be at the top of your script, not inside a function
- use PHPMailer\PHPMailer\PHPMailer;
- use PHPMailer\PHPMailer\Exception;
- if((isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response']))) {
- $secretKey = "TWOJ SECRET KEY Z GOOGLE RECAPTCHA";
- $response = $_POST['g-recaptcha-response'];
- $url = 'https://www.google.com/recaptcha/api/siteverify';
- $data = array(
- 'secret' => $secretKey,
- 'response' => $response
- );
- $options = array(
- 'http' => array (
- 'method' => 'POST',
- 'content' => http_build_query($data)
- )
- );
- $context = stream_context_create($options);
- $verify = file_get_contents($url, false, $context);
- $captcha_success=json_decode($verify);
- if (true == $captcha_success->success) {
- if( (isset($_POST['name']) && !empty($_POST['name']))
- && (isset($_POST['email']) && !empty($_POST['email']))
- && (isset($_POST['subject']) && !empty($_POST['subject']))
- && (isset($_POST['message']) && !empty($_POST['message'])) ) {
- $name = $_POST['name'];
- $email = $_POST['email'];
- $subject = $_POST['subject'];
- $message = $_POST['message'];
- //Load composer's autoloader
- require 'vendor/autoload.php';
- $mail = new PHPMailer(true); // Passing `true` enables exceptions
- try {
- //Server settings
- $mail->SMTPDebug = 0; // Enable verbose debug output
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'MAIL Z KTOREGO BEDZIESZ WYSYLAC NP ruf@ruf.com'; // SMTP username
- $mail->Password = 'TWOJE HASLO NP ruf'; // SMTP password
- $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = 587; // TCP port to connect to
- //Recipients
- $mail->setFrom($email, $name);
- $mail->addAddress('bartlomiej.pabisiak@gmail.com', 'Bartlomiej Pabisiak'); // Add a recipient
- $mail->addReplyTo($email, $name);
- //$mail->addCC('cc@example.com');
- //$mail->addBCC('bcc@example.com');
- //email content
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = "[bpabisiak.pl - contact] ".$subject;
- $mail->Body = $message;
- $mail->AltBody = $message;
- $mail->send();
- //echo 'Message has been sent';
- } catch (Exception $e) {
- echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
- }
- } else {
- //echo "Missing value in the form";
- }
- //echo "<p>You are not not a bot!</p>";
- } else if (false == $captcha_success->success) {
- //echo "<p>You are a bot! Go away!</p>";
- }
- }
- ?>
- <!DOCTYPE HTML>
- <html>
- <head>
- <script src='https://www.google.com/recaptcha/api.js?hl=en'></script>
- <!-- Global site tag (gtag.js) - Google Analytics -->
- <script async src="https://www.googletagmanager.com/gtag/js?id=UA-113899585-1"></script>
- <script>
- window.dataLayer = window.dataLayer || [];
- function gtag(){dataLayer.push(arguments);}
- gtag('js', new Date());
- gtag('config', 'UA-113899585-1');
- </script>
- <title>Bartlomiej Pabisiak | Software Developer</title>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <!--[if lte IE 8]><script src="assets/js/ie/html5shiv.js"></script><![endif]-->
- <link rel="stylesheet" href="assets/css/main.css" />
- <noscript><link rel="stylesheet" href="assets/css/noscript.css" /></noscript>
- <!--[if lte IE 8]><link rel="stylesheet" href="assets/css/ie8.css" /><![endif]-->
- </head>
- <body>
- <!-- Wrapper-->
- <div id="wrapper">
- <!-- Nav -->
- <nav id="nav">
- <a href="#me" class="icon fa-home active"><span>Home</span></a>
- <!--<a href="#work" class="icon fa-folder"><span>Work</span></a>-->
- <a href="#contact" class="icon fa-envelope"><span>Contact</span></a>
- <a target="_blank" href="https://www.linkedin.com/in/ibpabisiak/" class="icon fa-linkedin"><span>Linkedin</span></a>
- <!--<a href="https://www.facebook.com/bpabisiak" class="icon fa-facebook"><span>Facebook</span></a>-->
- <a target="_blank" href="https://github.com/ibpabisiak" class="icon fa-github"><span>GitHub</span></a>
- </nav>
- <!-- Main -->
- <div id="main">
- <!-- Me -->
- <article id="me" class="panel">
- <header>
- <h1>Bartłomiej Pabisiak</h1>
- <p>Software Developer</p>
- </header>
- <!--<a href="#work" class="jumplink pic">
- <span class="arrow icon fa-chevron-right"><span>See my work</span></span>
- <img src="images/me.png" alt="Bartłomiej Pabisiak" />
- </a>-->
- </article>
- <!-- Work -->
- <!--
- <article id="work" class="panel">
- <header>
- <h2>Work</h2>
- </header>
- <p>
- Phasellus enim sapien, blandit ullamcorper elementum eu, condimentum eu elit.
- Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia
- luctus elit eget interdum.
- </p>
- <section>
- <div class="row">
- <div class="4u 12u$(mobile)">
- <a href="#" class="image fit"><img src="images/pic01.jpg" alt=""></a>
- </div>
- <div class="4u 12u$(mobile)">
- <a href="#" class="image fit"><img src="images/pic02.jpg" alt=""></a>
- </div>
- <div class="4u$ 12u$(mobile)">
- <a href="#" class="image fit"><img src="images/pic03.jpg" alt=""></a>
- </div>
- <div class="4u 12u$(mobile)">
- <a href="#" class="image fit"><img src="images/pic04.jpg" alt=""></a>
- </div>
- <div class="4u 12u$(mobile)">
- <a href="#" class="image fit"><img src="images/pic05.jpg" alt=""></a>
- </div>
- <div class="4u$ 12u$(mobile)">
- <a href="#" class="image fit"><img src="images/pic06.jpg" alt=""></a>
- </div>
- <div class="4u 12u$(mobile)">
- <a href="#" class="image fit"><img src="images/pic07.jpg" alt=""></a>
- </div>
- <div class="4u 12u$(mobile)">
- <a href="#" class="image fit"><img src="images/pic08.jpg" alt=""></a>
- </div>
- <div class="4u$ 12u$(mobile)">
- <a href="#" class="image fit"><img src="images/pic09.jpg" alt=""></a>
- </div>
- <div class="4u 12u$(mobile)">
- <a href="#" class="image fit"><img src="images/pic10.jpg" alt=""></a>
- </div>
- <div class="4u 12u$(mobile)">
- <a href="#" class="image fit"><img src="images/pic11.jpg" alt=""></a>
- </div>
- <div class="4u$ 12u$(mobile)">
- <a href="#" class="image fit"><img src="images/pic12.jpg" alt=""></a>
- </div>
- </div>
- </section>
- </article>
- -->
- <article id="contact" class="panel">
- <header>
- <h2>Contact Me</h2>
- </header>
- <form action="#contact" method="post">
- <div>
- <div class="row">
- <div class="6u 12u$(mobile)">
- <input type="text" name="name" placeholder="Name" />
- </div>
- <div class="6u$ 12u$(mobile)">
- <input type="text" name="email" placeholder="Email" />
- </div>
- <div class="12u$">
- <input type="text" name="subject" placeholder="Subject" />
- </div>
- <div class="12u$">
- <textarea name="message" placeholder="Message" rows="8"></textarea>
- </div>
- <div class="g-recaptcha" data-sitekey="6Ldsl0UUAAAAAKSBWEbU_E1EHjn-N_Cn1tBze5TJ"></div>
- <div class="12u$">
- <input type="submit" value="Send Message" />
- </div>
- </div>
- </div>
- </form>
- </article>
- </div>
- <!-- Footer -->
- <div id="footer">
- <ul class="copyright">
- <li>© BARTŁOMIEJ PABISIAK 2018</li><!--<li>Design: <a href="http://html5up.net">HTML5 UP</a></li>-->
- </ul>
- </div>
- </div>
- <!-- Scripts -->
- <script src="assets/js/jquery.min.js"></script>
- <script src="assets/js/skel.min.js"></script>
- <script src="assets/js/skel-viewport.min.js"></script>
- <script src="assets/js/util.js"></script>
- <!--[if lte IE 8]><script src="assets/js/ie/respond.min.js"></script><![endif]-->
- <script src="assets/js/main.js"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement