Файл: user/settings.php
Строк: 1228
<?php
/* DCMS Special
* Дата последнего редактирования 13.12.2015
* Модифицировал densnet
*/
foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'user', 'shif') as $inc) {
require_once "../sys/inc/{$inc}.php";
}
only_reg();
$set['title'] = 'Общие';
require_once H . 'sys/inc/thead.php';
aut();
err();
#Навигация
echo "<nav class='navbar navbar-light' style='background-color: #607D8B; color: #fff;'>";
echo "<ul class='nav navbar-nav'>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link' href='/'><i class='material-icons'>home</i></a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link'><i class='material-icons'>keyboard_arrow_right</i></a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link' href='/?umenu'>Кабинет</a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link'><i class='material-icons'>keyboard_arrow_right</i></a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link'>Настройки</a></li>";
echo "</ul>";
echo "</nav>";
$razdel = (isset($_GET['act'])) ? htmlspecialchars($_GET['act']) : null;
switch ($razdel) {
##################################################ПРИВАТНОСТЬ###############################################
case 'private':
?>
<div class='card'>
<div class="card-header">Настройки</div>
<div class="card-block">
<ul class="nav nav-tabs">
<li class="nav-item"><a class="nav-link" href="#all" role="tab" data-toggle="tab">Общие</a></li>
<li class="nav-item"><a class="nav-link" href="#them" role="tab" data-toggle="tab">Вид</a></li>
<li class="nav-item"><a class="nav-link" href="#time" role="tab" data-toggle="tab">Время</a></li>
<li class="nav-item"><a class="nav-link active" href="#private" role="tab" data-toggle="tab">Приватность</a></li>
<li class="nav-item"><a class="nav-link" href="#password" role="tab" data-toggle="tab">Пароль</a></li>
</ul>
<?php
echo "<div class='tab-content'>";
#ОБЩИЕ
echo "<div role='tabpanel' class='tab-pane' id='all'>";
echo "<form name='settings' action='settings.php?' method='POST'><br />";
echo "<label class='c-input c-checkbox'><input name='set_files' value='1' type='checkbox' " . ($user['set_files'] ? " checked='checked'" : null) . "><span class='c-indicator'></span> <span data-toggle='tooltip' data-placement='right' title='Нажмите, чтобы влючить или отключить форму загрузки файла'>Выгрузка файлов</span></label><br />";
echo "<label class='c-input c-checkbox'><input name='set_news_to_mail' value='1' type='checkbox' " . ($user['set_news_to_mail'] ? " checked='checked'" : null) . "><span class='c-indicator'></span> <span data-toggle='tooltip' data-placement='bottom' title='Нажмите, чтобы влючить или отключить подписку на новости, которые будут приссылаться на E-mail.'>Присылать новости</span></label><br />";
echo "<button name='all' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
#ВИД
echo "<div role='tabpanel' class='tab-pane' id='them'>";
echo "<form name='settings' action='settings.php?act=them' method='POST'>";
echo "<div class='row'>";
echo "<div class='input-field col s6'>";
echo "<input id='set_p_str' name='set_p_str' length='3' type='text' value='$set[p_str]' class='validate'>";
echo "<label for='set_p_str'>Пунктов на страницу</label>";
echo "</div>";
echo "</div>";
echo "<button name='them' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
#ВРЕМЯ
echo "<div role='tabpanel' class='tab-pane' id='time'>";
echo "<form name='settings' action='settings.php?act=time' method='POST'>";
echo "Время<br/>";
echo "<select class='form-control' name='set_timesdvig' style='width: 30%;'><br/>";
for ($i = - 12; $i < 12; $i++) {
echo "<option value = '$i'" . ($user['set_timesdvig'] == $i ? " selected = 'selected'" : null) . ">" . date("G:i", $time + $i * 60 * 60) . "</option>n";
}
echo "</select>";
echo "<br />";
echo "<label class='c-input c-checkbox'><input name='set_times' value='1' type='checkbox' " . ($user['set_times'] ? " checked='checked'" : null) . "><span class='c-indicator'></span> <span data-toggle='tooltip' data-placement='right' title='Нажмите, чтобы влючить или отключить время'>Время в заголовке</span></label><br />";
echo "<button name='time' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
#ПРИВАТНОСТЬ
echo "<div role='tabpanel' class='tab-pane active' id='private'>";
$set = (isset($_GET['set'])) ? htmlspecialchars($_GET['set']) : null;
switch ($set) {
default:
if (!isset($user)) {
err('Доступ закрыт гостям');
} else {
echo "<ul class='nav nav-pills'>";
echo "<li class='nav-item'><a class='nav-link active'>Профиль</a></li>";
echo "<li class='nav-item'><a class='nav-link' href='settings.php?act=private&set=anketa'>Анкета</a></li>";
echo "</ul>";
if (isset($_POST['profile'])) {
if (in_array($_POST['access'], array('all', 'only_me', 'friends', 'pass'))) {
$access = $_POST['access'];
} else {
$access = 'all';
}
if ($access == 'pass') {
if (utf8_strlen($_POST['passwd']) < 1) {
$err[] = 'Введите пароль.';
}
if (utf8_strlen($_POST['passwd']) > 16) {
$err[] = 'Пароль слишком длинный.';
}
$password = $_POST['passwd'];
} else {
$password = NULL;
}
if (!isset($err)) {
mysql_query("UPDATE `user` SET `profile_access` = '$access', `profile_password` = '" . mysql_real_escape_string($password) . "' WHERE `id` = '$user[id]'");
msg('Изменения успешно приняты');
}
}
if (!isset($user)) {
err('Доступ закрыт гостям');
} else {
echo "<form action='settings.php?act=private' method='POST'>";
echo "<b>Кому доступен мой профиль?</b><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'all' ? " checked='checked'" : null) . " id='all' value='all' /><label for='all'><i class='material-icons'>public</i> Всем</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'only_me' ? " checked='checked'" : null) . " id='only_me' value='only_me' /><label for='only_me'><i class='material-icons'>lock</i> Только мне</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'friends' ? " checked='checked'" : null) . " id='friends' value='friends' /><label for='friends'><i class='material-icons'>group</i> Только друзьям</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'pass' ? " checked='checked'" : null) . " id='pass' value='pass' /><label for='pass'><i class='material-icons'>vpn_key</i> Только по паролю</label><br />";
echo "<div class='row'>";
echo "<div class='input-field col s12'>";
echo "<input id='passwd' name='passwd' length='16' type='text' value='" . htmlspecialchars($user['profile_password']) . "' class='validate'>";
echo "<label for='passwd'>Пароль</label>";
echo "</div>";
echo "</div>";
echo "<button name='profile' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
}
}
break;
case 'anketa':
echo "<ul class='nav nav-pills'>";
echo "<li class='nav-item'><a class='nav-link' href='settings.php?act=private'>Профиль</a></li>";
echo "<li class='nav-item'><a class='nav-link active'>Анкета</a></li>";
echo "</ul>";
if (isset($_POST['anketa'])) {
if (in_array($_POST['access'], array('all', 'only_me', 'friends', 'pass'))) {
$access = $_POST['access'];
} else {
$access = 'all';
}
if ($access == 'pass') {
if (utf8_strlen($_POST['passwd']) < 1) {
$err[] = 'Введите пароль.';
}
if (utf8_strlen($_POST['passwd']) > 16) {
$err[] = 'Пароль слишком длинный.';
}
$password = $_POST['passwd'];
} else {
$password = NULL;
}
if (!isset($err)) {
mysql_query("UPDATE `user` SET `anketa_access` = '$access', `anketa_password` = '" . mysql_real_escape_string($password) . "' WHERE `id` = '$user[id]'");
msg('Изменения успешно приняты');
}
}
if (!isset($user)) {
err('Доступ закрыт гостям');
} else {
echo "<form action='settings.php?act=private&set=anketa' method='POST'>";
echo "<b>Кому доступна моя анкета?</b><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'all' ? " checked='checked'" : null) . " id='all' value='all' /><label for='all'><i class='material-icons'>public</i> Всем</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'only_me' ? " checked='checked'" : null) . " id='only_me' value='only_me' /><label for='only_me'><i class='material-icons'>lock</i> Только мне</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'friends' ? " checked='checked'" : null) . " id='friends' value='friends' /><label for='friends'><i class='material-icons'>group</i> Только друзьям</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'pass' ? " checked='checked'" : null) . " id='pass' value='pass' /><label for='pass'><i class='material-icons'>vpn_key</i> Только по паролю</label><br />";
echo "<div class='row'>";
echo "<div class='input-field col s12'>";
echo "<input id='passwd' name='passwd' length='16' type='text' value='" . htmlspecialchars($user['anketa_password']) . "' class='validate'>";
echo "<label for='passwd'>Пароль</label>";
echo "</div>";
echo "</div>";
echo "<button name='anketa' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
}
break;
}
echo "</div>";
#ПАРОЛЬ
echo "<div role='tabpanel' class='tab-pane' id='password'>";
echo "<form method='POST' action='settings.php?act=password'>";
echo '<br />';
echo "<input placeholder='Старый пароль' style='width: 50%;' class='form-control' type='text' name='pass' value='' />";
echo "<input placeholder='Новый пароль' style='width: 50%;' class='form-control' type='password' name='pass1' value='' />";
echo "<input placeholder='Подтверждение' style='width: 50%;' class='form-control' type='password' name='pass2' value='' />";
echo "<button class='waves-effect waves-light btn' name='save'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
echo "</div>";
?>
</div>
</div>
<?php
break;
##################################################ВРЕМЯ#####################################################
case 'time':
if (isset($_POST['time'])) {
$user['set_times'] = (isset($_POST['set_times']) && $_POST['set_times']) ? '1' : '0';
mysql_query("UPDATE `user` SET `set_times` = '" . mysql_real_escape_string($user['set_times']) . "' WHERE `id` = '$user[id]' LIMIT 1");
if (isset($_POST['set_timesdvig']) && (is_numeric($_POST['set_timesdvig']) && $_POST['set_timesdvig'] >= -12 && $_POST['set_timesdvig'] <= 12)) {
$user['set_timesdvig'] = intval($_POST['set_timesdvig']);
mysql_query("UPDATE `user` SET `set_timesdvig` = '$user[set_timesdvig]' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err[] = 'Ошибка временной зоны';
}
if (!isset($err)) {
msg('Изменения успешно приняты');
}
}
?>
<div class='card'>
<div class="card-header">Настройки</div>
<div class="card-block">
<ul class="nav nav-tabs">
<li class="nav-item"><a class="nav-link" href="#all" role="tab" data-toggle="tab">Общие</a></li>
<li class="nav-item"><a class="nav-link" href="#them" role="tab" data-toggle="tab">Вид</a></li>
<li class="nav-item"><a class="nav-link active" href="#time" role="tab" data-toggle="tab">Время</a></li>
<li class="nav-item"><a class="nav-link" href="#private" role="tab" data-toggle="tab">Приватность</a></li>
<li class="nav-item"><a class="nav-link" href="#password" role="tab" data-toggle="tab">Пароль</a></li>
</ul>
<?php
echo "<div class='tab-content'>";
#ОБЩИЕ
echo "<div role='tabpanel' class='tab-pane' id='all'>";
echo "<form name='settings' action='settings.php?' method='POST'><br />";
echo "<label class='c-input c-checkbox'><input name='set_files' value='1' type='checkbox' " . ($user['set_files'] ? " checked='checked'" : null) . "><span class='c-indicator'></span> <span data-toggle='tooltip' data-placement='right' title='Нажмите, чтобы влючить или отключить форму загрузки файла'>Выгрузка файлов</span></label><br />";
echo "<label class='c-input c-checkbox'><input name='set_news_to_mail' value='1' type='checkbox' " . ($user['set_news_to_mail'] ? " checked='checked'" : null) . "><span class='c-indicator'></span> <span data-toggle='tooltip' data-placement='bottom' title='Нажмите, чтобы влючить или отключить подписку на новости, которые будут приссылаться на E-mail.'>Присылать новости</span></label><br />";
echo "<button name='all' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
#ВИД
echo "<div role='tabpanel' class='tab-pane' id='them'>";
echo "<form name='settings' action='settings.php?act=them' method='POST'>";
echo "<div class='row'>";
echo "<div class='input-field col s6'>";
echo "<input id='set_p_str' name='set_p_str' length='3' type='text' value='$set[p_str]' class='validate'>";
echo "<label for='set_p_str'>Пунктов на страницу</label>";
echo "</div>";
echo "</div>";
echo "<button name='them' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
#ВРЕМЯ
echo "<div role='tabpanel' class='tab-pane active' id='time'>";
echo "<form name='settings' action='settings.php?act=time' method='POST'>";
echo "Время<br/>";
echo "<select class='form-control' name='set_timesdvig' style='width: 30%;'><br />";
for ($i = - 12; $i < 12; $i++) {
echo "<option value = '$i'" . ($user['set_timesdvig'] == $i ? " selected = 'selected'" : null) . ">" . date("G:i", $time + $i * 60 * 60) . "</option>n";
}
echo "</select>";
echo "<br />";
echo "<label class='c-input c-checkbox'><input name='set_times' value='1' type='checkbox' " . ($user['set_times'] ? " checked='checked'" : null) . "><span class='c-indicator'></span> <span data-toggle='tooltip' data-placement='right' title='Нажмите, чтобы влючить или отключить время'>Время в заголовке</span></label><br />";
echo "<button name='time' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
echo "<div role='tabpanel' class='tab-pane' id='private'>";
$set = (isset($_GET['set'])) ? htmlspecialchars($_GET['set']) : null;
switch ($set) {
default:
if (!isset($user)) {
err('Доступ закрыт гостям');
} else {
echo "<ul class='nav nav-pills'>";
echo "<li class='nav-item'><a class='nav-link active'>Профиль</a></li>";
echo "<li class='nav-item'><a class='nav-link' href='settings.php?act=private&set=anketa'>Анкета</a></li>";
echo "</ul>";
if (isset($_POST['profile'])) {
if (in_array($_POST['access'], array('all', 'only_me', 'friends', 'pass'))) {
$access = $_POST['access'];
} else {
$access = 'all';
}
if ($access == 'pass') {
if (utf8_strlen($_POST['passwd']) < 1) {
$err[] = 'Введите пароль.';
}
if (utf8_strlen($_POST['passwd']) > 16) {
$err[] = 'Пароль слишком длинный.';
}
$password = $_POST['passwd'];
} else {
$password = NULL;
}
if (!isset($err)) {
mysql_query("UPDATE `user` SET `profile_access` = '$access', `profile_password` = '" . mysql_real_escape_string($password) . "' WHERE `id` = '$user[id]'");
msg('Изменения успешно приняты');
}
}
if (!isset($user)) {
err('Доступ закрыт гостям');
} else {
echo "<form action='settings.php?act=private' method='POST'>";
echo "<b>Кому доступен мой профиль?</b><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'all' ? " checked='checked'" : null) . " id='all' value='all' /><label for='all'><i class='material-icons'>public</i> Всем</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'only_me' ? " checked='checked'" : null) . " id='only_me' value='only_me' /><label for='only_me'><i class='material-icons'>lock</i> Только мне</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'friends' ? " checked='checked'" : null) . " id='friends' value='friends' /><label for='friends'><i class='material-icons'>group</i> Только друзьям</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'pass' ? " checked='checked'" : null) . " id='pass' value='pass' /><label for='pass'><i class='material-icons'>vpn_key</i> Только по паролю</label><br />";
echo "<div class='row'>";
echo "<div class='input-field col s12'>";
echo "<input id='passwd' name='passwd' length='16' type='text' value='" . htmlspecialchars($user['profile_password']) . "' class='validate'>";
echo "<label for='passwd'>Пароль</label>";
echo "</div>";
echo "</div>";
echo "<button name='profile' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
}
}
break;
case 'anketa':
echo "<ul class='nav nav-pills'>";
echo "<li class='nav-item'><a class='nav-link' href='settings.php?act=private'>Профиль</a></li>";
echo "<li class='nav-item'><a class='nav-link active'>Анкета</a></li>";
echo "</ul>";
if (isset($_POST['anketa'])) {
if (in_array($_POST['access'], array('all', 'only_me', 'friends', 'pass'))) {
$access = $_POST['access'];
} else {
$access = 'all';
}
if ($access == 'pass') {
if (utf8_strlen($_POST['passwd']) < 1) {
$err[] = 'Введите пароль.';
}
if (utf8_strlen($_POST['passwd']) > 16) {
$err[] = 'Пароль слишком длинный.';
}
$password = $_POST['passwd'];
} else {
$password = NULL;
}
if (!isset($err)) {
mysql_query("UPDATE `user` SET `anketa_access` = '$access', `anketa_password` = '" . mysql_real_escape_string($password) . "' WHERE `id` = '$user[id]'");
msg('Изменения успешно приняты');
}
}
if (!isset($user)) {
err('Доступ закрыт гостям');
} else {
echo "<form action='settings.php?act=private&set=anketa' method='POST'>";
echo "<b>Кому доступна моя анкета?</b><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'all' ? " checked='checked'" : null) . " id='all' value='all' /><label for='all'><i class='material-icons'>public</i> Всем</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'only_me' ? " checked='checked'" : null) . " id='only_me' value='only_me' /><label for='only_me'><i class='material-icons'>lock</i> Только мне</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'friends' ? " checked='checked'" : null) . " id='friends' value='friends' /><label for='friends'><i class='material-icons'>group</i> Только друзьям</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'pass' ? " checked='checked'" : null) . " id='pass' value='pass' /><label for='pass'><i class='material-icons'>vpn_key</i> Только по паролю</label><br />";
echo "<div class='row'>";
echo "<div class='input-field col s12'>";
echo "<input id='passwd' name='passwd' length='16' type='text' value='" . htmlspecialchars($user['anketa_password']) . "' class='validate'>";
echo "<label for='passwd'>Пароль</label>";
echo "</div>";
echo "</div>";
echo "<button name='anketa' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
}
break;
}
echo "</div>";
echo "<div role='tabpanel' class='tab-pane' id='password'>";
echo "<form method='POST' action='settings.php?act=password'>";
echo '<br />';
echo "<input placeholder='Старый пароль' style='width: 50%;' class='form-control' type='text' name='pass' value='' />";
echo "<input placeholder='Новый пароль' style='width: 50%;' class='form-control' type='password' name='pass1' value='' />";
echo "<input placeholder='Подтверждение' style='width: 50%;' class='form-control' type='password' name='pass2' value='' />";
echo "<button class='waves-effect waves-light btn' name='save'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
echo "</div>";
?>
</div>
</div>
<?php
break;
##################################################ВИД#######################################################
case 'them':
if (isset($_POST['them'])) {
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('Изменения успешно приняты');
}
}
?>
<div class='card'>
<div class="card-header">Настройки</div>
<div class="card-block">
<ul class="nav nav-tabs">
<li class="nav-item"><a class="nav-link" href="#all" role="tab" data-toggle="tab">Общие</a></li>
<li class="nav-item"><a class="nav-link active" href="#them" role="tab" data-toggle="tab">Вид</a></li>
<li class="nav-item"><a class="nav-link" href="#time" role="tab" data-toggle="tab">Время</a></li>
<li class="nav-item"><a class="nav-link" href="#private" role="tab" data-toggle="tab">Приватность</a></li>
<li class="nav-item"><a class="nav-link" href="#password" role="tab" data-toggle="tab">Пароль</a></li>
</ul>
<?php
echo "<div class='tab-content'>";
#ОБЩИЕ
echo "<div role='tabpanel' class='tab-pane' id='all'>";
echo "<form name='settings' action='settings.php?' method='POST'><br />";
echo "<label class='c-input c-checkbox'><input name='set_files' value='1' type='checkbox' " . ($user['set_files'] ? " checked='checked'" : null) . "><span class='c-indicator'></span> <span data-toggle='tooltip' data-placement='right' title='Нажмите, чтобы влючить или отключить форму загрузки файла'>Выгрузка файлов</span></label><br />";
echo "<label class='c-input c-checkbox'><input name='set_news_to_mail' value='1' type='checkbox' " . ($user['set_news_to_mail'] ? " checked='checked'" : null) . "><span class='c-indicator'></span> <span data-toggle='tooltip' data-placement='bottom' title='Нажмите, чтобы влючить или отключить подписку на новости, которые будут приссылаться на E-mail.'>Присылать новости</span></label><br />";
echo "<button name='all' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
#ВИД
echo "<div role='tabpanel' class='tab-pane active' id='them'>";
echo "<form name='settings' action='settings.php?act=them' method='POST'>";
echo "<div class='row'>";
echo "<div class='input-field col s6'>";
echo "<input id='set_p_str' name='set_p_str' length='3' type='text' value='$set[p_str]' class='validate'>";
echo "<label for='set_p_str'>Пунктов на страницу</label>";
echo "</div>";
echo "</div>";
echo "<button name='them' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
#ВРЕМЯ
echo "<div role='tabpanel' class='tab-pane' id='time'>";
echo "<form name='settings' action='settings.php?act=time' method='POST'>";
echo "Время<br/>";
echo "<select class='form-control' name='set_timesdvig' style='width: 30%;'><br />";
for ($i = - 12; $i < 12; $i++) {
echo "<option value = '$i'" . ($user['set_timesdvig'] == $i ? " selected = 'selected'" : null) . ">" . date("G:i", $time + $i * 60 * 60) . "</option>n";
}
echo "</select>";
echo "<br />";
echo "<label class='c-input c-checkbox'><input name='set_times' value='1' type='checkbox' " . ($user['set_times'] ? " checked='checked'" : null) . "><span class='c-indicator'></span> <span data-toggle='tooltip' data-placement='right' title='Нажмите, чтобы влючить или отключить время'>Время в заголовке</span></label><br />";
echo "<button name='time' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
#ПРИВАТНОСТЬ
echo "<div role='tabpanel' class='tab-pane' id='private'>";
$set = (isset($_GET['set'])) ? htmlspecialchars($_GET['set']) : null;
switch ($set) {
default:
if (!isset($user)) {
err('Доступ закрыт гостям');
} else {
echo "<ul class='nav nav-pills'>";
echo "<li class='nav-item'><a class='nav-link active'>Профиль</a></li>";
echo "<li class='nav-item'><a class='nav-link' href='settings.php?act=private&set=anketa'>Анкета</a></li>";
echo "</ul>";
if (isset($_POST['profile'])) {
if (in_array($_POST['access'], array('all', 'only_me', 'friends', 'pass'))) {
$access = $_POST['access'];
} else {
$access = 'all';
}
if ($access == 'pass') {
if (utf8_strlen($_POST['passwd']) < 1) {
$err[] = 'Введите пароль.';
}
if (utf8_strlen($_POST['passwd']) > 16) {
$err[] = 'Пароль слишком длинный.';
}
$password = $_POST['passwd'];
} else {
$password = NULL;
}
if (!isset($err)) {
mysql_query("UPDATE `user` SET `profile_access` = '$access', `profile_password` = '" . mysql_real_escape_string($password) . "' WHERE `id` = '$user[id]'");
msg('Изменения успешно приняты');
}
}
if (!isset($user)) {
err('Доступ закрыт гостям');
} else {
echo "<form action='settings.php?act=private' method='POST'>";
echo "<b>Кому доступен мой профиль?</b><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'all' ? " checked='checked'" : null) . " id='all' value='all' /><label for='all'><i class='material-icons'>public</i> Всем</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'only_me' ? " checked='checked'" : null) . " id='only_me' value='only_me' /><label for='only_me'><i class='material-icons'>lock</i> Только мне</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'friends' ? " checked='checked'" : null) . " id='friends' value='friends' /><label for='friends'><i class='material-icons'>group</i> Только друзьям</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'pass' ? " checked='checked'" : null) . " id='pass' value='pass' /><label for='pass'><i class='material-icons'>vpn_key</i> Только по паролю</label><br />";
echo "<div class='row'>";
echo "<div class='input-field col s12'>";
echo "<input id='passwd' name='passwd' length='16' type='text' value='" . htmlspecialchars($user['profile_password']) . "' class='validate'>";
echo "<label for='passwd'>Пароль</label>";
echo "</div>";
echo "</div>";
echo "<button name='profile' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
}
}
break;
case 'anketa':
echo "<ul class='nav nav-pills'>";
echo "<li class='nav-item'><a class='nav-link' href='settings.php?act=private'>Профиль</a></li>";
echo "<li class='nav-item'><a class='nav-link active'>Анкета</a></li>";
echo "</ul>";
if (isset($_POST['anketa'])) {
if (in_array($_POST['access'], array('all', 'only_me', 'friends', 'pass'))) {
$access = $_POST['access'];
} else {
$access = 'all';
}
if ($access == 'pass') {
if (utf8_strlen($_POST['passwd']) < 1) {
$err[] = 'Введите пароль.';
}
if (utf8_strlen($_POST['passwd']) > 16) {
$err[] = 'Пароль слишком длинный.';
}
$password = $_POST['passwd'];
} else {
$password = NULL;
}
if (!isset($err)) {
mysql_query("UPDATE `user` SET `anketa_access` = '$access', `anketa_password` = '" . mysql_real_escape_string($password) . "' WHERE `id` = '$user[id]'");
msg('Изменения успешно приняты');
}
}
if (!isset($user)) {
err('Доступ закрыт гостям');
} else {
echo "<form action='settings.php?act=private&set=anketa' method='POST'>";
echo "<b>Кому доступна моя анкета?</b><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'all' ? " checked='checked'" : null) . " id='all' value='all' /><label for='all'><i class='material-icons'>public</i> Всем</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'only_me' ? " checked='checked'" : null) . " id='only_me' value='only_me' /><label for='only_me'><i class='material-icons'>lock</i> Только мне</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'friends' ? " checked='checked'" : null) . " id='friends' value='friends' /><label for='friends'><i class='material-icons'>group</i> Только друзьям</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'pass' ? " checked='checked'" : null) . " id='pass' value='pass' /><label for='pass'><i class='material-icons'>vpn_key</i> Только по паролю</label><br />";
echo "<div class='row'>";
echo "<div class='input-field col s12'>";
echo "<input id='passwd' name='passwd' length='16' type='text' value='" . htmlspecialchars($user['anketa_password']) . "' class='validate'>";
echo "<label for='passwd'>Пароль</label>";
echo "</div>";
echo "</div>";
echo "<button name='anketa' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
}
break;
}
echo "</div>";
echo "<div role='tabpanel' class='tab-pane' id='password'>";
echo "<form method='POST' action='settings.php?act=password'>";
echo '<br />';
echo "<input placeholder='Старый пароль' style='width: 50%;' class='form-control' type='text' name='pass' value='' />";
echo "<input placeholder='Новый пароль' style='width: 50%;' class='form-control' type='password' name='pass1' value='' />";
echo "<input placeholder='Подтверждение' style='width: 50%;' class='form-control' type='password' name='pass2' value='' />";
echo "<button class='waves-effect waves-light btn' name='save'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
echo "</div>";
?>
</div>
</div>
<?php
break;
##################################################ПАРОЛЬ####################################################
case 'password':
if (isset($_POST['save'])) {
if (isset($_POST['pass']) and mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = $user[id] AND `pass` = '" . shif($_POST['pass']) . "' LIMIT 1"), 0) == 1) {
if (isset($_POST['pass1']) && isset($_POST['pass2'])) {
if ($_POST['pass1'] == $_POST['pass2']) {
if (utf8_strlen($_POST['pass1']) < 6) {
$err = 'По соображениям безопасности новый пароль не может быть короче 6-ти символов';
}
if (utf8_strlen($_POST['pass1']) > 32) {
$err = 'Длина пароля превышает 32 символа';
}
} else {
$err = 'Новый пароль не совпадает с подтверждением';
}
} else {
$err = 'Введите новый пароль';
}
} else {
$err = 'Старый пароль неверен';
}
//Поисковое слово
$world_set_update = $_POST['pass1'];
//файл где ищем
$file_default = file_get_contents(H . 'sys/txt/if_password.txt');
//если нету записываем
if (stripos($file_default, $world_set_update) !== false) {
$err = 'Новый пароль слишком простой';
}
if (!isset($err)) {
mysql_query("UPDATE `user` SET `pass` = '" . shif($_POST['pass1']) . "' , `pass_time` = '" . time() . "' WHERE `id` = '$user[id]' LIMIT 1");
setcookie('pass', cookie_encrypt($_POST['pass1'], $user['id']), time() + 60 * 60 * 24 * 365);
msg('Пароль успешно изменен');
} else {
err("$err");
}
}
?>
<div class='card'>
<div class="card-header">Настройки</div>
<div class="card-block">
<ul class="nav nav-tabs">
<li class="nav-item"><a class="nav-link" href="#all" role="tab" data-toggle="tab">Общие</a></li>
<li class="nav-item"><a class="nav-link" href="#them" role="tab" data-toggle="tab">Вид</a></li>
<li class="nav-item"><a class="nav-link" href="#time" role="tab" data-toggle="tab">Время</a></li>
<li class="nav-item"><a class="nav-link" href="#private" role="tab" data-toggle="tab">Приватность</a></li>
<li class="nav-item"><a class="nav-link active" href="#password" role="tab" data-toggle="tab">Пароль</a></li>
</ul>
<?php
echo "<div class='tab-content'>";
#ОБЩИЕ##########################################################
echo "<div role='tabpanel' class='tab-pane' id='all'>";
echo "<form name='settings' action='settings.php?' method='POST'><br />";
echo "<label class='c-input c-checkbox'><input name='set_files' value='1' type='checkbox' " . ($user['set_files'] ? " checked='checked'" : null) . "><span class='c-indicator'></span> <span data-toggle='tooltip' data-placement='right' title='Нажмите, чтобы влючить или отключить форму загрузки файла'>Выгрузка файлов</span></label><br />";
echo "<label class='c-input c-checkbox'><input name='set_news_to_mail' value='1' type='checkbox' " . ($user['set_news_to_mail'] ? " checked='checked'" : null) . "><span class='c-indicator'></span> <span data-toggle='tooltip' data-placement='bottom' title='Нажмите, чтобы влючить или отключить подписку на новости, которые будут приссылаться на E-mail.'>Присылать новости</span></label><br />";
echo "<button name='all' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
#ВИД############################################################
echo "<div role='tabpanel' class='tab-pane' id='them'>";
echo "<form name='settings' action='settings.php?act=them' method='POST'>";
echo "<div class='row'>";
echo "<div class='input-field col s6'>";
echo "<input id='set_p_str' name='set_p_str' length='3' type='text' value='$set[p_str]' class='validate'>";
echo "<label for='set_p_str'>Пунктов на страницу</label>";
echo "</div>";
echo "</div>";
echo "<button name='them' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
#ВРЕМЯ##########################################################
echo "<div role='tabpanel' class='tab-pane' id='time'>";
echo "<form name='settings' action='settings.php?act=time' method='POST'>";
echo "Время<br/>";
echo "<select class='form-control' name='set_timesdvig' style='width: 30%;'><br />";
for ($i = - 12; $i < 12; $i++) {
echo "<option value = '$i'" . ($user['set_timesdvig'] == $i ? " selected = 'selected'" : null) . ">" . date("G:i", $time + $i * 60 * 60) . "</option>n";
}
echo "</select>";
echo "<br />";
echo "<label class='c-input c-checkbox'><input name='set_times' value='1' type='checkbox' " . ($user['set_times'] ? " checked='checked'" : null) . "><span class='c-indicator'></span> <span data-toggle='tooltip' data-placement='right' title='Нажмите, чтобы влючить или отключить время'>Время в заголовке</span></label><br />";
echo "<button name='time' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
#ПРИВАТНОСТЬ####################################################
echo "<div role='tabpanel' class='tab-pane' id='private'>";
$set = (isset($_GET['set'])) ? htmlspecialchars($_GET['set']) : null;
switch ($set) {
default:
if (!isset($user)) {
err('Доступ закрыт гостям');
} else {
echo "<ul class='nav nav-pills'>";
echo "<li class='nav-item'><a class='nav-link active'>Профиль</a></li>";
echo "<li class='nav-item'><a class='nav-link' href='settings.php?act=private&set=anketa'>Анкета</a></li>";
echo "</ul>";
if (isset($_POST['profile'])) {
if (in_array($_POST['access'], array('all', 'only_me', 'friends', 'pass'))) {
$access = $_POST['access'];
} else {
$access = 'all';
}
if ($access == 'pass') {
if (utf8_strlen($_POST['passwd']) < 1) {
$err[] = 'Введите пароль.';
}
if (utf8_strlen($_POST['passwd']) > 16) {
$err[] = 'Пароль слишком длинный.';
}
$password = $_POST['passwd'];
} else {
$password = NULL;
}
if (!isset($err)) {
mysql_query("UPDATE `user` SET `profile_access` = '$access', `profile_password` = '" . mysql_real_escape_string($password) . "' WHERE `id` = '$user[id]'");
msg('Изменения успешно приняты');
}
}
if (!isset($user)) {
err('Доступ закрыт гостям');
} else {
echo "<form action='settings.php?act=private' method='POST'>";
echo "<b>Кому доступен мой профиль?</b><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'all' ? " checked='checked'" : null) . " id='all' value='all' /><label for='all'><i class='material-icons'>public</i> Всем</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'only_me' ? " checked='checked'" : null) . " id='only_me' value='only_me' /><label for='only_me'><i class='material-icons'>lock</i> Только мне</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'friends' ? " checked='checked'" : null) . " id='friends' value='friends' /><label for='friends'><i class='material-icons'>group</i> Только друзьям</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'pass' ? " checked='checked'" : null) . " id='pass' value='pass' /><label for='pass'><i class='material-icons'>vpn_key</i> Только по паролю</label><br />";
echo "<div class='row'>";
echo "<div class='input-field col s12'>";
echo "<input id='passwd' name='passwd' length='16' type='text' value='" . htmlspecialchars($user['profile_password']) . "' class='validate'>";
echo "<label for='passwd'>Пароль</label>";
echo "</div>";
echo "</div>";
echo "<button name='profile' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
}
}
break;
case 'anketa':
echo "<ul class='nav nav-pills'>";
echo "<li class='nav-item'><a class='nav-link' href='settings.php?act=private'>Профиль</a></li>";
echo "<li class='nav-item'><a class='nav-link active'>Анкета</a></li>";
echo "</ul>";
if (isset($_POST['anketa'])) {
if (in_array($_POST['access'], array('all', 'only_me', 'friends', 'pass'))) {
$access = $_POST['access'];
} else {
$access = 'all';
}
if ($access == 'pass') {
if (utf8_strlen($_POST['passwd']) < 1) {
$err[] = 'Введите пароль.';
}
if (utf8_strlen($_POST['passwd']) > 16) {
$err[] = 'Пароль слишком длинный.';
}
$password = $_POST['passwd'];
} else {
$password = NULL;
}
if (!isset($err)) {
mysql_query("UPDATE `user` SET `anketa_access` = '$access', `anketa_password` = '" . mysql_real_escape_string($password) . "' WHERE `id` = '$user[id]'");
msg('Изменения успешно приняты');
}
}
if (!isset($user)) {
err('Доступ закрыт гостям');
} else {
echo "<form action='settings.php?act=private&set=anketa' method='POST'>";
echo "<b>Кому доступна моя анкета?</b><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'all' ? " checked='checked'" : null) . " id='all' value='all' /><label for='all'><i class='material-icons'>public</i> Всем</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'only_me' ? " checked='checked'" : null) . " id='only_me' value='only_me' /><label for='only_me'><i class='material-icons'>lock</i> Только мне</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'friends' ? " checked='checked'" : null) . " id='friends' value='friends' /><label for='friends'><i class='material-icons'>group</i> Только друзьям</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'pass' ? " checked='checked'" : null) . " id='pass' value='pass' /><label for='pass'><i class='material-icons'>vpn_key</i> Только по паролю</label><br />";
echo "<div class='row'>";
echo "<div class='input-field col s12'>";
echo "<input id='passwd' name='passwd' length='16' type='text' value='" . htmlspecialchars($user['anketa_password']) . "' class='validate'>";
echo "<label for='passwd'>Пароль</label>";
echo "</div>";
echo "</div>";
echo "<button name='anketa' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
}
break;
}
echo "</div>";
#ПАРОЛЬ#########################################################
echo "<div role='tabpanel' class='tab-pane active' id='password'>";
echo "<form method='POST' action='settings.php?act=password'>";
echo '<br />';
echo "<input placeholder='Старый пароль' style='width: 50%;' class='form-control' type='text' name='pass' value='' />";
echo "<input placeholder='Новый пароль' style='width: 50%;' class='form-control' type='password' name='pass1' value='' />";
echo "<input placeholder='Подтверждение' style='width: 50%;' class='form-control' type='password' name='pass2' value='' />";
echo "<button class='waves-effect waves-light btn' name='save'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
echo "</div>";
?>
</div>
</div>
<?php
break;
##################################################ОБЩИЕ - ПО УМОЛЧАНИЮ######################################
default:
if (isset($_POST['all'])) {
$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['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` = '" . mysql_real_escape_string($user['set_news_to_mail']) . "' WHERE `id` = '$user[id]' LIMIT 1");
if (!isset($err)) {
msg('Изменения успешно приняты');
}
}
?>
<div class='card'>
<div class="card-header">Настройки</div>
<div class="card-block">
<ul class="nav nav-tabs">
<li class="nav-item"><a class="nav-link active" href="#all" role="tab" data-toggle="tab">Общие</a></li>
<li class="nav-item"><a class="nav-link" href="#them" role="tab" data-toggle="tab">Вид</a></li>
<li class="nav-item"><a class="nav-link" href="#time" role="tab" data-toggle="tab">Время</a></li>
<li class="nav-item"><a class="nav-link" href="#private" role="tab" data-toggle="tab">Приватность</a></li>
<li class="nav-item"><a class="nav-link" href="#password" role="tab" data-toggle="tab">Пароль</a></li>
</ul>
<?php
echo "<div class='tab-content'>";
#ОБЩИЕ##########################################################
echo "<div role='tabpanel' class='tab-pane active' id='all'>";
echo "<form name='settings' action='settings.php?' method='POST'><br />";
echo "<label class='c-input c-checkbox'><input name='set_files' value='1' type='checkbox' " . ($user['set_files'] ? " checked='checked'" : null) . "><span class='c-indicator'></span> <span data-toggle='tooltip' data-placement='right' title='Нажмите, чтобы влючить или отключить форму загрузки файла'>Выгрузка файлов</span></label><br />";
echo "<label class='c-input c-checkbox'><input name='set_news_to_mail' value='1' type='checkbox' " . ($user['set_news_to_mail'] ? " checked='checked'" : null) . "><span class='c-indicator'></span> <span data-toggle='tooltip' data-placement='bottom' title='Нажмите, чтобы влючить или отключить подписку на новости, которые будут приссылаться на E-mail.'>Присылать новости</span></label><br />";
echo "<button name='all' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
#ВИД############################################################
echo "<div role='tabpanel' class='tab-pane' id='them'>";
echo "<form name='settings' action='settings.php?act=them' method='POST'>";
echo "<div class='row'>";
echo "<div class='input-field col s6'>";
echo "<input id='set_p_str' name='set_p_str' length='3' type='text' value='$set[p_str]' class='validate'>";
echo "<label for='set_p_str'>Пунктов на страницу</label>";
echo "</div>";
echo "</div>";
echo "<button name='them' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
#ВРЕМЯ##########################################################
echo "<div role='tabpanel' class='tab-pane' id='time'>";
echo "<form name='settings' action='settings.php?act=time' method='POST'>";
echo "Время<br/>";
echo "<select class='form-control' name='set_timesdvig' style='width: 30%;'><br />";
for ($i = - 12; $i < 12; $i++) {
echo "<option value = '$i'" . ($user['set_timesdvig'] == $i ? " selected = 'selected'" : null) . ">" . date("G:i", $time + $i * 60 * 60) . "</option>n";
}
echo "</select>";
echo "<br />";
echo "<label class='c-input c-checkbox'><input name='set_times' value='1' type='checkbox' " . ($user['set_times'] ? " checked='checked'" : null) . "><span class='c-indicator'></span> <span data-toggle='tooltip' data-placement='right' title='Нажмите, чтобы влючить или отключить время'>Время в заголовке</span></label>";
echo "<br /><button name='time' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
#ПРИВАТНОСТЬ####################################################
echo "<div role='tabpanel' class='tab-pane' id='private'>";
$set = (isset($_GET['set'])) ? htmlspecialchars($_GET['set']) : null;
switch ($set) {
default:
if (!isset($user)) {
err('Доступ закрыт гостям');
} else {
echo "<ul class='nav nav-pills'>";
echo "<li class='nav-item'><a class='nav-link active'>Профиль</a></li>";
echo "<li class='nav-item'><a class='nav-link' href='settings.php?act=private&set=anketa'>Анкета</a></li>";
echo "</ul>";
if (isset($_POST['profile'])) {
if (in_array($_POST['access'], array('all', 'only_me', 'friends', 'pass'))) {
$access = $_POST['access'];
} else {
$access = 'all';
}
if ($access == 'pass') {
if (utf8_strlen($_POST['passwd']) < 1) {
$err[] = 'Введите пароль.';
}
if (utf8_strlen($_POST['passwd']) > 16) {
$err[] = 'Пароль слишком длинный.';
}
$password = $_POST['passwd'];
} else {
$password = NULL;
}
if (!isset($err)) {
mysql_query("UPDATE `user` SET `profile_access` = '$access', `profile_password` = '" . mysql_real_escape_string($password) . "' WHERE `id` = '$user[id]'");
msg('Изменения успешно приняты');
}
}
if (!isset($user)) {
err('Доступ закрыт гостям');
} else {
echo "<form action='settings.php?act=private' method='POST'>";
echo "<b>Кому доступен мой профиль?</b><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'all' ? " checked='checked'" : null) . " id='all' value='all' /><label for='all'><i class='material-icons'>public</i> Всем</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'only_me' ? " checked='checked'" : null) . " id='only_me' value='only_me' /><label for='only_me'><i class='material-icons'>lock</i> Только мне</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'friends' ? " checked='checked'" : null) . " id='friends' value='friends' /><label for='friends'><i class='material-icons'>group</i> Только друзьям</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['profile_access'] == 'pass' ? " checked='checked'" : null) . " id='pass' value='pass' /><label for='pass'><i class='material-icons'>vpn_key</i> Только по паролю</label><br />";
echo "<div class='row'>";
echo "<div class='input-field col s12'>";
echo "<input id='passwd' name='passwd' length='16' type='text' value='" . htmlspecialchars($user['profile_password']) . "' class='validate'>";
echo "<label for='passwd'>Пароль</label>";
echo "</div>";
echo "</div>";
echo "<button name='profile' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
}
}
break;
case 'anketa':
echo "<ul class='nav nav-pills'>";
echo "<li class='nav-item'><a class='nav-link' href='settings.php?act=private'>Профиль</a></li>";
echo "<li class='nav-item'><a class='nav-link active'>Анкета</a></li>";
echo "</ul>";
if (!isset($user)) {
err('Доступ закрыт гостям');
} else {
echo "<form action='settings.php?act=private&set=anketa' method='POST'>";
echo "<b>Кому доступна моя анкета?</b><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'all' ? " checked='checked'" : null) . " id='all' value='all' /><label for='all'><i class='material-icons'>public</i> Всем</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'only_me' ? " checked='checked'" : null) . " id='only_me' value='only_me' /><label for='only_me'><i class='material-icons'>lock</i> Только мне</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'friends' ? " checked='checked'" : null) . " id='friends' value='friends' /><label for='friends'><i class='material-icons'>group</i> Только друзьям</label><br />";
echo "<input class='with-gap' name='access' type='radio' " . ($user['anketa_access'] == 'pass' ? " checked='checked'" : null) . " id='pass' value='pass' /><label for='pass'><i class='material-icons'>vpn_key</i> Только по паролю</label><br />";
echo "<div class='row'>";
echo "<div class='input-field col s12'>";
echo "<input id='passwd' name='passwd' length='16' type='text' value='" . htmlspecialchars($user['anketa_password']) . "' class='validate'>";
echo "<label for='passwd'>Пароль</label>";
echo "</div>";
echo "</div>";
echo "<button name='anketa' class='waves-effect waves-light btn' name='ok'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
}
break;
}
echo "</div>";
#ПАРОЛЬ#########################################################
echo "<div role='tabpanel' class='tab-pane' id='password'>";
echo "<form method='POST' action='settings.php?act=password'>";
echo '<br />';
echo "<input placeholder='Старый пароль' style='width: 50%;' class='form-control' type='text' name='pass' value='' />";
echo "<input placeholder='Новый пароль' style='width: 50%;' class='form-control' type='password' name='pass1' value='' />";
echo "<input placeholder='Подтверждение' style='width: 50%;' class='form-control' type='password' name='pass2' value='' />";
echo "<button class='waves-effect waves-light btn' name='save'><i class='material-icons'>save</i> Сохранить</button>";
echo "</form>";
echo "</div>";
echo "</div>";
?>
</div>
</div>
<?php
break;
}
require_once H . 'sys/inc/tfoot.php';