|
Server IP : 217.21.91.233 / Your IP : 216.73.216.58 Web Server : LiteSpeed System : Linux in-mum-web832.main-hosting.eu 4.18.0-553.34.1.lve.el8.x86_64 #1 SMP Thu Jan 9 16:30:32 UTC 2025 x86_64 User : u952924200 ( 952924200) PHP Version : 8.2.27 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : ON Directory (0755) : /home/u952924200/domains/nadeemtravels.in/public_html/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require __DIR__ . '/phpmailer/src/Exception.php';
require __DIR__ . '/phpmailer/src/PHPMailer.php';
require __DIR__ . '/phpmailer/src/SMTP.php';
if ($_SERVER['REQUEST_METHOD'] === "POST" && isset($_POST['submitForm'])):
function clean($data)
{
$data = trim($data);
$data = strip_tags($data);
$data = htmlspecialchars($data, ENT_QUOTES, 'UTF-8');
return $data;
}
$request = (object) $_POST;
$name = clean($request->name);
$phone = clean($request->mobile);
$email = clean($request->email);
$message = clean($request->message);
require_once __DIR__ . "/include/connection.php";
date_default_timezone_set("Asia/Kolkata");
$date = date("Y-m-d H:i:s");
$sql = "INSERT INTO contact
(name, phone, email, message, created_at)
VALUES (:name, :phone, :email, :message, :created_at)";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':name', $name);
$stmt->bindParam(':phone', $phone);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':message', $message);
$stmt->bindParam(':created_at', $date);
$stmt->execute();
$mail = new PHPMailer(true);
$mail->SMTPDebug = 0;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'kanpurtaxi5@gmail.com';
$mail->Password = 'bkhppouqbbxpdmhm';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$mail->Port = 465;
$mail->setFrom('kanpurtaxi5@gmail.com', 'Nadeem Travels');
$mail->addAddress('naddu.khan.111@gmail.com', 'Nadeem Travels');
$mail->addAddress('kanpurtaxi5@gmail.com', 'Nadeem Travels');
$mail->CharSet = 'UTF-8';
$mail->isHTML(true);
$mail->Subject = "Nadeem Travels : New Contact Us Enquiry - $name";
$mail->isHTML(true);
$message = "
<html>
<body style='font-family: Arial, sans-serif; font-size:14px; color:#333;'>
<h2 style='margin-bottom:10px;'>Booking Enquiry</h2>
<p><strong>Name:</strong> {$name}</p>
<p><strong>Phone:</strong> {$phone}</p>
<p><strong>Email:</strong> {$email}</p>
<p><strong>Message:</strong><br>" . nl2br(htmlspecialchars($message)) . "</p>
<p><strong>Enquiry Time:</strong><br>" . nl2br(htmlspecialchars($date)) . "</p>
</body>
</html>
";
$mail->Body = $message;
$mail->send();
header("Location:thanks");
endif;