Server IP : 103.53.40.154 / Your IP : 18.191.200.223 Web Server : Apache System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : ppcad7no ( 715) PHP Version : 8.2.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0750) : /home2/ppcad7no/gudduguesthouse.com/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php // include_once "admin/config.php"; if ($_SERVER["REQUEST_METHOD"] === "POST") { if (isset($_POST['submit-popup'])) { $name = $_POST['name']; $phone = $_POST['phone']; $email = $_POST['email']; $subject = $_POST['subject']; date_default_timezone_set("Asia/Kolkata"); $currentTime = date("Y-m-d H:i:s"); $errors = array(); // Validate input if (empty($name)) { $errors[] = "Name field is required."; } elseif (!preg_match('/^[a-zA-Z ]+$/', $name)) { $errors[] = "Name can only contain alphabets."; } if (empty($phone)) { $errors[] = "Phone field is required."; } elseif (!preg_match('/^\d{10}$/', $phone)) { $errors[] = "Phone number should have exactly 10 digits."; } // Sanitize input $name = filter_var($name, FILTER_SANITIZE_STRING); $phone = filter_var($phone, FILTER_SANITIZE_NUMBER_INT); $email = filter_var($email, FILTER_SANITIZE_EMAIL); if (empty($errors)) { $queryss = "INSERT INTO `tbl_queries` (`name`, `phone`, `email`, `subject`, `datetime`) VALUES ('$name', '$phone', '$email', '$subject', '$currentTime')"; $resultss = mysqli_query($db, $queryss); $to = 'gudoogulzar@gmail.com'; // $to = 'digitalsaleem12@gmail.com'; $subjects = "New Query Submitted From Guddu Guest House"; $emailMessage = " <html> <head> <style> body { font-family: Arial, sans-serif; margin: 0; padding: 0; background-color: #f4f4f4; color: #333; } .container { width: 100%; max-width: 600px; margin: 0 auto; background-color: #ffffff; padding: 20px; border-radius: 8px; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1); } table { width: 100%; border-collapse: collapse; margin: 20px 0; } table, th, td { border: 1px solid #ddd; } th, td { padding: 12px; text-align: left; } th { background-color: #f4f4f4; } .footer { text-align: center; margin-top: 20px; font-size: 12px; color: #aaa; } .header-title { text-align: center; background-color: #867868; color: white; padding: 10px 0; font-size: 20px; font-weight: bold; } @media (max-width: 600px) { .container { width: 100%; padding: 10px; } table, th, td { width: 100%; display: block; } th, td { box-sizing: border-box; } } </style> </head> <body> <div class='container'> <table> <thead> <tr> <th colspan='2' class='header-title'>New Query Submitted From Guddu Guest House</th> </tr> </thead> <tbody> <tr> <th>Name</th> <td>$name</td> </tr> <tr> <th>Phone</th> <td>$phone</td> </tr> <tr> <th>Email</th> <td>$email</td> </tr> <tr> <th>Subject</th> <td>$subject</td> </tr> <tr> <th>Query DateTime</th> <td>$currentTime</td> </tr> <tr> <th>From</th> <td>Guddu Guest House</td> </tr> </tbody> </table> <div class='footer'> <p>© Guddu Guest House</p> </div> </div> </body> </html>"; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; if($email!=''){ $headers .= "From: $email" . "\r\n"; } mail($to, $subjects, $emailMessage, $headers); // echo "<script> // window.alert('Successfully Sent! We will contact you soon'); // window.location.href = 'index.html'; // </script>"; // } else { // echo "<script> // window.alert('Error sending email'); // window.location.href = 'index.html'; // </script>"; // } if ($resultss) { echo "<script> window.alert('Successfully Sent! We will contact you soon'); window.location.href = 'index.html'; </script>"; } else { echo "<script> window.alert('Error sending email'); window.location.href = 'index.html'; </script>"; } } else { $errorMessage = ""; foreach ($errors as $error) { $errorMessage .= addslashes($error) . "\\n"; } echo "<script> window.history.back(); setTimeout(function() { alert('$errorMessage'); }, 100); </script>"; } } } ?> <style> /* General styles for the modal form */ #pop-form form { padding: 24px; border-radius: 10px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); text-align: center; z-index: 1050; /* Make sure the form's z-index is higher than the backdrop */ position: relative; /* Ensure the form is positioned above other content */ } #pop-form .modal-content { background-color: #f2e7d5; } /* Heading inside the modal form */ #pop-form h2 { margin-bottom: 20px; font-size: 22px; } /* Input fields inside the modal form */ #pop-form input[type="text"], #pop-form input[type="tel"], #pop-form input[type="email"] { width: 100%; padding: 10px; margin: 8px 0; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; } /* Button inside the modal form */ #pop-form button { color: white; width: 100%; border: none; border-radius: 5px; cursor: pointer; transition: background-color 0.3s; background-color:#FE5A0E; } #pop-form button:hover { background-color: #59544f; } #pop-form .modal { z-index: 9999999 !important; background: #000000ab; } /* Center modal vertically and horizontally on mobile and desktop */ .modal-dialog { display: flex; align-items: center; justify-content: center; min-height: 100vh; /* Make the modal dialog fill the viewport height */ z-index: 5050 !important; /* Ensure the modal has a high enough z-index */ } /* Ensure the modal backdrop covers the content */ .modal-backdrop { z-index: 1!important; /* The backdrop should be just below the modal */ } .modal-content{ z-index: 5040 !important; } </style> <section id="pop-form"> <div class="container"> <div class="row"> <div class="col-lg-3"></div> <div class="col-lg-6"> <!-- Modal --> <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" data-backdrop="true" data-keyboard="false"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div id="form"> <div class="form-block"> <div class="form-header"> <h3 class="mb10 text-center"><span>Get A Free Quote</span></h3> </div> <form class="shake" action="<?php $_PHP_SELF?>" method="POST"> <div class="row"> <div class="fieldsets col-sm-12"> <input type="text" placeholder="Your Name*" name="name" required data-error="Please fill Out"> <?php if (isset($errors) && in_array("Name field is required.", $errors)) { ?> <p class="error">Name field is required.</p> <?php } elseif (isset($errors) && in_array("Name can only contain alphabets.", $errors)) { ?> <p class="error">Name can only contain alphabets.</p> <?php } ?> <!--<div class="help-block with-errors"></div>--> </div> <div class="fieldsets col-sm-12"> <input type="text" placeholder="Your Phone*" name="phone" minlength="10" maxlength="10" onkeypress="return isNumberKey(event)" pattern=".{10,10}" onpaste="return false;" required> <?php if (isset($errors) && in_array("Phone field is required.", $errors)) { ?> <p class="error">Phone field is required.</p> <?php } elseif (isset($errors) && in_array("Phone number should have exactly 10 digits.", $errors)) { ?> <p class="error">Phone number should have exactly 10 digits.</p> <?php } ?> <!--<div class="help-block with-errors"></div>--> </div> <!--<div class="fieldsets col-sm-12">--> <!-- <input type="email" placeholder="Your Email" name="email" required>--> <!--</div>--> <div class="fieldsets col-sm-12"> <input type="text" placeholder="Your Requirement" name="subject" > <!--<div class="help-block with-errors"></div>--> </div> </div> <button type="submit" name="submit-popup" class="btn lnk btn-main bg-btn">Submit <span class="circle"></span></button> <div class="text-center " style="margin-top:10px"> <a href="tel:<?php echo $datac["phone"]; ?>" style="color:#fe5a0e;"><i class="fa fa-phone"></i> <?php echo $datac["phone"]; ?></a> </div> <!--<div id="msgSubmit" class="h3 text-center hidden"></div>--> <div class="clearfix"></div> <!--<p class="trm"><i class="fas fa-lock"></i>We hate spam, and we respect your privacy.</p>--> </form> </div> </div> </div> </div> </div> </div> <div class="col-lg-3"></div> </div> </div> </section> <script> // Wait for the DOM to fully load document.addEventListener('DOMContentLoaded', function() { // Set a timeout to show the modal after 5 seconds setTimeout(function() { // Use Bootstrap's method to show the modal $('#exampleModal').modal('show'); }, 3000); // 5000 milliseconds = 5 seconds }); </script>