Файл: user/friends/access.php
Строк: 90
<?php
/* DCMS Special
* Дата последнего редактирования 15.12.2015
* Модифицировал densnet
*/
foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'user') as $inc) {
require_once "../../sys/inc/{$inc}.php";
}
only_reg();
$set['title'] = "Настройки";
require_once H . 'sys/inc/thead.php';
aut();
err();
if (isset($_POST['submited'])) {
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 `friends_access` = '$access', `friends_password` = '" . mysql_real_escape_string($password) . "' WHERE `id` = '$user[id]'");
header("Location: /user/friends");
}
$user['friendship'] = (isset($_POST['friendship']) && $_POST['friendship']) ? '1' : '0';
mysql_query("UPDATE `user` SET `friendship` = '" . mysql_real_escape_string($user['friendship']) . "' WHERE `id` = '$user[id]' LIMIT 1");
exit();
}
#Навигация
echo "<ol class='breadcrumb'>";
echo "<li><a href='/'><span class='fa fa-home fa-fw'></span></a></li>";
echo "<li><a href='/info.php?id=$user[id]'>$user[nick]</a></li>";
echo "<li><a href='/user/friends/index.php?id=$user[id]'>Друзья</a></li>";
echo "<li class='active'>Настройки</li>";
echo "</ol>";
echo "<form class = 'list-group-item' action = '' method = 'post'>";
echo "<b>Кому доступен список Ваших друзей?</b><br />";
echo "<label class='c-input c-radio'><input type='radio' name='access' value='all' " . ($user['friends_access'] == 'all' ? " checked='checked'" : NULL) . "/><span class='c-indicator'></span><i class='fa fa-globe fa-fw'></i> Всем</label><br />";
echo "<label class='c-input c-radio'><input type='radio' name='access' value='only_me' " . ($user['friends_access'] == 'only_me' ? " checked='checked'" : NULL) . "/><span class='c-indicator'></span><i class='fa fa-lock fa-fw'></i> Только мне</label> <br />";
echo "<label class='c-input c-radio'><input type='radio' name='access' value='friends' " . ($user['friends_access'] == 'friends' ? " checked='checked'" : NULL) . "/><span class='c-indicator'></span><i class='fa fa-users fa-fw'></i> Только друзьям</label><br />";
echo "<label class='c-input c-radio'><input type='radio' name='access' value='pass' " . ($user['friends_access'] == 'pass' ? " checked='checked'" : NULL) . " /><span class='c-indicator'></span><i class='fa fa-key fa-fw'></i> Только по паролю</label><br />";
echo "<input class='form-control' name='passwd' maxlength='16' style='width: 50%;' type='text' value='" . htmlspecialchars($user['friends_password']) . "' />";
echo "<label class='c-input c-checkbox'><input type='checkbox'" . ($user['friendship'] ? " checked='checked'" : null) . " name='friendship' value='1' /><span class='c-indicator'></span> Запретить предлогать мне дружбу</label><br />";
echo "<button name='submited' class='btn btn-success'><i class='fa fa-save fa-fw'></i> Сохранить</button>";
echo "</form>";
require_once H . 'sys/inc/tfoot.php';