403Webshell
Server IP : 141.193.213.10  /  Your IP : 216.73.216.101
Web Server : nginx
System : Linux pod-400555 6.8.0-1055-gke #61-Ubuntu SMP Tue May 26 22:57:42 UTC 2026 x86_64
User : fpm200079 ( 200079)
PHP Version : 8.2.36
Disable Function : apache_child_terminate,apache_get_modules,apache_get_version,apache_getenv,apache_note,apache_setenv,disk_free_space,disk_total_space,diskfreespace,dl,exec,fastcgi_finish_request,link,opcache_compile_file,opcache_get_configuration,opcache_invalidate,opcache_is_script_cached,opcache_reset,passthru,pclose,pcntl_exec,popen,posix_getpid,posix_getppid,posix_getpwuid,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,realpath_cache_get,shell_exec,show_source,symlink,system
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /nas/content/live/bartislaw/wp-content/plugins/speak-api/inc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /nas/content/live/bartislaw/wp-content/plugins/speak-api/inc/send-mail-cform.php
<?php

include_once 'config.php';
include_once 'SpeakApiCheck.php';
include_once 'gump.class.php';
include_once 'AntiSpamValidator.php';
/* ............................................................................ */

$isValid = GUMP::is_valid($_POST, array(
    'name' => 'required|valid_name',
    'email' => 'required|valid_email',
    'phone' => 'required',
    'i-need-help-with' => 'required',
    'How-Can-We-Help-You' => 'required',
));


// If form validation fails, return the errors
if ($isValid !== true) {
    wp_send_json(array(
        'result' => 'error',
        'msg' => $isValid
    ));
    exit;
}

// Only if form fields are valid, then check anti-spam
$anti_spam = new AntiSpamValidator();
$spam_validation = $anti_spam->validate_form($_POST, 'cform');
if (!$spam_validation['result'] == 'success') {
    wp_send_json($spam_validation);
    exit;
}

// Form fields are valid, proceed with processing
$phone = preg_replace("/[^0-9,.]/", "", $_POST['phone']);
    if (strlen($phone) == '10') {
        if (isHtml($_POST['How-Can-We-Help-You']) == TRUE) {
            $result = array(
                'result' => 'error',
                'msg' => array('Not include html characters in How-Can-We-Help-You')
            );
            wp_send_json($result);
            //echo json_encode($result);
        } elseif (checkurl($_POST['How-Can-We-Help-You']) == TRUE) {
            $result = array(
                'result' => 'error',
                'msg' => array('Not include url in How-Can-We-Help-You')
            );
            wp_send_json($result);
            //echo json_encode($result);
        } else {
            InsertData_cForm($_POST);
            
            $Get_Result = SendCurl_cForm($_POST);
            if ($Get_Result) {
                $result = array(
                    'result' => 'success',
                    'msg' => array('')
                );
                wp_send_json($result);
                // echo json_encode($result);
            } else {
                $result = array(
                    'result' => 'error',
                    'msg' => array('ApiKey Not Active')
                );
                wp_send_json($result);
                //echo json_encode($result);
            }
        }
    } else {
        $result = array(
            'result' => 'error',
            'msg' => array('Phone number must be 10 Digits')
        );
        wp_send_json($result);
        //echo json_encode($result);
    }


/* ............................................................................................... */

function isHtml($string) {
    preg_match("/<\/?\w+((\s+\w+(\s*=\s*(?:\".*?\"|'.*?'|[^'\">\s]+))?)+\s*|\s*)\/?>/", $string, $matches);
    if (count($matches) == 0) {
        return FALSE;
    } else {
        return TRUE;
    }
}

/* ............................................................................................... */

function checkurl($string_value) {
    $var = '/((?:https?\:\/\/|www\.)(?:[-a-z0-9]+\.)*[-a-z0-9]+.*)/i';
    $var1 = '/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/';
    $words = array('.com', '.org', '.in', '.pk', '.eu', '.net', '.my', '.edu', '.info', '.biz', '.pro', '.jobs', '.cc');
    $matches_words = 0;
    foreach ($words as $word) {
        if (strpos($string_value, $word) !== false) {
            $matches_words = 1;
        }
    }
    if ($matches_words == '1') {
        return TRUE;
    }
    preg_match($var1, $string_value, $matches);
    preg_match($var, $string_value, $matchess);
    if (count($matches) == 0 && count($matchess) == 0) {
        return FALSE;
    } else {
        return TRUE;
    }
}

/* ........................................................................................ */

function SendCurl_cForm($Data_Array) {

    $ApiKey = Get_ApiKey();
    $Array_Post['speak_api_key'] = $ApiKey;
    $Status_ApiKey = SpeakApiCheck::CheckAPIKey($Array_Post);
    $Check_ApiOptions = Get_ApiOptions();
    $Data_Api_Array = explode(',', $Check_ApiOptions);
    if ($Status_ApiKey) {
        $Url_Web = trim(get_bloginfo('url'));
        $lead_data2['name'] = $Data_Array['name'];
        $lead_data2['phone'] = $Data_Array['phone'];
        $lead_data2['email'] = $Data_Array['email'];
        $lead_data2['pa'] = $Data_Array['i-need-help-with'];
        $lead_data2['msg'] = $Data_Array['How-Can-We-Help-You'];
        $lead_data2['type'] = 'CF';
        $lead_data2['url'] = $Url_Web;
        $lead_data2['api_key'] = Get_ApiKey();
        $lead_data2['ip'] = getClientIP();
        $lead_data2['admin_name'] = get_bloginfo('name');

        $curl_options = array(
            CURLOPT_URL => "http://api.speakeasymarketinginc.com/send-data-speak-api",
            CURLOPT_POST => true,
            CURLOPT_POSTFIELDS =>
            http_build_query($lead_data2),
            CURLOPT_HTTP_VERSION => 1.0,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HEADER => false,
            CURLOPT_CONNECTTIMEOUT => 120,
            CURLOPT_TIMEOUT => 120,
            CURLOPT_MAXREDIRS => 10
        );
        $curl = curl_init();
        curl_setopt_array($curl, $curl_options);
        $result = curl_exec($curl);
        $http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        curl_close($curl);
        if ($result == 'yes') {
            return TRUE;
        } else {
            return FALSE;
        }
    } else {
        return send_by_mailer($Data_Array);
    }
}

/* ........................................................................................ */

function InsertData_cForm($Data_Array) {
    global $wpdb;
    $table_name = $wpdb->prefix . "speak_api_leads";
    $wpdb->insert(
            $table_name, array(
        'speak_api_leads_name' => $Data_Array['name'],
        'speak_api_leads_phone' => $Data_Array['phone'],
        'speak_api_leads_email' => $Data_Array['email'],
        'speak_api_leads_msg' => $Data_Array['How-Can-We-Help-You'],
        'speak_api_leads_type' => 'CF',
        'speak_api_lead_time' => mysqlNow()
            )
    );
}

/* ................Get Curent Date.................... */

function mysqlNow() {
    return date('Y:m:d H:i:s');
}

function send_by_mailer($Data_Array) {
    include_once('PHPMailer/PHPMailerAutoload.php');
    $site_url = substr(get_bloginfo('url'), 7);
    $Get_Email_Data = get_option("SpeakApiCBAlerts");
    $reply_to = $Data_Array['email'];
    $subject = str_replace('[site_url]', $site_url, $Get_Email_Data['c_email_sub']);

    $body = $Get_Email_Data['c_email_temp'];
    $body = @str_replace("[site_url]", $site_url, $body);
    $body = @str_replace("[name]", $Data_Array['name'], $body);
    $body = @str_replace("[phone]", $Data_Array['phone'], $body);
    $body = @str_replace("[email]", $Data_Array['email'], $body);
    $body = @str_replace("[pa]", $Data_Array['i-need-help-with'], $body);
    $body = @str_replace("[msg]", $Data_Array['How-Can-We-Help-You'], $body);
    // Submit Mail
    $mail = new PHPMailer;
    //$mail->SMTPDebug = 0;
    $mail->AddReplyTo($reply_to);
    $Email_array = $Get_Email_Data['c_email_address'];
    $email_array = explode(',', $Email_array);
    for ($i = 0; $i < sizeof($email_array); $i++) {
        $mail->addAddress($email_array[$i]);
    }
    $mail->SetFrom($Get_Email_Data['ex_email_from'], $site_url);
    $mail->Subject = $subject;
    $mail->isHTML(true);
    $mail->Body = $body;
    if ($mail->send()) {
        return TRUE;
    } else {
        return FALSE;
    }
}

function getClientIP()
{

    if (isset($_SERVER)) {

        if (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
            return $_SERVER["HTTP_X_FORWARDED_FOR"];

        if (isset($_SERVER["HTTP_CLIENT_IP"]))
            return $_SERVER["HTTP_CLIENT_IP"];

        return $_SERVER["REMOTE_ADDR"];
    }

    if (getenv('HTTP_X_FORWARDED_FOR'))
        return getenv('HTTP_X_FORWARDED_FOR');

    if (getenv('HTTP_CLIENT_IP'))
        return getenv('HTTP_CLIENT_IP');

    return getenv('REMOTE_ADDR');
}


Youez - 2016 - github.com/yon3zu
LinuXploit