<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';

only_reg();
$set['title']='Настройки чата';
include_once '../sys/inc/thead.php';
title();

if (isset($_POST['save'])){

if (isset($_POST['zebra_chat']) && ($_POST['zebra_chat']==1 || $_POST['zebra_chat']==0))
{
$user['zebra_chat']=intval($_POST['zebra_chat']);
mysql_query("UPDATE `user` SET `zebra_chat` = '$user[zebra_chat]' WHERE `id` = '$user[id]' LIMIT 1");
}
else $err='Ошибка показа зебры';

if (isset($_POST['set_time_chat']) && (is_numeric($_POST['set_time_chat']) && $_POST['set_time_chat']>=0 && $_POST['set_time_chat']<=900))
{
$user['set_time_chat']=intval($_POST['set_time_chat']);
$set['time_chat']=$user['set_time_chat'];
mysql_query("UPDATE `user` SET `set_time_chat` = '$user[set_time_chat]' WHERE `id` = '$user[id]' LIMIT 1");
}
else $err='Ошибка во времени автообновления';

if (!isset($err))msg('Изменения успешно приняты');
}
err();

echo "<form method='post' action='?$passgen'>\n";
echo "<div class='textmes'>";
echo "Сообщения в чате идут зеброй<br />\n<select name='zebra_chat'>\n";
echo "<option value='1'".($user['zebra_chat']==1?" selected='selected'":null).">Да</option>\n";
echo "<option value='0'".($user['zebra_chat']==0?" selected='selected'":null).">Нет</option>\n";
echo "</select><br />\n";
echo "<font color='red'>Автообновление в чате:</font><br />\n<input type='text' name='set_time_chat' value='$set[time_chat]' maxlength='3' /><br />\n";
echo "<input type='submit' name='save' value='Сохранить' />\n";
echo "</form>\n";
echo "</div>\n";
echo "<div class='rekl'>";
echo "<img src='/style/back.gif' alt='' class='icon'/>\n";
echo " <a href='/umenu.php'>Мое меню</a> <br/>\n";
echo "</div>\n";
include_once '../sys/inc/tfoot.php';
?>