View file vobog-wmzo_ru/support/add.php

File size: 1.91Kb
<?php
require_once '../system/core.php';
auth();

if (isset($_POST['send'])) {
    $subj = trim($_POST['subject']);
    $msg = trim($_POST['message']);

    if (mb_strlen($subj) < 3 || mb_strlen($msg) < 5) {
        set_msg('Слишком короткая тема или сообщение', 'error');
    } else {
        db_query("INSERT INTO `support_tickets` (`user_id`, `subject`, `message`, `time_create`) VALUES (?, ?, ?, ?)", 
                 [$myID, $subj, $msg, time()]);
        set_msg('Обращение успешно создано!');
        header('Location: index.php');
        exit;
    }
}

$title = 'Новое обращение';
require_once '../system/thead.php';
show_msg();
?>

<div class="head-new"><div class="b-new">НОВЫЙ ТИКЕТ</div></div>
<div class="msg-new">
    <form method="post" style="padding:10px;">
        <div style="color:#9bc2e0; font-size:12px; margin-bottom:5px;">Тема обращения:</div>
        <input type="text" name="subject" required style="width:96%; background:#111; border:1px solid #183543; color:#fff; padding:8px; margin-bottom:15px; border-radius:3px;">
        
        <div style="color:#9bc2e0; font-size:12px; margin-bottom:5px;">Суть проблемы:</div>
        <textarea name="message" required style="width:96%; height:120px; background:#111; border:1px solid #183543; color:#fff; padding:8px; border-radius:3px;"></textarea>
        
        <div style="text-align:center; margin-top:15px;">
            <button type="submit" name="send" class="bbtn-new" style="border:none; cursor:pointer; width:200px;">
                <span class="lbl-new" style="color:#08aa00; padding:8px 0;">ОТПРАВИТЬ</span>
            </button>
            <br><br>
            <a href="index.php" style="color:#666; font-size:12px; text-decoration:none;">Назад в список</a>
        </div>
    </form>
</div>

<?php require_once '../system/tfoot.php'; ?>