Файл: chit_add.php
Строк: 131
<?
include_once 'connect.php';
include_once 'head.php';
if (!isset($_GET['id'])){header("Location: page.php?".SID);exit;}
$ank['id']=intval($_GET['id']);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `id` = '$ank[id]' LIMIT 1"),0)==0){header("Location: index.php?".SID);exit;}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `lenta_chit` WHERE (`user` = '$ank[id]' AND `chit` = '$u[id]') LIMIT 1"),0)==1){header("Location: index.php?".SID);exit;}
$get=intval($_GET['id']);
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '$get'"));
$my=mysql_fetch_array(mysql_query("SELECT * FROM `lenta_chit` WHERE `user` = '$get'"));
if (isset($_POST['lenta_forum']) && $_POST['lenta_forum']==1){
$my['lenta_forum']=1;
mysql_query("UPDATE `lenta_chit` SET `lenta_forum` = '1' WHERE `user` = '$u[id]' AND `chit` = '$ank[id]' LIMIT 1");
}else{
$my['lenta_forum']=0;
mysql_query("UPDATE `lenta_chit` SET `lenta_forum` = '0' WHERE `user` = '$u[id]' AND `chit` = '$ank[id]' LIMIT 1");
}
if (isset($_POST['lenta_obmen']) && $_POST['lenta_obmen']==1)
{
$my['lenta_obmen']=1;
mysql_query("UPDATE `lenta_chit` SET `lenta_obmen` = '1' WHERE `user` = '$u[id]' AND `chit` = '$ank[id]' LIMIT 1");
}else{
$my['lenta_obmen']=0;
mysql_query("UPDATE `lenta_chit` SET `lenta_obmen` = '0' WHERE `user` = '$u[id]' AND `chit` = '$ank[id]' LIMIT 1");
}
if (isset($_POST['lenta_foto']) && $_POST['lenta_foto']==1){
$my['lenta_foto']=1;
mysql_query("UPDATE `lenta_chit` SET `lenta_foto` = '1' WHERE `user` = '$u[id]' AND `chit` = '$ank[id]' LIMIT 1");
}else{
$my['lenta_foto']=0;
mysql_query("UPDATE `lenta_chit` SET `lenta_foto` = '0' WHERE `user` = '$u[id]' AND `chit` = '$ank[id]' LIMIT 1");
}
if (isset($_POST['lenta_comm']) && $_POST['lenta_comm']==1){
$my['lenta_comm']=1;
mysql_query("UPDATE `lenta_chit` SET `lenta_comm` = '1' WHERE `user` = '$u[id]' AND `chit` = '$ank[id]' LIMIT 1");
}else{
$my['lenta_comm']=0;
mysql_query("UPDATE `lenta_chit` SET `lenta_comm` = '0' WHERE `user` = '$u[id]' AND `chit` = '$ank[id]' LIMIT 1");
}
if (isset($_POST['lenta_blog']) && $_POST['lenta_blog']==1){
$my['lenta_blog']=1;
mysql_query("UPDATE `lenta_chit` SET `lenta_blog` = '1' WHERE `user` = '$u[id]' AND `chit` = '$ank[id]' LIMIT 1");
}else{
$my['lenta_blog']=0;
mysql_query("UPDATE `lenta_chit` SET `lenta_blog` = '0' WHERE `user` = '$u[id]' AND `chit` = '$ank[id]' LIMIT 1");
}
if (isset($_GET['OK'])){
$title=$title.' | Настройка уведомлений | '.$ank['login'];
}
else{
$title = $title.' | В ленту | '.$ank['login'];
}
if(isset($_GET['OK']))
{
ok('Поставьте метки');
$time=time();
if($u['id']!=$_GET['id']){
mysql_query("INSERT INTO `lenta_chit`
(`user`, `chit`, `time`)
values('$ank[id]', '$u[id]', '$time')");
}
else
{
echo "Вы там в своем уме??Себя в ленту нельзя добавлять!";
}
echo "<div class='div'>";
echo "<form method='post'>n";
echo "<label><input type='checkbox' name='lenta_forum'".($my['lenta_forum']?" checked='checked'":null)." value='1' />Уведомлять о новых темах в форуме</label><br />n";
#echo "<label><input type='checkbox' name='lenta_obmen'".($my['lenta_obmen']?" checked='checked'":null)." value='1' />Уведомлять о новых файлах</label><br />n";
echo "<label><input type='checkbox' name='lenta_foto'".($my['lenta_foto']?" checked='checked'":null)." value='1' />Уведомлять о новых фото</label><br />n";
#echo "<label><input type='checkbox' name='lenta_comm'".($my['lenta_comm']?" checked='checked'":null)." value='1' />Уведомлять о вступлении в сообщества</label><br />n";
echo "<label><input type='checkbox' name='lenta_blog'".($my['lenta_blog']?" checked='checked'":null)." value='1' />Уведомлять о создании дневника</label><br />n";
echo "<input type='submit' name='save' value='Сохранить' />n";
echo "</form></div>n";
include_once 'foot.php';
exit;
}
echo "<div class='div'>Вы действительно хотите добавить ".$ank['login']." в ленту?<br />n";
echo '<form action="?id='.intval($_GET['id']).'&OK" method=post>';
echo '<input type=submit name="submit" value="Да" class="submit white"/><a href="'.intval($_GET['id']).'">Нет</a></form>';
echo'</div>';
include_once 'foot.php';
exit;
?>