Вход Регистрация
Файл: core/modules/feedback.php
Строк: 176
<?php

if (!defined('CMS')) { die('Access Denied!'); }

if ( empty(
$config['email']) ) {

    
$inSes->addMessage('Сервис временно недоступен!');
    
gen_red('index', '', RND);
}

$dicq = 'none'; $dmail = 'block';

if (!empty(
$_POST['send'])) {

    
$name    = !empty($_POST['name'])    ? check($_POST['name'])      : '';
    
$mail    = !empty($_POST['mail'])    ? strtolower($_POST['mail']) : '';
    
$icq     = !empty($_POST['icq'])     ? check($_POST['icq'])       : '';
    
$subject = !empty($_POST['subject']) ? check($_POST['subject'])   : 'Письмо с сайта ' . $config['site_name'];
    
$message = !empty($_POST['message']) ? check($_POST['message'])   : '';
    
$type    = !empty($_POST['type'])    ? check($_POST['type'])      : '';
    
$code    = !empty($_POST['code'])    ? num($_POST['code'])        : '';
    
$error   = '';
    
$_SESSION['captcha_key'] = !empty($_SESSION['captcha_key']) ? $_SESSION['captcha_key'] : NULL;
    
$_SESSION['captcha_failures'] = !empty($_SESSION['captcha_failures']) ? (int) $_SESSION['captcha_failures'] : 0;
    
$_SESSION['crc32'] = !empty($_SESSION['crc32']) ? (int) $_SESSION['crc32'] : 0;

    
$len_name = cms_strlen($name);
    
$len_subj = cms_strlen($subject);
    
$len_mess = cms_strlen($message);

    if ( 
$_SESSION['captcha_key'] === NULL || $_SESSION['captcha_key'] != $code ) {

        if ( ++
$_SESSION['captcha_failures'] == 3 ) {

            
$error = 'Вы ввели несколько раз подряд неверный код с картинки. Сгенерирован новый код.';

            
$_SESSION['captcha_key'] = NULL;
            
$_SESSION['captcha_failures'] = 0;
        }
        else 
$error = 'Проверочное число не совпало с данными на картинке!';
    }
    else if (
$len_name < 3) {

        
$error = 'Слишком короткое имя, необходимо от 3 до 25 символов!';
    }
    else if (
$len_name > 25) {

        
$error = 'Слишком длинное имя, необходимо от 3 до 25 символов!';
    }
    else if (
$type <> 'icq' && $type <> 'mail') {

        
$error = 'Неверно указан &quot;Тип сообщения&quot;';
    }
    else if (empty(
$mail) && $type <> 'icq') {

        
$error = 'Вы не указали свой E-Mail адресс!';
    }
    else if (!
preg_match('#^([a-z0-9_-.])+@([a-z0-9_-.])+(.([a-z0-9])+)+$#', $mail) && $type <> 'icq') {

         
$error = 'Вы ввели неверный адрес e-mail, необходим формат name@mail.ru!';
    }
    else if ( 
function_exists('dns_get_mx') && !dns_get_mx(substr(strrchr($mail, '@'), 1), $mx) && $type <> 'icq' ) {

        
$error = 'Неверный E-Mail адрес! Почтовый сервер не найден!';
    }
    else if (empty(
$icq) && $type <> 'mail') {

        
$error = 'Вы не указали свой ICQ номер!';
    }
    else if ( !
is_numeric($icq)  && $type <> 'mail') {

        
$error = 'Неверный формат ICQ! Разрешены только цифры!';
    }
    else if (
$len_subj < 6) {

        
$error = 'Слишком короткое название темы, необходимо от 5 до 100 символов!';
    }
    else if (
$len_mess < 11) {

        
$error = 'Слишком короткое сообшение, необходимо от 10 до 5000 символов!';
    }
    else if (
$len_subj > 101) {

        
$error = 'Слишком длинное название темы, необходимо от 5 до 100 символов!';
    }
    else if (
$len_mess > 5000) {

        
$error = 'Слишком длинное или короткое сообшение, необходимо от 10 до 5000 символов!';
    }
    else if ( 
crc32($message.$type) == $_SESSION['crc32'] ) {

        
$error = 'Ваше сообщение <b>уже было успешно отправлено</b>!';
    }
    else 
$error = '';

    if (
$type == 'icq') { $dicq  = 'block'; $dmail = 'none'; }
    else { 
$dicq = 'none'; $dmail = 'block'; }

    if (!empty(
$error)) {

        
$inSes->addMessage('Ошибка! ' . $error);
    }
    else {

        if (
$type == 'mail') {

            
$message .= "Ip: " . get_ip() . "nБраузер: " . get_ua() . "nОтправлено: " . date('j.m.Y / H:i', time());

            if ( 
SendMail($config['email'], $subject, $message, $mail, $name, '') ) {

                
$_SESSION['crc32'] = crc32($message.$type);
                
$_SESSION['captcha_key'] = NULL;
                
$_SESSION['captcha_failures'] = 0;
                
$inSes->addMessage('Ваше сообщение успешно отправлено!', 'ok');
                
gen_red('admin');
            }
            else 
$inSes->addMessage('Произошла Ошибка! По тех. причинам в данный момент не удалось отправить сообщение. Попробуйте позже.');
        }
        else {

            include_once( 
ENGINE . '/classes/WebIcqPro.class.php' );

            
$send = new WebIcqPro();
            
$send->connect($config['icq_uin'], $config['icq_psd']) or die($send->error);

            
$msg  = $subject . "n" . $message . "n---n";
            
$msg .= "Имя: " . $name . "nICQ: " . $icq . "n";
            
$msg .= "Ip: " . get_ip() . "nБраузер: " . get_ua() . "nОтправлено: " . date('j.m.Y / H:i', time());
            
$msg  = iconv('UTF-8', 'cp1251', $msg);

            if (
$send->sendMessage($config['icq_uin'], $msg)) {

                
$_SESSION['crc32'] = crc32($message.$type);
                
$_SESSION['captcha_key'] = NULL;
                
$_SESSION['captcha_failures'] = 0;
                
$inSes->addMessage('Ваше сообщение успешно отправлено!', 'ok');
                
gen_red('index', '', RND);

            }
            else 
$inSes->addMessage('Произошла Ошибка! По тех. причинам в данный момент не удалось отправить сообщение. Попробуйте позже.');
        }
    }
}

show_header('Письмо администратору сайта ' . $config['site_name']);

echo 
'<div class="bl"><form action="/' . gen_uri('feedback', '', RND) . '" method="post" name="form">';
echo 
'<span class="blink">*</span> Ваше имя: <small>[max: ' . intval($config['max_author_comm']) . ']</small><br />';
echo 
'<input name="name" type="text" value="' . request('name') . '" /><br />';

if (!empty(
$config['icq_uin']) && !empty($config['icq_psd'])) {

    echo 
'<span class="blink">*</span> Тип сообщения:<br />';

    if (!empty(
$_REQUEST['type']) && $_REQUEST['type'] == 'icq') echo '<input type="radio" name="type" id="type"  value="icq" onchange="ShowType(this.value);" checked="checked" /> ICQ<br /><input type="radio" name="type" id="type" value="mail" onchange="ShowType(this.value);" /> E-Mail<br />';
else echo 
'<input type="radio" name="type" id="type"  value="icq" onchange="ShowType(this.value);" /> ICQ<br /><input type="radio" name="type" id="type" value="mail" onchange="ShowType(this.value);" checked="checked" /> E-Mail<br />';

    echo 
'<span style="display:' . $dmail . ';" id="dmail"><span class="blink">*</span> E-mail: <small>[max: 50]</small><br /><input name="mail" type="text" value="' . request('mail') . '" /><br /></span><span style="display:' . $dicq . ';" id="dicq"><span class="blink">*</span> ICQ: <small>[цифры 0-9]</small><br /><input name="icq" type="text" value="' . request('icq') . '" /><br /></span>';

}
else {

    echo 
'<span class="blink">*</span> E-mail: <small>[max: 50]</small><br />';
    echo 
'<input name="mail" type="text" value="' . request('mail') . '" /><br />';
}

echo 
'<span class="blink">*</span> Cообщение:<br />';
echo 
'<textarea name="message" cols="26" rows="5">' . request('message') . '</textarea><br />';
echo 
'<span class="blink">*</span> Код с картинки:<br />';
echo 
'<img name="captcha" src="' . $config['site_url'] . '/captcha.gif" class="ava" alt="Проверочный код" /> ';
echo 
'<a class="xxsmall" style="vertical-align:bottom;" href="#" onclick="document.captcha.src = document.captcha.src + '?' + (new Date()).getTime(); return false;">обновить</a><br />';
echo 
'<input type="text" id="code" name="code" size="4" maxlength="3" /><br />';
echo 
'<input name="send" type="submit" class="btns" value="Отправить" /></form><br />';
echo 
'<span class="blink">*</span> обязательны к заполнению.</div>';

echo <<<HTML

<script type="text/javascript">
function ShowType(value) {
    if (value == 'icq') {
        document.getElementById('dicq').style.display = '';
    } else {
        document.getElementById('dicq').style.display = 'none';
    }
    if (value == 'mail') {
        document.getElementById('dmail').style.display = '';
    } else {
        document.getElementById('dmail').style.display = 'none';
    }
}
</script>

HTML;

show_footer();

?>
Онлайн: 0
Реклама