File size: 2.38Kb
<?php
include 'sys/db.php';
include 'sys/conf.php';
include 'sys/start.php';
include 'sys/functions.php';
$config_title_name = "Настройки";
include 'style/head.php';
if(isset($user['login'])){
$act = isset($_GET['act']) ? $_GET['act'] : '';
switch($act){
default:
echo "<div class=title>Настройки</div>";
echo "<div class=content>\n";
if ($_GET['isset']=='edityes') {echo "Настройки успешно изменены!<br><br>\n";}
if ($_GET['isset']=='norefresh') {echo "Поле "Время автообновления" не заполненно!<br><br>\n";}
echo "<form action='setting.php?act=edit' method='post'>\n";
echo "Тема оформления:<br />\n<select name=\"theme\">\n";
$opendirthem=opendir('style/styles');
while ($themes=readdir($opendirthem)){
if (is_dir("style/styles/$themes") && $themes!='.' && $themes!='..'){
if ($theme==$themes)$check=' selected="selected"';else $check=NULL;
echo "<option$check value=\"$themes\">$themes</option>\n";}}
echo "</select><br />\n";
echo "Отображать новые анкеты?:<br>\n";
echo "Нет ";
if($user['set_new_ank']=="1"){
echo " <input name='set_new_ank' type='radio' value='1' checked>";
} else {
echo "<input name='set_new_ank' type='radio' value='1'>";}
echo " | ";
if($user['set_new_ank']=="0"){
echo "<input name='set_new_ank' type='radio' value='0' checked>";
} else {
echo "<input name='set_new_ank' type='radio' value='0'>";}
echo "Да<br>\n";
echo "Время автообновления (сек):<br><input type='text' name='set_refresh' value='".$user['set_refresh']."' maxlength='3'><br>";
echo "<br><input type='submit' value='Изменить' ></form>\n";
echo "</div>\n";
break;
case('edit'):
$user['set_theme']=$_POST['theme'];
mysql_query("UPDATE `users` SET `set_theme` = '$user[set_theme]' WHERE `id` = '$user[id]' LIMIT 1");
$set_new_ank = intval($_POST['set_new_ank']);
mysql_query("UPDATE `users` SET `set_new_ank`= '$set_new_ank' WHERE `id` = '$user[id]'");
$set_refresh = intval($_POST['set_refresh']);
if ($set_refresh == '') {header ("Location: setting.php?isset=norefresh"); exit;}
mysql_query("UPDATE `users` SET `set_refresh`= '$set_refresh' WHERE `id` = '$user[id]'");
header ("Location: setting.php?isset=edityes"); exit;
break;}
}else{ header ("Location: index.php"); exit;}
echo "<div class=content><a href='index.php'>Прихожая</a></div>\n";
include 'style/foot.php';
?>