Файл: settings.php
Строк: 842
<?
require_once("core/core.php");
$location = 'В настройках';
//Только для авторизованных
if ($u['id']) {
if (isset($_GET['set_panel'])) {
if (!isset($u))
header("Location: reg.php?err=1");
if (isset($_GET['admin']) and $u['admin'] == 1) {
$title = $title . ' :: Настройки нижней панели';
include ('head.php');
if (isset($_GET['new'])) {
if (isset($_GET['ok'])) {
$name = ($_POST['name']);
$sname = ($_POST['sname']);
$url = ($_POST['url']);
mysql_query("INSERT INTO `links_niz` (`name`, `sname`, `url`) VALUES ('$name', '$sname', '$url')");
$_SESSION['new'] = 1;
header("location: ?set_panel&admin");
} else {
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: <a href="/settings.php">Настройки</a> :: <a href="settings.php?set_panel">Нижняя панель</a></center></div>';
echo '<div class="div">';
echo "<form method='post' action='?set_panel&admin&new&ok' >n";
echo "Название:<br /><input name="name" type="text" value='' /><br />n";
echo "Сокращение:<br /><input name="sname" type="text" value='' /><br />n";
echo "Ссылка:<br /><input name="url" type="text" value='/' /><br />n";
echo "<input value='Добавить' type='submit' name='ok' /><br />n";
echo "</form>n";
echo '</div>';
}
} elseif (isset($_GET['edit'])) {
$link = mysql_fetch_array(mysql_query("SELECT * FROM `links_niz` WHERE `id` = '" . intval($_GET['edit']) . "' LIMIT 1"));
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `links_niz` WHERE `id` = '$link[id]' LIMIT 1"), 0) != 0) {
if (isset($_GET['ok'])) {
$name = ($_POST['name']);
$sname = ($_POST['sname']);
$url = ($_POST['url']);
mysql_query("UPDATE `links_niz` SET `name` = '$name', `sname` = '$sname', `url` = '$url' WHERE `id` = '$link[id]' LIMIT 1");
$_SESSION['edit'] = 1;
header("location: ?set_panel&admin");
} else {
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: <a href="/settings.php">Настройки</a> :: <a href="settings.php?set_panel">Нижняя панель</a></center></div>';
echo '<div class="div">';
echo "<form method='post' action='?set_panel&admin&edit=$link[id]&ok'>n";
echo "Название:<br />n";
echo "<input type='text' name='name' value="$link[name]" /><br />n";
echo "Сокращение:<br />n";
echo "<input type='text' name='sname' value="$link[sname]" /><br />n";
echo "Ссылка:<br />n";
echo "<input type='text' name='url' value='$link[url]' /><br />n";
echo "<input type='submit' class='btn' value='Сохранить' name='ok' /><br /></form>n";
echo '</div>';
}
} else {
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: <a href="/settings.php">Настройки</a> :: Нижняя панель</center></div>';
echo '<div class="div">';
echo '<table><tr><td VALIGN=top><img src="style/error/notice.png" alt="Ошибка" /></td><td VALIGN=top>Ошибка!</table></div>';
echo '</div>';
echo '<div class="title">';
echo '<img src="style/page/back.png" alt="Back"> <a href = "?sid=back" onclick="history.back()">Назад</a>';
echo '</div>';
}
} elseif (isset($_GET['del'])) {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `links_niz` WHERE `id` = '" . intval($_GET['del']) . "' LIMIT 1"), 0) == 0) {
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: <a href="/settings.php">Настройки</a> :: Нижняя панель</center></div>';
echo '<div class="div">';
echo '<table><tr><td VALIGN=top><img src="style/error/notice.png" alt="Ошибка" /></td><td VALIGN=top>Ошибка!</table></div>';
echo '</div>';
echo '<div class="title">';
echo '<img src="style/page/back.png" alt="Back"> <a href = "?sid=back" onclick="history.back()">Назад</a>';
echo '</div>';
} else {
$link = mysql_fetch_array(mysql_query("SELECT * FROM `links_niz` WHERE `id` = '" . intval($_GET['del']) . "' LIMIT 1"));
if (isset($_GET['ok'])) {
mysql_query("DELETE FROM `links_niz` WHERE `id` = '$link[id]'");
mysql_query("DELETE FROM `links_niz_user` WHERE `id_link` = '$link[id]'");
$_SESSION['del'] = 1;
header("location: ?set_panel&admin");
} else {
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: <a href="/settings.php">Настройки</a> :: Нижняя панель</center></div>';
echo '<div class="div">';
echo 'Вы уверены, что хотите удалить эту ссылку "<font color="green">' . $link['name'] . '</font>" ?<br />';
echo '<a href="?set_panel&admin&del=' . $link['id'] . '&ok">Да</a>';
echo ' | <a href="?set_panel&admin">Нет</a>';
echo '</div>';
}
}
} else {
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: <a href="/settings.php">Настройки</a> :: Нижняя панель</center></div>';
echo "<div class='title'><img src='style/page/add.gif'> <a href='?set_panel&admin&new'>Добавить ссылку</a></div>";
$links = mysql_query("SELECT * FROM `links_niz` ORDER BY `name` DESC");
if (mysql_num_rows($links) == 0) {
echo "<div class='div'>";
echo "Нет ссылок";
echo "</div>";
}
while ($post = mysql_fetch_assoc($links)) {
echo "<div class='div'>";
echo "<span style='float:right;'><a class='icolink' href='?set_panel&admin&edit=$post[id]' title='редактировать'><img src='style/page/edit.gif'></a>";
echo " <a href='?set_panel&admin&del=$post[id]' title='удалить'><img src='style/page/delete.gif'></a></span>";
echo "<b>" . htmlspecialchars($post['name']) . "</b> - " . htmlspecialchars($post['sname']) . " <font color='green'>(" . htmlspecialchars($post['url']) . ")</font> n";
echo "</div>n";
}
echo "<div class='title'><img src='style/page/add.gif'> <a href='?set_panel&admin&new'>Добавить ссылку</a></div>";
}
} else {
$title = $title . ' :: Настройки нижней панели';
include 'head.php';
if (isset($_GET['add'])) {
if (isset($_GET['link'])) {
$link = mysql_fetch_array(mysql_query("SELECT * FROM `links_niz` WHERE `id` = '" . intval($_GET['link']) . "' LIMIT 1"));
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `links_niz` WHERE `id` = '$link[id]' LIMIT 1"), 0) == 0) {
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: <a href="/settings.php">Настройки</a> :: Ошибка!</center></div>';
echo '<div class="div">';
echo '<table><tr><td VALIGN=top><img src="style/error/notice.png" alt="Ошибка" /></td><td VALIGN=top>Ссылка не существует!</table></div>';
echo '</div>';
echo '<div class="title">';
echo '<img src="style/page/back.png" alt="Back"> <a href = "?sid=back" onclick="history.back()">Назад</a>';
echo '</div>';
} else {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `links_niz_user` WHERE `id_link` = '$link[id]' AND `id_user` = '$u[id]' LIMIT 1"), 0) == 0) {
$pos = mysql_result(mysql_query("SELECT MAX(`pos`) FROM `links_niz_user` WHERE `id_user` = '$u[id]'"), 0) + 1;
mysql_query("INSERT INTO `links_niz_user` (`id_link`, `id_user`, `pos`) VALUES ('$link[id]', '$u[id]', '$pos')");
$_SESSION['new_user'] = 1;
}
header("location: /settings.php?set_panel");
}
} else {
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: <a href="/settings.php">Настройки</a> :: Нижняя панель</center></div>';
echo "<div class='title'>Выберите из списка:</div>";
$links = mysql_query("SELECT * FROM `links_niz` ORDER BY `name` DESC");
if (mysql_num_rows($links) == 0) {
echo "<div class='div'>";
echo " Нет ссылок";
echo "</div>";
}
while ($post = mysql_fetch_assoc($links)) {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `links_niz_user` WHERE `id_link` = '$post[id]' AND `id_user` = '$u[id]' LIMIT 1"), 0) == 0) {
echo "<div class='div'>";
echo "<a href='?set_panel&add&link=$post[id]'><b>" . htmlspecialchars($post['sname']) . "</b> - " . htmlspecialchars($post['name']) . "</a></div>n";
}
}
}
} elseif (isset($_GET['up'])) {
$link = mysql_fetch_assoc(mysql_query("SELECT * FROM `links_niz_user` WHERE `id` = '" . intval($_GET['up']) . "' AND `id_user` = '$u[id]' LIMIT 1"));
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `links_niz_user` WHERE `pos` < '$link[pos]' AND `id_user` = '$u[id]' LIMIT 1"), 0) != 0) {
mysql_query("UPDATE `links_niz_user` SET `pos` = '" . ($link['pos']) . "' WHERE `pos` = '" . ($link['pos'] - 1) . "' AND `id_user` = '$u[id]' LIMIT 1");
mysql_query("UPDATE `links_niz_user` SET `pos` = '" . ($link['pos'] - 1) . "' WHERE `id` = '" . intval($_GET['up']) . "' AND `id_user` = '$u[id]' LIMIT 1");
$_SESSION['up'] = 1;
header("location: /settings.php?set_panel");
}
else
header("Location: /settings.php?set_panel");
}
elseif (isset($_GET['down'])) {
$link = mysql_fetch_assoc(mysql_query("SELECT * FROM `links_niz_user` WHERE `id` = '" . intval($_GET['down']) . "' AND `id_user` = '$u[id]' LIMIT 1"));
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `links_niz_user` WHERE `pos` > '$link[pos]' AND `id_user` = '$u[id]' LIMIT 1"), 0) != 0) {
mysql_query("UPDATE `links_niz_user` SET `pos` = '" . ($link['pos']) . "' WHERE `pos` = '" . ($link['pos'] + 1) . "' AND `id_user` = '$u[id]' LIMIT 1");
mysql_query("UPDATE `links_niz_user` SET `pos` = '" . ($link['pos'] + 1) . "' WHERE `id` = '" . intval($_GET['down']) . "' AND `id_user` = '$u[id]' LIMIT 1");
$_SESSION['down'] = 1;
header("location: /settings.php?set_panel");
}
else
header("Location: /settings.php?set_panel");
}
elseif (isset($_GET['del'])) {
$link = mysql_fetch_array(mysql_query("SELECT * FROM `links_niz_user` WHERE `id` = '" . intval($_GET['del']) . "' AND `id_user` = '$u[id]' LIMIT 1"));
$links = mysql_query("SELECT * FROM `links_niz_user` WHERE `id_user` = '$u[id]' AND `pos` > '$link[pos]' ORDER BY `pos` ASC");
while ($p = mysql_fetch_array($links)) {
mysql_query("UPDATE `links_niz_user` SET `pos` = '" . ($p['pos'] - 1) . "' WHERE `id` = '$p[id]' LIMIT 1");
}
mysql_query("DELETE FROM `links_niz_user` WHERE `id` = '$link[id]' AND `id_user` = '$u[id]'");
$_SESSION['del_user'] = 1;
header("Location: ?set_panel&");
} else {
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: <a href="/settings.php">Настройки</a> :: Нижняя панель</div>';
if ($u['admin'] == 1) {
echo "<div class='div'><a href='?set_panel&admin'>Панель управления</a></div>n";
}
echo '<div class="title">';
echo "<img src='style/page/add.gif'> <a href='?set_panel&add'>Добавить ссылку</a></div>";
echo '</div>';
if (isset($_SESSION['new_user'])) {
ok('Ссылка успешно добавлена');
unset($_SESSION['new_user']);
}
if (isset($_SESSION['del_user'])) {
ok('Ссылка успешно удалена');
unset($_SESSION['del_user']);
}
$links = mysql_query("SELECT * FROM `links_niz_user` WHERE `id_user` = '$u[id]' ORDER BY `pos` ASC");
if (mysql_num_rows($links) == 0) {
echo "<div class='div'>";
echo "Нет ссылок";
echo "</div>";
}
while ($post = mysql_fetch_assoc($links)) {
$link = mysql_fetch_assoc(mysql_query("SELECT * FROM `links_niz` WHERE `id` = '$post[id_link]' LIMIT 1"));
echo "<div class='div'>";
echo '<b>' . htmlspecialchars($link['sname']) . '</b> - ' . htmlspecialchars($link['name']) . '';
echo '<span style="float:right;"><a href="?set_panel&up=' . $post['id'] . '"><img src="style/page/up.png" /></a>';
echo ' <a href="?set_panel&down=' . $post['id'] . '"><img src="style/page/down.png" /></a>';
echo ' <a href="?set_panel&del=' . $post['id'] . '"><img src="style/page/delete.gif"></a></span>';
echo '</div>';
}
echo '<div class="title">';
echo "<img src='style/page/add.gif'> <a href='?set_panel&add'>Добавить ссылку</a></div>";
echo '</div>';
}
}
include 'foot.php';
exit;
}
switch (@$_GET['act']) {
//Смена пароля ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
case 'password':
$title = $title . ' :: Сменить пароль';
include 'head.php';
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: <a href="/settings.php">Настройки</a> :: Смена пароля</center></div>';
//Если данные получены
if (isset($_POST['submit'])) {
$pass1 = isset($_POST['pass1']) ? check($_POST['pass1']) : NULL;
$pass2 = isset($_POST['pass2']) ? check($_POST['pass2']) : NULL;
$pass3 = isset($_POST['pass3']) ? check($_POST['pass3']) : NULL;
if ($pass1 && $pass2 && $pass3) {
$pass1 = md5(md5($pass1));
if ($pass1 == $u['pass']) {
if ($pass2 == $pass3) {
if (strlen($pass2) < 2 || strlen($pass2) > 25) {
echo 'Недопустимая длина пароля (Не более 25 символов и не менее 2)';
} else {
if (preg_match("/[^0-9a-z-@*()?!~_=[]]+/i", $password)) {
echo 'Недопустимые символы в пароле!<br/>';
$error = '1';
} else {
mysql_query("UPDATE `users` SET
`pass` = '" . md5(md5($pass2)) . "',
`password` = '$pass2'
WHERE `id` = '" . $u['id'] . "'
");
ok('Пароль успешно изменён!');
}
}
} else {
echo '<div class = "div"><font color="red">Пароли не совпадают!</font></div>';
}
} else {
echo '<div class = "div"><font color="red">Ошибка! Повторите ввод!</font></div>';
}
}
}
//Вывод блоков для ввода
echo '<form action="settings.php?act=password" method=post>';
echo '<div class="div">';
echo '
Старый пароль: <br/>
<input type="password" name="pass1" maxlength="25"></br>';
echo '
Новый пароль: <br/>
<input type="password" name="pass2" maxlength="25"></br>';
echo '
Повторите новый пароль: <br/>
<input type="password" name="pass3" maxlength="25"></br>';
echo '
<input type="submit" name="submit" value="Сменить" class="submit white"/></form>';
echo '</div>';
include 'foot.php';
break;
//~~~~~~~~~~~~~~~~~~~~~~~~Основные настройки ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
case 'main':
$title = $title . ' :: Основные настройки';
include 'head.php';
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: <a href="/settings.php">Настройки</a> :: Основные</center></div>';
//Если данные получены
if (isset($_POST['submit'])) {
$setting_users_list = num($_POST['setting_users_list']);
if ($setting_users_list < 10 or $setting_users_list > 30)
$setting_users_list = '';
$setting_mail_list = num($_POST['setting_mail_list']);
if ($setting_mail_list < 10 or $setting_mail_list > 30)
$setting_mail_list = '';
$setting_jurnal_list = num($_POST['setting_jurnal_list']);
if ($setting_jurnal_list < 10 or $setting_jurnal_list > 30)
$setting_jurnal_list = '';
mysql_query("UPDATE `users` SET
`setting_users_list` = '$setting_users_list',
`setting_mail_list` = '$setting_mail_list',
`setting_jurnal_list` = '$setting_jurnal_list'
WHERE `id` = '" . $u['id'] . "'
");
ok('Изменения сохранены!');
$req = mysql_query("SELECT * FROM `users` WHERE `id` = '" . $u['id'] . "' LIMIT 1");
$u = mysql_fetch_assoc($req);
}
//Вывод блоков для ввода
echo '<form action="settings.php?act=main" method=post>';
echo '<div class="div">';
echo '
Пользователей на страницу: <br/><select name="setting_users_list">
<option value="10" ' . ($u['setting_users_list'] == '10' ? ' selected="selected"' : '') . '>10</option>
<option value="15" ' . ($u['setting_users_list'] == '15' ? ' selected="selected"' : '') . '>15</option>
<option value="30" ' . ($u['setting_users_list'] == '30' ? ' selected="selected"' : '') . '>30</option>
</select></div><div class="div">';
echo '
Сообщений на страницу: <br/><select name="setting_mail_list">
<option value="10" ' . ($u['setting_mail_list'] == '10' ? ' selected="selected"' : '') . '>10</option>
<option value="15" ' . ($u['setting_mail_list'] == '15' ? ' selected="selected"' : '') . '>15</option>
<option value="30" ' . ($u['setting_mail_list'] == '30' ? ' selected="selected"' : '') . '>30</option>
</select></div><div class="div">';
echo '
Записей в журнале на страницу: <br/><select name="setting_jurnal_list">
<option value="10" ' . ($u['setting_jurnal_list'] == '10' ? ' selected="selected"' : '') . '>10</option>
<option value="15" ' . ($u['setting_jurnal_list'] == '15' ? ' selected="selected"' : '') . '>15</option>
<option value="30" ' . ($u['setting_jurnal_list'] == '30' ? ' selected="selected"' : '') . '>30</option>
</select></div>';
echo '<div class="div">
<input type=submit name="submit" value="Сохранить" class="submit white"/></form>';
echo '</div>';
include 'foot.php';
break;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Приватность~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
case 'priv':
$title = $title . ' :: Настройки приватности';
include 'head.php';
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: <a href="/settings.php">Настройки</a> :: Приватность</center></div>';
if (isset($_POST['submit'])) {
$priv_mypage = num(@$_POST['priv_mypage']);
$priv_anketa = num(@$_POST['priv_anketa']);
$priv_friends = num(@$_POST['priv_friends']);
$priv_mail = num(@$_POST['priv_mail']);
$zapret_friends = num(@$_POST['zapret_friends']);
$set_timesdvig = intval($_POST['set_timesdvig']);
mysql_query("UPDATE `users` SET
`priv_mypage` = '$priv_mypage',
`priv_anketa` = '$priv_anketa',
`priv_friends` = '$priv_friends',
`priv_mail` = '$priv_mail',
`set_timesdvig` = '$set_timesdvig',
`zapret_friends` = '$zapret_friends'
WHERE `id` = '" . $u['id'] . "'
");
ok('Изменения сохранены!');
$req = mysql_query("SELECT * FROM `users` WHERE `id` = '" . $u['id'] . "' LIMIT 1");
$u = mysql_fetch_assoc($req);
}
echo '<form action="settings.php?act=priv" method=post>';
echo '<div class="div">
Кто может видеть моих друзей: <br/><select name="priv_friends">
<option value="0" ' . ($u['priv_friends'] == '0' ? ' selected="selected"' : '') . '>Все</option>
<option value="1" ' . ($u['priv_friends'] == '1' ? ' selected="selected"' : '') . '>Только друзья</option>
<option value="2" ' . ($u['priv_friends'] == '2' ? ' selected="selected"' : '') . '>Только я</option>
</select></div>';
echo '<div class="div">
Кто может отправлять мне сообщения: <br/><select name="priv_mail">
<option value="0" ' . ($u['priv_mail'] == '0' ? ' selected="selected"' : '') . '>Все</option>
<option value="1" ' . ($u['priv_mail'] == '1' ? ' selected="selected"' : '') . '>Только друзья</option>
</select></br></div>';
echo '<div class="div">
Принимать дружбу: <br/><select name="zapret_friends">
<option value="0" ' . ($u['zapret_friends'] == '0' ? ' selected="selected"' : '') . '>Да</option>
<option value="1" ' . ($u['zapret_friends'] == '1' ? ' selected="selected"' : '') . '>Нет</option>
</select></br></div>';
echo '<div class="div">';
echo '<input type=submit name="submit" value="Сохранить" class="submit white"/></form></div>';
include 'foot.php';
break;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Настройки часов~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
case 'time':
$title = $title . ' :: Настройки часов';
include 'head.php';
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: <a href="/settings.php">Настройки</a> :: Настройки часов</center></div>';
if (isset($_POST['submit'])) {
$format_time = num(@$_POST['format_time']);
$time_set = num(@$_POST['time_set']);
mysql_query("UPDATE `users` SET `format_time` = '$format_time', `time_set` = '$time_set' WHERE `id` = '" . $u['id'] . "' LIMIT 1");
ok('Изменения сохранены!');
$req = mysql_query("SELECT * FROM `users` WHERE `id` = '" . $u['id'] . "' LIMIT 1");
$u = mysql_fetch_assoc($req);
}
echo '<div class="div">';
echo '<form action="settings.php?act=time" method="post">';
echo "Часы:<br /><select name='time_set'>";
echo "<option value='0'" . ($u['time_set'] == 0 ? " selected='selected'" : null) . ">Показать</option>";
echo "<option value='1'" . ($u['time_set'] == 1 ? " selected='selected'" : null) . ">Спрятать</option>";
echo "</select>";
echo '</div><div class="div">';
//----------------Раша-------------------//
$timesRU = date("G:i");
//----------------Юкрайна-------------------//
$time1 = date("G") - 2;
$time2 = date("i");
$timesUA = '' . $time1 . ':' . $time2 . '';
//---------------------------------------//
echo '<form action="settings.php?act=time" method=post>';
echo 'Время: <br/>';
echo '<input name="format_time" type="radio" value="1"' . ($u['format_time'] == '1' ? ' checked' : '') . '/> UA ' . $timesUA . '<br/>';
echo '<input name="format_time" type="radio" value="0"' . ($u['format_time'] == '0' ? ' checked' : '') . '/> MSK ' . $timesRU . '<br/>';
echo '</div><div class="div">';
echo '<input type=submit name="submit" class="btn" value="Сохранить"></form>';
echo '</div>';
include 'foot.php';
break;
case 'panel':
$title = $title . ' :: Настройки панелей';
include 'head.php';
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: <a href="/settings.php">Настройки</a> :: Настройки панелей</center></div>';
if (isset($_POST['save']))
{
$u['panel']=intval($_POST['panel']);
if (in_array($u['panel'], array(1,2,3)))$u['panel']=$u['panel']; else $u['panel']=1;
mysql_query("UPDATE `users` SET `panel` = '$u[panel]' WHERE `id` = '$u[id]'");
$_SESSION['msg_set'] = 1;
header("Location: ?act=panel");
exit();
}
if (isset($_GET['font_size']))
{
$u['panel_font_size']=htmlspecialchars($_GET['font_size']);
if (in_array($u['panel_font_size'], array('small','medium')))$u['panel_font_size']=$u['panel_font_size']; else $u['panel_font_size']='medium';
mysql_query("UPDATE `users` SET `panel_font_size` = '$u[panel_font_size]' WHERE `id` = '$u[id]'");
header("Location: ?act=panel");
}
if (isset($_SESSION['msg_set']))
{
ok("Настройки успешно сохранены");
unset($_SESSION['msg_set']);
}
echo "<form method='POST' action=''>n";
echo "<div class='div'>n";
echo "<input type='radio' id='1' name='panel' value='1'".($u['panel']==1?' CHECKED':NULL)."> <label for='1'>Иконки</label><br />n";
echo "<input type='radio' name='panel' id='2' value='2'".($u['panel']==2?' CHECKED':NULL)."> <label for='2'>Слова</label><br />n";
echo "<input type='radio' name='panel' id='3' value='3'".($u['panel']==3?' CHECKED':NULL)."> <label for='3'>Буквы</label><br />n";
echo "</div>n";
echo "<div class='div'>n";
echo "<input type='submit' value='Сохранить' name='save'/>n";
echo "</div>n";
echo "</form>n";
echo "<div class='div'>n";
echo "Выберите размер шрифта: n";
echo ($u['panel_font_size']=='small'?'<b>':"<a href='?act=panel&font_size=small'><span>")."Маленький".($u['panel_font_size']=='small'?'</b>':"</span></a>");
echo " | n";
echo ($u['panel_font_size']=='medium'?'<b>':"<a href='?act=panel&font_size=medium'><span>")."Большой".($u['panel_font_size']=='medium'?'</b>':"</span></a>");
echo "</div>n";
include 'foot.php';
break;
case 'panel_style':
$title = $title . ' :: Настройки стиля панелей';
include 'head.php';
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: <a href="/settings.php">Настройки</a> :: Настройки стиля панелей</center></div>';
if (isset($_GET['cat']) && in_array(htmlspecialchars($_GET['cat']), array('panel_fon','panel_link','panel_newevent','panel_focus_link','panel_focus_fon','panel_border')))
{
$cat = htmlspecialchars($_GET['cat']);
if(isset($_GET['select']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `colors_list` WHERE `id` = '".intval($_GET['select'])."'"),0)!=0)
{
$color = mysql_fetch_array(mysql_query("SELECT * FROM `colors_list` WHERE `id` = '".intval($_GET['select'])."'"));
mysql_query("UPDATE `users` SET `$cat` = '$color[color]' WHERE `id` = '$u[id]' LIMIT 1");
header("Location: ?");
exit();
}
echo "Выберите цвет:n";
$query = mysql_query("SELECT * FROM `colors_list`");
while($post = mysql_fetch_array($query))
{
echo "<div style='background-color:#".$post['color'].";padding:2px'>n";
echo "<a href='?act=panel_style&cat=".$cat."&select=".$post['id']."' style='display:block; padding-left:10px;'><span><i style='color:black;'>".htmlspecialchars($post['name'])."</i></span></a>n";
echo "</div>n";
}
echo "<div class='div'>n";
echo "» <a href='?act=panel_style'>Назад</a>n";
echo "</div>n";
include 'foot.php';
exit();
}
?>
<div class="div">Настройки панелей</div>
<table border="0" bgcolor="black" cellpadding="1" cellspacing="1" style="width: 50%;">
<tr bgcolor="white">
<td bgcolor="white"><a href="?act=panel_style&cat=panel_fon">Фон:</a></td>
<td bgcolor="#<? echo $u['panel_fon'];?>"> </td>
</tr>
<tr bgcolor="white">
<td bgcolor="white"><a href="?act=panel_style&cat=panel_link">Ссылки:</a></td>
<td bgcolor="#<? echo $u['panel_link'];?>"> </td>
</tr>
<tr bgcolor="white">
<td bgcolor="white"><a href="?act=panel_style&cat=panel_newevent">Уведомл.:</a></td>
<td bgcolor="#<? echo $u['panel_newevent'];?>"> </td>
</tr>
<tr bgcolor="white">
<td bgcolor="white"><a href="?act=panel_style&cat=panel_focus_link">Акт.ссылк.:</a></td>
<td bgcolor="#<? echo $u['panel_focus_link'];?>"> </td>
</tr>
<tr bgcolor="white">
<td bgcolor="white"><a href="?act=panel_style&cat=panel_focus_fon">Акт.фон.:</a></td>
<td bgcolor="#<? echo $u['panel_focus_fon'];?>"> </td>
</tr>
<tr bgcolor="white">
<td bgcolor="white"><a href="?act=panel_style&cat=panel_border">Разделит.:</a></td>
<td bgcolor="#<? echo $u['panel_border'];?>"> </td>
</tr>
</table>
<?
include 'foot.php';
break;
case 'panel_icons':
$title = $title . ' :: Набор иконок';
include 'head.php';
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: <a href="/settings.php">Настройки</a> :: Набор иконок</center></div>';
if (isset($_SERVER["HTTP_USER_AGENT"]) && preg_match('#up-browser|blackberry|windows ce|symbian|palm|nokia#i', $_SERVER["HTTP_USER_AGENT"]))
$webbrowser=false;
elseif (isset($_SERVER["HTTP_USER_AGENT"]) && (preg_match('#windows#i', $_SERVER["HTTP_USER_AGENT"]) ||preg_match('#linux#i', $_SERVER["HTTP_USER_AGENT"]) ||preg_match('#bsd#i', $_SERVER["HTTP_USER_AGENT"]) ||preg_match('#x11#i', $_SERVER["HTTP_USER_AGENT"]) ||preg_match('#unix#i', $_SERVER["HTTP_USER_AGENT"]) ||preg_match('#macos#i', $_SERVER["HTTP_USER_AGENT"]) ||preg_match('#macintosh#i', $_SERVER["HTTP_USER_AGENT"])))
$webbrowser=true;else $webbrowser=false; // определение типа браузера
if ($webbrowser == true)
{
$web_panel = true;
} else $web_panel = false;
$array_icons_color = array('none', 'blue', 'green', 'pink', 'purple', 'red', 'yellow');
$array_icons_list = array('home', 'mail', 'journal', 'lenta');
if (isset($_POST['submited']))
{
$icons_list = htmlspecialchars($_POST['icons_list']);
if (in_array($icons_list, $array_icons_color))$icons_list = $icons_list; else $icons_list = 'none';
if (!isset($err))
{
mysql_query("UPDATE `users` SET `panel_icons_list` = '$icons_list' WHERE `id` = '$u[id]'");
$u['panel_icons_list'] = $icons_list;
$_SESSION['msg_set'] = 1;
header("Location: ?act=panel_icons");
exit();
}
}
if (isset($_SESSION['msg_set']))
{
ok("Настройки успешно сохранены!");
unset($_SESSION['msg_set']);
}
echo "<form method='POST' action=''>n";
echo "<div class='div'>n";
echo "Выберите набор иконок:<br />n";
foreach($array_icons_color AS $key => $value_color)
{
echo "<input type='radio' id='$value_color' name='icons_list' value='$value_color'".($u['panel_icons_list']==$value_color?" CHECKED":NULL)." /> <label for='$value_color'>n";
foreach($array_icons_list AS $key => $value_icon)
{
echo "<img src='/style/panel/".$value_icon."_".$value_color."".($web_panel==false?"_16x16":NULL).".png' /> n";
}
echo "</label><br />n";
}
echo "</div>n";
echo "<div class='div'>n";
echo "<input type='submit' name='submited' value='Сохранить' />n";
echo "</div>n";
echo "</form>n";
include 'foot.php';
break;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Главная настроек~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
default:
$title = $title . ' :: Настройки';
include 'head.php';
echo '<div class="title"><center><a href = "page.php?id=' . $u['id'] . '">' . $u['login'] . '</a> :: Настройки</center></div>';
echo '<div class="div"><img src="/style/page/settings.gif"alt="!"/> <a href = "settings.php?act=main">Основные</a></div>';
echo '<div class="div"><img
src="/style/page/settings.gif"alt="!"/> <a href = "settings.php?act=priv">Приватность</a></div>';
echo '<div class="div"><img
src="/style/page/settings.gif"alt="!"/> <a href = "settings.php?act=password">Смена пароля</a></div>';
echo '<div class="div"><img src="/style/page/settings.gif"alt="!"/> <a href = "?act=panel_style">Стиль панелей</a></div>';
echo '<div class="div"><img src="/style/page/settings.gif"alt="!"/> <a href = "?act=panel_icons">Настройка иконок</a></div>';
echo '<div class="div"><img src="/style/page/settings.gif"alt="!"/> <a href = "?act=panel">Настройки панелей</a></div>';
include 'foot.php';
break;
}
} else {
header("Location: reg.php?err=1");
}
?>