Вход Регистрация
Файл: adm_panel/reg_msg.php
Строк: 179
<?

include_once '../sys/inc/start.php';
include_once 
'../sys/inc/compress.php';
include_once 
'../sys/inc/sess.php';
include_once 
'../sys/inc/home.php';
include_once 
'../sys/inc/settings.php';
include_once 
'../sys/inc/db_connect.php';
include_once 
'../sys/inc/ipua.php';
include_once 
'../sys/inc/fnc.php';
include_once 
'../sys/inc/adm_check.php';
include_once 
'../sys/inc/user.php';
user_access('adm_set_sys',null,'index.php?'.SID);
adm_check();
if(isset(
$_GET['present'])){
$set['title']='Настройки приветствия при регистрации';
include_once 
'../sys/inc/thead.php';
title();
aut();

if (isset(
$_GET['gift']) && isset($_GET['category'])){
//Категория
$category mysql_fetch_assoc(mysql_query("SELECT * FROM `gift_categories` WHERE `id` = '" intval($_GET['category']) . "' LIMIT 1"));
//Подарок
$gift mysql_fetch_assoc(mysql_query("SELECT * FROM `gift_list` WHERE `id` = '" intval($_GET['gift']) . "' LIMIT 1"));
if (!
$gift){  
$_SESSION['message'] = 'Нет такого подарка';
header("Location: reg_msg.php?present");
exit;
}

if (isset(
$_GET['ok']) ){
$gift_msg my_esc($_POST['msg']);
if(
strlen2($gift_msg)>50)$err='Не больше 50 сиволов ';   
if(!isset(
$err)){     
mysql_query("UPDATE `reg_msg` SET `gift` = '$gift[id]',`gift_msg`='$gift_msg' ");
$_SESSION['message'] = 'Изменения приняты';
header("Location: reg_msg.php");
exit;

}

err();

echo 
'<div class="block">';
echo 
'<form action="reg_msg.php?present&amp;category=' $category['id'] . '&amp;gift=' $gift['id'] . '&amp;ok" method="post">';
echo 
'Вы выбрали этот подарок при регистрации</br>';
echo 
'<img width="80" src="/style/gift/' $gift['id'] . '.png">';
echo 
'</div>';
echo 
'<div class="block2">';
echo 
'<textarea class="input2" placeholder="Комментарий к подарку" type="text" name="msg" value=""/></textarea>';
echo 
'<input class="button" type="submit" value="Сохранить">';
echo 
'</form>';
echo 
'</div>';

echo 
'<a class="link3" href="reg_msg.php?present&amp;category=' $category['id'] . '"><span class="icon"><i class="fas fa-angle-left"></i></span> Назад</a>';   
   
}

else
   
//Вывод подарков
if (isset($_GET['category'])){
//Категория
$category mysql_fetch_assoc(mysql_query("SELECT * FROM `gift_categories` WHERE `id` = '" intval($_GET['category']) . "' LIMIT 1"));

if (!
$category) {  
$_SESSION['message'] = 'Нет такой категории';
header("Location: reg_msg.php?present");
exit;
}
   
//Список подарков
$k_post mysql_result(mysql_query("SELECT COUNT(id) FROM `gift_list` WHERE `id_category` = '$category[id]'"),0);
if (
$k_post == 0){
echo 
'<div class="block">Нет подарков</div>';
}

$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q mysql_query("SELECT name,id,money FROM `gift_list` WHERE `id_category` = '$category[id]' ORDER BY `id` LIMIT $start$set[p_str]");

while (
$post mysql_fetch_assoc($q)){
echo 
'<a class="link" href="reg_msg.php?present&amp;category=' $category['id'] . '&amp;gift=' $post['id'] . '"><img width="80" src="/style/gift/' $post['id'] . '.png"></a>';
}

//Вывод страниц
if ($k_page>1)str('reg_msg.php?present=&amp;category=' intval($_GET['category']) . '&amp;',$k_page,$page); 

echo 
'<a class="link" href="reg_msg.php?present"><span class="icon"><i class="fas fa-angle-left"></i></span> Назад</a>';   

}

else
//Вывод категорий
{

$k_post mysql_result(mysql_query("SELECT COUNT(id) FROM `gift_categories`"),0);
if (
$k_post == 0){
echo 
'<div class="menu">';
}

$q mysql_query("SELECT name,id FROM `gift_categories` ORDER BY `id`");

while (
$post mysql_fetch_assoc($q)){
echo 
'<a class="link" href="reg_msg.php?present&amp;category=' $post['id'] . '"><span class="icon"><i class="fas fa-gift"></i></span> ' htmlspecialchars($post['name']) . ' <span class="c">' mysql_result(mysql_query("SELECT COUNT(id) FROM `gift_list` WHERE `id_category` = '$post[id]'"),0) . '</span></a>';
}

echo 
'<a class="link" href="reg_msg.php"><span class="icon"><i class="fas fa-angle-left"></i></span> Настройки приветствия</a>';
}

include_once 
'../sys/inc/tfoot.php';
}

$set['title']='Настройки приветствия при регистрации';
include_once 
'../sys/inc/thead.php';
title();
aut();

if(isset(
$_POST['komm'])){
$gift_msg=my_esc($_POST['gift_msg']);
if(
strlen2($gift_msg)>50)$err='Не больше 50 сиволов ';
if(!isset(
$err)){
mysql_query("UPDATE `reg_msg` SET `gift_msg` = '$gift_msg'");
$_SESSION['message'] = 'Изменения приняты';
header("Location: reg_msg.php");
exit;
}
}  

if(isset(
$_POST['save'])){
$id=abs(intval($_POST['id']));
$msg=my_esc($_POST['msg']);
$money=abs(intval($_POST['money']));
$rating=abs(intval($_POST['rating']));
$on=intval($_POST['on']);
$true=intval($_POST['gift']);

if(
strlen2($msg)<1)$err='Не менее 1 сивола ';
if(
strlen2($msg)>2000)$err='Не больще 2000 сиволов ';
if(!isset(
$err)){
mysql_query("UPDATE `reg_msg` SET `msg` = '$msg',`money`='$money',`rating`='$rating',`on`='$on',`id`='$id',`true`='$true' ");
$_SESSION['message'] = 'Изменения приняты';
header("Location: reg_msg.php");
exit;
}
}

err();
$msg_text mysql_fetch_array(mysql_query("SELECT * FROM `reg_msg`  LIMIT 1"));

echo 
'<div class="block">';
echo 
'<form method="post" action="?">';
echo 
'От кого приветствие (id):</br>
<input class="input" name="id" maxlength="5" value="'
.intval($msg_text['id']).'" type="text">
Введите текст приветствия:</br>
<textarea class="input2" name="msg">'
.esc(stripcslashes(htmlspecialchars($msg_text['msg']))).'</textarea>
- {NICK}- Выводит ник пользователя</br>
Монеты:</br>
<input class="input" name="money" maxlength="5" value="'
.intval($msg_text['money']).'" type="text">
Рейтинг:</br>
<input class="input" name="rating" maxlength="3" value="'
.intval($msg_text['rating']).'" type="text">';
echo 
'</div>';

err();
echo 
'<div class="msg">Вы выбрали этот подарок при регистрации</div>';
echo 
'<div class="block2"><a href="reg_msg.php?present"><img width="80" src="/style/gift/' $msg_text['gift'] . '.png"></a></div>';
 
echo 
'<div class="block2">';
if(isset(
$_GET['msg'])){  
echo 
'<form method="post" action="?">';
echo 
'<textarea class="input2" name="gift_msg">'.htmlspecialchars($msg_text['gift_msg']).'</textarea>';
echo 
'<input class="button" type="submit" name="komm" value="Изменить">';
echo 
'</form>';
}else{
echo 
'Комментарий:</br><a href="reg_msg.php?msg">'.($msg_text["gift_msg"]==NULL'Нет комментария':''.output_text($msg_text["gift_msg"]).'').'</a>'
}
echo 
'</div>'

echo 
'<div class="block2">Управление модулем</div>';
echo 
'<div class="block2">';
echo 
'<input name="on" type="radio" '.($msg_text['on']==1?' checked="checked"':null).' value="1"> Включить</br>';
echo 
'<input name="on" type="radio" '.($msg_text['on']==0?' checked="checked"':null).' value="0"> Отключить</br>';
if (
$msg_text['true']=='1')
echo 
'<label><input type="checkbox" name="gift" checked="checked" value="1"> Подарок (<font color="green">вкл.</font>)</label></br>';
if (
$msg_text['true']=='0')
echo 
'<label><input type="checkbox" name="gift"  value="1"> Подарок (<font color="red">выкл.</font>)</label></br>';
echo 
'<input class="button" type="submit" name="save" value="Изменить">';
echo 
'</form>';
echo 
'</div>';

if (
user_access('adm_panel_show')){
echo 
'<a class="link3" href="/adm_panel/"><i class="material-icons icon">keyboard_arrow_left</i> Админ панель</a>';
}

include_once 
'../sys/inc/tfoot.php';

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