Server IP : 103.53.40.154 / Your IP : 3.145.58.90 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/fastelevator.in/admin/../../panshimart.com/../rajwadahouse.com/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php include_once('admin/config.php'); include_once('site-main-query.php'); function isAllowedMessage($message) { $allowedChars = '/^[a-zA-Z0-9,@. ]*$/'; return preg_match($allowedChars, $message); } if ($_SERVER["REQUEST_METHOD"] === "POST") { if (isset($_POST['submit'])) { $name = $_POST['name']; $phone = $_POST['phone']; $email = $_POST['email']; $message = $_POST['message']; 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($email)) { $errors[] = "Email field is required."; } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $errors[] = "Invalid email format."; } 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); $message = htmlspecialchars($message, ENT_QUOTES, 'UTF-8'); // Check for potentially malicious content in the message if (!isAllowedMessage($message)) { $errors[] = "Your message contains potentially malicious content or disallowed characters."; } if (empty($errors)) { // Your existing code for successful submission $query = "INSERT INTO `tbl_queries` (`name`, `phone`, `email`, `message`, `datetime`) VALUES (?, ?, ?, ?, ?)"; $stmt = mysqli_prepare($db, $query); if ($stmt) { mysqli_stmt_bind_param($stmt, "sssss", $name, $phone, $email, $message, $currentTime); $result = mysqli_stmt_execute($stmt); mysqli_stmt_close($stmt); if ($result) { $sendmail=$data1["email"]; // $to = "digitalsaleem12@gmail.com"; $to = $sendmail; $subject = "New Query Submitted From Loveit Chocoiza"; $emailMessage = "A new query has been submitted:\n\n"; $emailMessage .= "Name: $name\n"; $emailMessage .= "Phone: $phone\n"; $emailMessage .= "Email: $email\n"; $emailMessage .= "Message: $message\n"; $headers = "From: $email"; if (mail($to, $subject, $emailMessage, $headers)) { echo "<script> window.alert('Successfully Sent! We will contact you soon'); window.location.href = '$wspath' + 'contact.html'; </script>"; } else { echo "Error sending email."; } } else { $errors[] = "Error in processing your request. Please try again later."; } } else { $errors[] = "Error in preparing the statement."; } } else { // Display validation errors in an alert echo "<script> var errorMessage = '"; foreach ($errors as $error) { echo addslashes($error) . "\\n"; } echo "'; window.alert(errorMessage); </script>"; } } } ?> <!doctype html> <html class="no-js" lang="zxx"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <?php include "top-links.php";?> <title>Contact Us</title> <title><?=$datacontact['site_pages_meta_title'];?></title> <meta name="description" content="<?=$datacontact['site_pages_meta_description'];?>"> </head> <body> <div id="main-wrapper"> <?php include "header.php";?> <div class="page-banner-section section bg-image" data-bg="<?php echo $wspath?>assets/images/bg/breadcrumb.jpg"> <div class="container"> <div class="row"> <div class="col"> <div class="page-banner text-center"> <h1><?=$datacontact['site_pages_name'];?></h1> <ul class="page-breadcrumb"> <li><a href="<?php echo $wspath?>">Home</a></li> <li><?=$datacontact['site_pages_name'];?></li> </ul> </div> </div> </div> </div> </div> <div class="conact-section section pt-95 pt-lg-75 pt-md-65 pt-sm-55 pt-xs-45"> <div class="container sb-border pb-100 pb-lg-80 pb-md-70 pb-sm-60 pb-xs-50"> <div class="row"> <div class="col-lg-3 col-12"> <div class="contact-information"> <h3>Contact Us</h3> <ul> <li> <span class="icon"><i class="fa fa-home"></i></span> <h4 class="text">Address</h4> <p><?php echo $data1['address']?></p> </li> <li> <span class="icon"><i class="fa fa-envelope-open-o"></i></span> <h4 class="text">Email</h4> <p><?php echo $data1['email']?><br> <?php echo $data1['alt_email']?></p> </li> <li> <span class="icon"><i class="fa fa-phone"></i></span> <h4 class="text">Phone</h4> <p>Mobile: <?php echo $data1['phone']?><br> Hotline: <?php echo $data1['alt_phone']?></p> </li> </ul> </div> </div> <div class="col-lg-9 col-12"> <div class="contact-form-wrap" style=" padding: 30px; background: #ccc; border-radius: 10px;"> <h3 class="contact-title">Tell Us Your Message</h3> <form method="post"> <div class="row"> <div class="col-md-6"> <div class="contact-form-style mb-20"> <input name="name" class="cheakout" placeholder="Name*" type="text"> </div> </div> <div class="col-md-6"> <div class="contact-form-style mb-20"> <input name="email" class="cheakout" placeholder="Email*" type="email"> </div> </div> <div class="col-md-6"> <div class="contact-form-style mb-20"> <input name="phone" class="cheakout" placeholder="Phone*" type="text"> </div> </div> <div class="col-md-6"> <div class="contact-form-style mb-20"> <input name="subject" class="cheakout" placeholder="Subject*" type="text"> </div> </div> <div class="col-md-12"> <div class="contact-form-style"> <textarea name="message" placeholder="Type your message here.."></textarea> <input type="submit" class="btn cnt-btn" name="submit" value="Send message"> <!--<button class="btn cnt-btn" type="submit"><span>Send message</span></button>--> </div> </div> </div> </form> </div> </div> </div> </div> </div> <div class="container-fluid"> <div class="contact-map-section section"> <div id="contact-map" class="contact-map"> <iframe src="<?php echo $data1['map_link']?>" width="100%" height="400" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe> </div> </div> </div> <?php include "footer.php";?> </div> </body> </html>