Файл: my/settings.php
Строк: 58
<?php
define('GCMS',true);
define('ROOT','../');
require_once (ROOT.'system/power.php');
if ($aut) {
if (!isset($_POST['sort']) || !isset($_POST['num'])) {
$diz -> head('Личные настройки');
$diz -> title('Личные настройки');
$sort = array('ASC' => 'Новые в конце', 'DESC' => 'Новые в начале');
$stat1 = null;
foreach ($sort as $key1 => $value1) {
if ($ya['sort'] == $key1) $stat1 .= '<option selected value="'.$key1.'">'.$value1.'</option>';
else $stat1 .= '<option value="'.$key1.'">'.$value1.'</option>';}
$p = array('5' => '5', '10' => '10', '15' => '15');
$p1 = null;
foreach ($p as $k1 => $v1) {
if ($ya['num'] == $k1) $p1 .= '<option selected value="'.$k1.'">'.$v1.'</option>';
else $p1 .= '<option value="'.$k1.'">'.$v1.'</option>';}
$st = $db -> query("SELECT `name` FROM `styles` where `url`='$ya[style]'")-> fetch_assoc();
$stat .= '<option value="'.$ya['style'].'">'.$st['name'].'</option>';
$s = $db -> query("SELECT `url`,`name` FROM `styles` where `url`<>'$ya[style]'");
while ($assoc = $s -> fetch_assoc()) {
$stat .= '<option value="'.$assoc['url'].'">'.$assoc['name'].'</option>';
}
$b = array('0' => 'Включены', '1' => 'Отключены');
$p4 = null;
foreach ($b as $k4 => $v4) {
if ($ya['mail'] == $k4) $p4 .= '<option selected value="'.$k4.'">'.$v4.'</option>';
else $p4 .= '<option value="'.$k4.'">'.$v4.'</option>';}
echo '<div class="fon"><form action="settings.php?" method="post">
Сортировка постов:<br/><select name="sort">'.$stat1.'</select>
<br/>Постов на страницу:
<br/><select name="num">'.$p1.'</select>
<br/>Цветовая схема:<br/><select name="style">'.$stat.'</select>
<br/>Личные сообщения:<br/><select name="z">'.$p4.'</select>
<br/><input type="submit" value="Изменить"/></form></div>';
echo '<div class="levo"><a href="./" class="levo_tuch">'.$diz -> img('back.png').' Личный кабинет</a></div>';
} else {
$num = isset($_POST['num']) ? abs((int)$_POST['num']) : '10';
if ($num < 5 || $num > 15) $num = 10;
$z = isset($_POST['z']) ? abs((int)$_POST['z']) : null;
$style = $db->real_escape_string(shit($_POST['style']));
$st = $db -> query("SELECT `id` FROM `styles` WHERE `url` = '".$style."' LIMIT 1");
if ($sql -> num_rows > 0) $style=$nastr['ststyle'];
$sort = (!empty($_POST['sort']) && ($_POST['sort'] == 'DESC' or $_POST['sort'] == 'ASC')) ? trim($_POST['sort']) : 'ASC';
$db -> query("UPDATE `users` SET `sort` = '".$sort."', `num` = '".$num."', `style` = '".$style."', `mail` = '".$z."' WHERE `id` = '".$ya['id']."'");
$diz -> head('Настройки');
$diz -> title('Настройки');
echo '<div class="fon">Настройки изменены!</div>';
echo '<div class="levo"><a href="./" class="levo_tuch">'.$diz -> img('back.png').' Личный кабинет</a></div>';
}
echo '<div class="levo"><a href="/index.php" class="levo_tuch">'.$diz -> img('home.png').' На главную</a></div>';
#####Копирайт#######
$diz -> out($msg);
} else header('location: ../aut.php');
?>