<?php
require "database/connect.php";

$name = $email = $sub = $text = "";
if (isset($_POST['submit'])) {
    $name = htmlspecialchars(trim($_POST['name']));
    $email = htmlspecialchars(trim($_POST['email']));
    $sub = htmlspecialchars(trim($_POST['subject']));
    $text = htmlspecialchars(trim($_POST['textarea']));

    // send mail
    $to = "$admin_mail";
    $subject = "Hello Admin, somebody sent a request Contact Mail {$date}";
    $message = "
                <div style='background: #E4E9F0'>
                <center><img src='$website_url/images/$logo_img' width='100px;'></center>
                <div style='font-family: sans-serif; padding: 10px; margin: 5px; background: white; margin: 5px 5%; border-radius: 10px;'>
                <center><img src='$website_url/images/mail.png' width='100px'></center>
                <p>Name: <b>$name</b></p>
                <p>Email:  $email </p>
                <p>Subject:  $sub </p>
                <p>Message:  $text</p>  
                <a href='$website_url' style='color: dodgerblue; text-decoration: none'>
                <button style='padding: 10px; background: dodgerblue; border: 1px solid transparent; color: white; width: 100%; border-radius: 3px'>Login Now</button></a>                
                </div><br><br>
                </div>
                ";

    // Always set content-type when sending HTML email
    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

    // More headers
    $headers .= "rom: $website_email" . "\r\n";
    $headers .= "Reply-To: $website_email \r\n";
    $headers .= "Return-Path: $website_email\r\n";
    // $headers .= "CC: $website_email\r\n";
    $headers .= "BCC: $website_email\r\n";

    if (mail($to, $subject, $message, $headers, "-f $website_email")) {
        echo "<script>
                              alert('Your request has been sent. You will receive a message shortly');
                              window.location.href = 'index'
                          </script>";
    } else {
        echo "<script>
                      alert('Sorry an error occurred. Please try again later');
                      window.location.href = 'index'
                  </script>";
    }
}
?>
<!DOCTYPE html>
<html lang="en">


<!-- contact.html  06:29:23 GMT -->

<head>
    <!-- ========== Meta Tags ========== -->
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="author" content="DiscreteDev">
    <!-- ======== Page title ============ -->
    <title><?php echo $website_name ?></title>
    <!-- ========== Favicon Icon ========== -->
    <link rel="shortcut icon" href="images/<?php echo $logo_img; ?>">
    <!-- ===========  All Stylesheet ================= -->
    <!--  Icon css plugins -->
    <link rel="stylesheet" href="assets/css/icons.css">
    <!--  animate css plugins -->
    <link rel="stylesheet" href="assets/css/animate.css">
    <!--  slick css plugins -->
    <link rel="stylesheet" href="assets/css/swiper-bundle.min.css">
    <!--  magnific-popup css plugins -->
    <link rel="stylesheet" href="assets/css/magnific-popup.css">
    <!-- metis menu css file -->
    <link rel="stylesheet" href="assets/css/metismenu.css">
    <!--  Bootstrap css plugins -->
    <link rel="stylesheet" href="assets/css/bootstrap.min.css">
    <!--  main style css file -->
    <link rel="stylesheet" href="assets/css/style.css">


</head>

<body class="body-wrapper">
    <!-- preloader start here -->
    <div class="preloader">
        <div class="spinner"></div>
    </div>
    <!-- preloader ending here -->



    <!-- header section start hare -->

    <?php include 'header.php'; ?>
    <!-- header section end hare -->



    <!-- banner section start hare -->

    <div class="page-banner-wrap  text-capitalize">
        <div class="container">
            <div class="row">
                <div class="col-12 col-xl-6 ps-xl-0 pe-xl-0 offset-xl-3 col-lg-8 offset-lg-2 text-center text-white">
                    <div class="page-heading">
                        <h1>Contact</h1>
                    </div>
                    <nav aria-label="breadcrumb">
                        <ul class="breadcrumb justify-content-center">
                            <li class="breadcrumb-item"><a href="./">Home</a></li>
                            <li class="breadcrumb-item active" aria-current="page">Contact</li>
                        </ul>
                    </nav>
                </div>
            </div>
        </div>
    </div>

    <!-- banner section end hare -->



    <section class="contact-us-wrapper section-padding">
        <div class="container">
            <div class="row mt-3 mt-lg-5">
                <div class="col-lg-8 col-xl-6 offset-xl-3 offset-lg-2 text-center">
                    <div class="block-contents">
                        <div class="section-title mb-4">
                            <h2 class="wow fadeInUp">Get in touch now!</h2>
                            <p class="wow fadeInUp pt-15" data-wow-delay=".3s">Is there an inquiry or some feedback for
                                us? Fill out the form to contact our team. We love to hear from you.</p>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-lg-6 pe-lg-4 order-2 order-lg-1">
                    <div class="contact-thumb me-lg-4 wow fadeInUp">
                        <img src="assets/img/contact/1.png" alt="contact">

                    </div>
                </div>
                <div class="col-lg-6 pls-lg-4 wow fadeInUp order-1 order-lg-2">
                    <div class="question__form-wrapper question__form-wrapper--style-2" data-aos-duration="1000" data-aos="fade-up">
                        <h3>Seeking Information?</h3>
                        <form action="" class="question__form" id="" method="POST">
                            <div class="row g-4">
                                <div class="col-12">
                                    <input type="text" name="name" class="form-control" placeholder="Your name" aria-label="Name" required>
                                </div>
                                <div class="col-12">
                                    <input type="email" name="email" class="form-control" placeholder="Your email" aria-label="Email" required>
                                </div>
                                <div class="col-12">
                                    <input type="text" name="subject" class="form-control" placeholder="Subject" aria-label="Subject" required>
                                </div>
                                <div class="col-12">
                                    <textarea name="textarea" class="form-control form-control--message" placeholder="Describe your message" required></textarea>
                                </div>
                            </div>
                            <button type="submit" name="submit" class="form-control custom-btn text-center text-dark mt-4">Message
                                Submit</button>
                        </form>
                        <!-- <p class="form-message mt-4"></p> -->
                    </div>
                </div>
            </div>

            <div class="row text-center">
                <div class="col-md-6 col-xl-4">
                    <div class="single-contact-box ">
                        <div class="contact-thumb">
                            <img src="assets/img/contact/icon/1.png" alt="">
                        </div>
                        <div class="contact-info">
                            <!-- <span>+088-123-456-789</span>
                            <span>+088-321-654-789</span> -->
                        </div>
                    </div>
                </div>
                <div class="col-md-6 col-xl-4">
                    <div class="single-contact-box">
                        <div class="contact-thumb">
                            <img src="assets/img/contact/icon/2.png" alt="">
                        </div>
                        <div class="contact-info">
                            <span><?php echo $website_email; ?></span>

                        </div>
                    </div>
                </div>
                <div class="col-md-6 col-xl-4">
                    <div class="single-contact-box ">
                        <div class="contact-thumb">
                            <img src="assets/img/contact/icon/1.png" alt="">
                        </div>
                        <div class="contact-info">
                            <span>4132 Thornridge City, New York.</span>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>



    <!-- footer section start hare -->

    <?php include 'footer.php'; ?>

    <!-- footer section end hare -->

    <!--  ALl JS Plugins
    ====================================== -->
    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/js/modernizr.min.js"></script>
    <script src="assets/js/jquery.easing.js"></script>
    <script src="assets/js/popper.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/isotope.pkgd.min.js"></script>
    <script src="assets/js/imageload.min.js"></script>
    <script src="assets/js/scrollUp.min.js"></script>
    <script src="assets/js/swiper-bundle.min.js"></script>
    <script src="assets/js/magnific-popup.min.js"></script>
    <script src="assets/js/wow.min.js"></script>
    <script src="assets/js/metismenu.js"></script>
    <script src="assets/js/active.js"></script>
</body>


<!-- contact.html  06:29:24 GMT -->

</html>