Файл: user/settings.php
Строк: 98
<?php
require_once '../sys/inc/start.php';
require_once '../sys/inc/compress.php';
require_once '../sys/inc/sess.php';
require_once '../sys/inc/settings.php';
require_once '../sys/inc/db_connect.php';
require_once '../sys/inc/ipua.php';
require_once '../sys/inc/fnc.php';
require_once '../sys/inc/user.php';
user::only_reg();
$set['title'] = 'Общие настройки';
require_once '../sys/inc/thead.php';
if (isset($_POST['save'])) {
if (isset($_POST['add_konts']) && ($_POST['add_konts'] == 2 || $_POST['add_konts'] == 1 || $_POST['add_konts'] == 0)) {
$user['add_konts'] = intval($_POST['add_konts']);
mysql_query("UPDATE `user` SET `add_konts` = '$user[add_konts]' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err = 'Ошибка режима добавления контактов';
}
$user['set_files'] = (isset($_POST['set_files']) && $_POST['set_files']) ? '1' : '0';
mysql_query("UPDATE `user` SET `set_files` = '" . mysql_real_escape_string($user['set_files']) . "' WHERE `id` = '$user[id]' LIMIT 1");
$user['show_url'] = (isset($_POST['show_url']) && $_POST['show_url']) ? '1' : '0';
mysql_query("UPDATE `user` SET `show_url` = '" . mysql_real_escape_string($user['show_url']) . "' WHERE `id` = '$user[id]' LIMIT 1");
$user['set_news_to_mail'] = (isset($_POST['set_news_to_mail']) && $_POST['set_news_to_mail']) ? '1' : '0';
mysql_query("UPDATE `user` SET `set_news_to_mail` = '0' WHERE `id` = '$user[id]' LIMIT 1");
if (isset($_POST['set_p_str']) && is_numeric($_POST['set_p_str']) && $_POST['set_p_str'] > 0 && $_POST['set_p_str'] <= 100) {
$user['set_p_str'] = intval($_POST['set_p_str']);
$set['p_str'] = $user['set_p_str'];
mysql_query("UPDATE `user` SET `set_p_str` = '$user[set_p_str]' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err[] = 'Неправильное количество пунктов на страницу';
}
if (!isset($err)) {
msg('Изменения успешно приняты');
header("Location: settings.php?" . SID);
exit;
}
}
title();
err();
aut();
echo "<form name = 'settings' class = 'razd' action = '?$passgen' method = 'POST'>";
echo "Пунктов на страницу:<br />";
echo "<input type = 'text' aria-invalid = 'false' class = 'invalid input-medium' name = 'set_p_str' value = '$set[p_str]' maxlength = '3' /><br />";
echo "<div class = 'hr'></div>";
echo "Добавление контактов:<br />";
echo "<select name='add_konts'>n";
echo "<option value='2'" . ($user['add_konts'] == 2 ? " selected='selected'" : null) . ">При чтении сообщений</option>n";
echo "<option value='1'" . ($user['add_konts'] == 1 ? " selected='selected'" : null) . ">При написании сообщения</option>n";
echo "<option value='0'" . ($user['add_konts'] == 0 ? " selected='selected'" : null) . ">Только вручную</option>n";
echo "</select><br />n";
echo "<label><input type = 'checkbox'" . ($user['set_files'] ? " checked = 'checked'" : null) . " name = 'set_files' value = '1' />Выгрузка файлов</label><br/>";
echo "<label><input type = 'checkbox'" . ($user['show_url'] ? " checked = 'checked'" : null) . " name = 'show_url' value = '1' />Местоположение</label><br/>";
if ($user['ank_mail']) {
echo "<label><input type = 'checkbox' name = 'set_news_to_mail' " . ($user['set_news_to_mail'] ? " checked = 'checked'" : null) . " value = '1' />Получать новости на E-mail</label><br/>";
}
echo "<button name = 'save' class = 'action'>";
echo "<span class = 'label'><span class = 'icon icon67' /> Сохранить</span>";
echo "</button></form>";
if (isset($_SESSION['refer']) && $_SESSION['refer'] != NULL && otkuda($_SESSION['refer'])) {
echo "<div class = 'razd'>" . img('left.png') . " <a href = '$_SESSION[refer]'>" . otkuda($_SESSION['refer']) . "</a></div>";
}
echo "<div class = 'razd'>" . img('left.png') . " <a href = '/umenu.php'>Кабинет</a></div>";
require_once '../sys/inc/tfoot.php';