MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.135.206.229
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/aiidm.in/../instantservicez.com/../.spamassassin/../bethepolice.in/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/aiidm.in/../instantservicez.com/../.spamassassin/../bethepolice.in/contact-us.php
<?php
include_once('admin/config.php');

if ($_SERVER["REQUEST_METHOD"] === "POST") {
    if (isset($_POST['submit'])) {
        $name = $_POST['name'];
        $phone = $_POST['phone'];
        $email = $_POST['email'];
        $message = $_POST['message'];

        if (empty($name)) {
            $errors[] = "Name field is required.";
        } elseif (!ctype_alpha($name)) {
            $errors[] = "Name can only contain alphabets.";
        }

        if (empty($email)) {
            $errors[] = "Email field is required.";
        }

        if (empty($phone)) {
            $errors[] = "Phone field is required.";
        } elseif (!preg_match('/^\d{10}$/', $phone)) {
            $errors[] = "Phone number should have exactly 10 digits.";
        }
        if (!empty($message)) {
            $message = htmlspecialchars($message); 
        }

        if (empty($errors)) {
            $query = "INSERT INTO `tbl_queries` (`name`, `phone`, `email`, `message`) VALUES (?, ?, ?, ?)";
            $stmt = mysqli_prepare($db, $query);
            mysqli_stmt_bind_param($stmt, "ssss", $name, $phone, $email, $message);
            $result = mysqli_stmt_execute($stmt);
            mysqli_stmt_close($stmt);

            if ($result) {
                // Sending email
                $to = "info@bethepolice.in";
                // $to = "digitalsaleem12@gmail.com";
                $subject = "New Query Submitted From BeThePolice";
                $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 = 'contact-us.html';
                </script>";
            } else {
               echo "Error sending email.";
                }
            } else {
              echo "Error";
            }
       }
   }
 }
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Bethepolice</title>
    <?php include "top-links.php";?>
    
</head>
<style>
  .bg-shadow{margin: 10px;
    padding: 30px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
    border-radius: 6px;
    max-width: 800px;
  }
  .frm-sub-btn{
    width: 100%;
  }
</style>

<body>
    <!--header -->
    <?php include "header.php";?>
    <section class="inner-header divider layer-overlay overlay-dark-6" data-bg-img="img/breadcrumbs.jpg" style="background-image: url('img/breadcump-img.jpg'); background-position: center; background-size: cover;padding-top: 55px;">
          <div class="container pt-120 pb-60">
            <div class="section-content">
              <div class="row"> 
                <div class="col-md-6 p-4">
                  <h2 class="mhead text-white">Contact Us</h2>
                  <ol class="breadcrumb text-left mt-10 white">
                    <li><a href="">Home </a></li> <span> / </span><li class="active"><a href="contact-us.html"> Contact Us</a></li> 
                  </ol>
                </div>
              </div>
            </div>
          </div>
    </section>
    
    <!--marquee -->
    <?php include "home-marquee.php";?>

    <section class="py-5">
      <div class="container">
        <div class="row">
            <div class="text-center">
                <h2>Contact Us Now</h2>
            </div>
          <div class="col-lg-6">
            <form action="<?php $_PHP_SELF?>" method="POST" class="bg-shadow">
              <div class="row ">
                <div class="col-lg-6">
                    <div class="form-floating mb-3">
                        <input type="text" class="form-control" id="floatingPassword" placeholder="Your Nmae" name="name" required>
                        <?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 } ?>
                        <label for="floatingPassword">Full Name</label>
                    </div>
                </div>
                <div class="col-lg-6">
                  <div class="form-floating mb-3">
                        <input type="text" name="phone" class="form-control" id="floatingPassword" placeholder="Phone Number" 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 } ?>
                        <label for="floatingPassword">Phone Number</label>
                        </div>
                   </div>
                </div>
                <div class="form-floating mb-3">
                    <input type="email" class="form-control" id="floatingInput" placeholder="name@example.com" name="email" required>
                    <?php if (isset($errors) && in_array("Email field is required.", $errors)) { ?>
                        <p class="error">Email field is required.</p>
                    <?php } ?>
                    <label for="floatingInput">Email address</label>
                </div>
              <div class="form-floating mb-3">
                <textarea class="form-control" placeholder="Ask Your Question" id="floatingTextarea2" style="height: 150px" name="message"></textarea>
                <label for="floatingTextarea2">Your Question...</label>
              </div>
              <div class="frm-sub-btn text-center ">
                  <input type="submit" name="submit" value="Send" class="btn btn-success px-4" >
              </div>
            </form>
          </div>
          <div class="col-lg-6">
            <div class="address bg-shadow">
                <i class="fa fa-map-marker"></i><strong> Our Location</strong>
                <p>Cyber Crime Police Station, Outer North District, Bawana Sector-1, New Delhi, New Delhi-110039</p>
              
            </div>
            <div class="address bg-shadow">
                <i class="fa fa-phone"></i><strong> Contact Number</strong>
                <p>+91-991-009-9440</p>
              
            </div>
            <div class="address bg-shadow">
                <i class="fa fa-envelope"></i><strong> Email Address</strong>
                <p>info@bethepolice.in</p>
              
            </div>
          </div>
        </div>
      </div>
    </section>
   
    <!--footer -->
    <?php include "footer.php";?>


</body>

</html>

MMCT - 2023