<?
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';

$get=$_GET['id'];

$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$get'"));

$q=mysql_fetch_array(mysql_query("SELECT * FROM `frends` WHERE `user` = '$get'"));

if (isset($_POST['lenta_forum']) && $_POST['lenta_forum']==1)
{
$q['lenta_forum']=1;
mysql_query("UPDATE `frends` SET `lenta_forum` = '1' WHERE `user` = '$get' AND `frend` = '$user[id]'  LIMIT 1");
}
else
{
$q['lenta_forum']=0;
mysql_query("UPDATE `frends` SET `lenta_forum` = '0' WHERE `user` = '$get' AND `frend` = '$user[id]' LIMIT 1");
}


if (isset($_POST['lenta_obmen']) && $_POST['lenta_obmen']==1)
{
$q['lenta_obmen']=1;
mysql_query("UPDATE `frends` SET `lenta_obmen` = '1' WHERE `user` = '$get' AND `frend` = '$user[id]'  LIMIT 1");
}
else
{
$q['lenta_forum']=0;
mysql_query("UPDATE `frends` SET `lenta_obmen` = '0' WHERE `user` = '$get' AND `frend` = '$user[id]' LIMIT 1");
}


if (isset($_POST['lenta_foto']) && $_POST['lenta_foto']==1)
{
$q['lenta_foto']=1;
mysql_query("UPDATE `frends` SET `lenta_foto` = '1' WHERE `user` = '$get' AND `frend` = '$user[id]'  LIMIT 1");
}
else
{
$q['lenta_foto']=0;
mysql_query("UPDATE `frends` SET `lenta_foto` = '0' WHERE `user` = '$get' AND `frend` = '$user[id]' LIMIT 1");
}


$set['title'] = 'Настройка уведомлений '.$ank[nick];
include_once 'sys/inc/thead.php';
title();
aut();

echo "<form method='post'>\n";
echo "<label><input type='checkbox' name='lenta_forum'".($q[lenta_forum]?" checked='checked'":null)." value='1' />Уведомлять о новых темах в форуме</label><br />\n"; 
echo "<label><input type='checkbox' name='lenta_obmen'".($q[lenta_obmen]?" checked='checked'":null)." value='1' />Уведомлять о новых файлах в обменнике</label><br />\n"; 
echo "<label><input type='checkbox' name='lenta_foto'".($q[lenta_foto]?" checked='checked'":null)." value='1' />Уведомлять о новых темах в форуме</label><br />\n"; 
echo "<input type='submit' name='save' value='Сохранить' />\n";
echo "</form>\n";



include_once 'sys/inc/tfoot.php';
?>
