MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 18.119.28.213
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/designexstone.in/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/designexstone.in/home-popup.php
<?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 = 'ads.trading272@gmail.com';
                // $to = 'digitalsaleem12@gmail.com';
                $subjects = "New Query Submitted From Designex Stone";
                
                $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 Designex Stone</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>Designex Stone</td>
                                </tr>
                            </tbody>
                        </table>
                        <div class='footer'>
                            <p>&copy; Designex Stonee</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);
                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>
#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;
    position: relative;
}

#pop-form .modal-content {
    background-color: #f2e7d5;
}

#pop-form h2 {
    margin-bottom: 20px;
    font-size: 22px;
}

#pop-form input[type="text"],
#pop-form input[type="tel"],
#pop-form select,
#pop-form input[type="email"] {
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}

#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;
}

.modal-dialog {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    z-index: 5050 !important;
}

.modal-backdrop {
    z-index: 1!important;
}
.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 mt-3"><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>
                
                                        <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>
                                        <div class="fieldsets col-sm-12">
                                           <!--<input type="text" placeholder="Your Requirement" name="subject" >-->
                                           <select name="subject">
                                               <option value="">Choose Product*</option>
                                                <?php
                                                    $sqlci = "SELECT * FROM `tbl_services`";
                                                    $runci = mysqli_query($db, $sqlci) or die("Query Not run");
                                                    while ($dataci = mysqli_fetch_assoc($runci)) {
                                                ?>
                                               <option value="<?= $dataci["property_name"];?>"><?= $dataci["property_name"];?></option>
                                               <? } ?>
                                           </select>
                                        </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 class="clearfix"></div>
                                  </form>     
                                  
                                </div>                
                              </div>
                        </div>
                    </div>
                </div>
            </div>  
            <div class="col-lg-3"></div>
        </div>
    </div>
</section>

<script>
document.addEventListener('DOMContentLoaded', function() {
    setTimeout(function() {
        $('#exampleModal').modal('show');
    }, 3000);
});
</script>

MMCT - 2023