Server : LiteSpeed
System : Linux terra.hostitbro.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64
User : outerorb ( 1091)
PHP Version : 8.1.34
Disable Function : mail
Directory :  /home2/outerorb/zapnix.co/

📁 Create New:
⬆️ Upload File:
Current Dir [ Writable ] Root [ Writable ]


OR Upload from URL:
URL: Save as:

📄 File: enquiry_popup.php

Path: /home2/outerorb/zapnix.co/enquiry_popup.php

Size: 6.27 KB

Permissions: 0644

<?php
include_once("include/main.inc.php");
$admin_res = getAdminDetails();
// Set the timezone to Eastern Time (ET)
date_default_timezone_set('America/New_York');

$enq_date = date('Y-m-d H:i:s');
$referer = $_SERVER['HTTP_REFERER'];
$ip = $_SERVER['REMOTE_ADDR'];

if (isset($_POST['enquiry_submit'])) {

    $secretKey =    $secretKey = SECRET_KEY; 
    $responseKey = $_POST['g-recaptcha-response'];


    if (empty($responseKey)) {
        $resp = [
            'message_response' => 'Please click on the reCAPTCHA box.',
            'status' => false
        ];
        echo json_encode($resp);
        exit;
    }


    $url = "https://www.google.com/recaptcha/api/siteverify";
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, [
        'secret' => $secretKey,
        'response' => $responseKey,
        'remoteip' => $ip
    ]);
    $response = curl_exec($ch);
    curl_close($ch);


    $responseData = json_decode($response);
    
    if (!$responseData->success) {
        $resp = [
            'message_response' => 'reCAPTCHA verification failed. Please try again.',
            'status' => false
        ];
        echo json_encode($resp);
        exit;
    }

    // Form processing if reCAPTCHA validation passed
    $name = !empty($_POST['name']) ? $_POST['name'] : '';
    $email = !empty($_POST['email']) ? $_POST['email'] : '';
    $mobile = (!empty($_POST['mobile'])) ? $_POST['mobile'] : '';
    $services = !empty($_POST['services']) ? $_POST['services'] : '';
    $servicesval = implode(', ', $services);
    $package = !empty($_POST['package']) ? $_POST['package'] : '';
    $message = !empty($_POST['message']) ? $_POST['message'] : '';

    if ($name != '' && $email != '' && $mobile != '' && $services != '' && $message != '') {

        $sql_ens = "INSERT INTO tbl_enquiry (en_name, en_email, en_mobile, services,package, en_comment, en_url, en_date, en_ip) 
                    VALUES ('$name', '$email', '$mobile', '$servicesval','$package', '$message', '$referer', '$enq_date', '$ip')";
        $qry = mysqli_query($GLOBALS['dbconn'], $sql_ens);
        
        $subject = utf8_encode(COMPANY . ' - ' . $admin_res['subject']);
        
        // HTML content for the email
        $htmlContent =  '<table border="0" width="100%">
            <tbody>
            <tr>
                <td colspan="2">
                    <strong>Dear Admin</strong>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    Enquiry Received with following info :
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td width="26%">
                    <strong>Post URL : </strong>
                </td>
                <td>
                    <span style="margin-top: 15px;">' . $referer . '</span>
                </td>
            </tr>
            <tr>
                <td width="26%">
                    <strong>Name : </strong>
                </td>
                <td>
                    <span style="margin-top: 15px;">' . $name . '</span>
                </td>
            </tr>
            <tr>
                <td width="26%">
                    <strong>Email Id : </strong>
                </td>
                <td>
                    <span style="margin-top: 15px;">' . $email . '</span>
                </td>
            </tr>
            <tr>
                <td width="26%">
                    <strong>Contact No : </strong>
                </td>
                <td>
                    <span style="margin-top: 15px;">' . $mobile . '</span>
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Services : </strong>
                </td>
                <td>
                    <span style="margin-top: 15px;">' . $servicesval . '</span>
                </td>
            </tr>

            <tr>
                <td>
                    <strong>Package Opted : </strong>
                </td>
                <td>
                    <span style="margin-top: 15px;">' . $package . '</span>
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Message : </strong>
                </td>
                <td>
                    <span style="margin-top: 15px;">' . $message . '</span>
                </td>
            </tr>
            </tbody>
        </table>';

         //user mail template
  
$htmlContentUser =  '<table border="0" width="100%">
<tbody>
    <tr>
        <td colspan="2">
            <strong>Dear ' . $name . ',</strong>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <p>Thank you for contacting Zapnix. We have received your inquiry and our team will get back to you soon.</p>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <p>If you have any questions or need immediate assistance, feel free to reply to this email.</p>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <strong>Best regards,</strong><br>
            <strong>Zapnix Team</strong><br>
            <span>Contact us: support@zapnix.co</span>
        </td>
    </tr>
</tbody>
</table>';

        $to = $admin_res['email'];
        $to2 = $admin_res['cc'];
        // Example recipient (You can replace it with actual recipients)
        $to3 = 'vishnu.kumaroot@gmail.com'; 

        // If email to admin exists
        if ($to != '') {
            smtp_mailer($to, $email, $name, $subject, $htmlContent);
        }
        if ($to2 != '') {
            smtp_mailer($to2, $email, $name, $subject, $htmlContent);
        }

        if($email!='')
        {
         smtp_mailer($email, $email, $name, $subject, $htmlContentUser);
        }

        // Send email
        smtp_mailer($to3, $email, $name, $subject, $htmlContent);

        $resp = [
            'message_response' => 'Thank you for your enquiry. Our team will contact you soon.',
            'status' => true
        ];
        echo json_encode($resp);
        exit;
    } else {
        $resp = [
            'message_response' => 'All fields are Mandatory!',
            'status' => false
        ];
        echo json_encode($resp);
        exit;
    }
}


?>

← Back to Directory Edit File 🔒 Chmod

WP File Manager