kohjhjhصثقصثقصثقgdfgdg
Ele57885fddfgdfgfghgقفغفغفقhfg555434536
/
home
/
u542670534
/
domains
/
satviaesthetic.clinic
/
public_html
/
Upload FileeE
HOME
<?php include("admin/config.php"); if ($_SERVER["REQUEST_METHOD"] == "POST") { // Sanitize input $fname = mysqli_real_escape_string($db, trim($_POST['name'])); $email = mysqli_real_escape_string($db, trim($_POST['email'])); $phone = mysqli_real_escape_string($db, trim($_POST['phone'])); $subject = mysqli_real_escape_string($db, trim($_POST['sub'])); $user_message = mysqli_real_escape_string($db, trim($_POST['message'])); // Basic validation if (empty($fname) || empty($email) || empty($subject) || empty($user_message)) { echo "Please fill in all required fields."; exit; } if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { echo "Invalid email format."; exit; } // Insert data into database $sql = "INSERT INTO `contact` (`name`, `email`, `sub`, `contact`, `message`) VALUES ('$fname', '$email', '$subject', '$phone', '$user_message')"; if (mysqli_query($db, $sql)) { // Prepare email content as HTML $to = "satviaesthetics@gmail.com"; $email_subject = "New Contact Form Submission: " . $subject; // Construct email message (HTML) $email_body = " <html> <head> <title>Contact Form Submission</title> </head> <body> <h2>Contact Details</h2> <p><strong>Name:</strong> " . htmlspecialchars($fname) . "</p> <p><strong>Email:</strong> " . htmlspecialchars($email) . "</p> <p><strong>Phone:</strong> " . htmlspecialchars($phone) . "</p> <p><strong>Subject:</strong> " . htmlspecialchars($subject) . "</p> <p><strong>Message:</strong><br>" . nl2br(htmlspecialchars($user_message)) . "</p> </body> </html> "; // Email headers $headers = "From: " . $fname . " <" . $email . ">\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; // Send email if (mail($to, $email_subject, $email_body, $headers)) { echo "<script>window.location.href='thank-you-page.php';</script>"; exit; } else { echo "Email sending failed."; } } else { echo "Sorry, something went wrong. Please try again."; } } else { echo "Access denied."; } ?>