HEX
Server: LiteSpeed
System: Linux my-kul-web2054.main-hosting.eu 5.14.0-611.13.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 11 04:57:59 EST 2025 x86_64
User: u665686179 (665686179)
PHP: 8.2.30
Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: /home/u665686179/domains/hometuitionacademy.com/public_html/email.php
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Collect and sanitize input
    $name = htmlspecialchars(trim($_POST['name']));
    $phone = htmlspecialchars(trim($_POST['phone']));
    $course = htmlspecialchars(trim($_POST['course']));
    $school = isset($_POST['school']) ? htmlspecialchars(trim($_POST['school'])) : '';
    $college = isset($_POST['college']) ? htmlspecialchars(trim($_POST['college'])) : '';
    $query = isset($_POST['query']) ? htmlspecialchars(trim($_POST['query'])) : '';

    // Validation
    $errors = [];
    if (empty($name)) {
        $errors[] = "Name is required.";
    }
    if (empty($phone) || !preg_match('/^\d{10}$/', $phone)) {
        $errors[] = "Phone is required and must be a 10-digit valid number.";
    }

    if (!empty($errors)) {
        echo "<p style='color:red;'>".implode("<br>", $errors)."</p>";
        exit;
    }

    // Prepare email
    $to = "your-email@example.com"; // Replace with your email
    $subject = "New Enquiry: Private Tutor Form Submission";
    $body = "
        <h3>Form Submission Details:</h3>
        <p><strong>Name:</strong> $name</p>
        <p><strong>Phone:</strong> $phone</p>
        <p><strong>School:</strong> $school</p>
        <p><strong>College:</strong> $college</p>
        <p><strong>Course:</strong> $course</p>
        <p><strong>Query:</strong> $query</p>
    ";
    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
    $headers .= "From: no-reply@example.com" . "\r\n"; // Replace with your domain's email

    // Send email
    if (mail($to, $subject, $body, $headers)) {
        echo "<p style='color:green;'>Thank you for your submission. We will contact you shortly!</p>";
    } else {
        echo "<p style='color:red;'>Sorry, there was an error sending your message. Please try again later.</p>";
    }
}
?>