Файл: zfarm.mobi/inc/collective/gocollective.php
Строк: 28
<?
$title='Вступление в колхоз';
include_once '../system/config.php';
if(isset($_GET['gocollective']) && ($mc['id']==$ct['id']) && ($_GET['gocollective'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_collective` WHERE `id` = '".($_GET['gocollective'])."' LIMIT 1"),0)!=0){
$mcu =mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_collective_user` WHERE `id_user` = '$ku[id]'"));
$ct =mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_collective` WHERE `id` = '".intval($_GET['gocollective'])."'"));
if(isset($_GET['go']) && ($mcu['id']<1) && $ku['level']>9 && mysql_result(mysql_query("SELECT COUNT(*) FROM `start_collective` WHERE `id_user` = '$ku[id]'"),0)<1)
{
mysql_query("INSERT INTO `start_collective` SET `id_user` = '$ku[id]', `time` = '$time', `collective` = '".intval($_GET['gocollective'])."'");
header("Location:/InviteKolhoz/$ct[id]");
$_SESSION['msg']='Заявка подана';
}
if(isset($_GET['noGo']) && ($mcu['id']<1) && $ku['level']>9 && mysql_result(mysql_query("SELECT COUNT(*) FROM `start_collective` WHERE `id_user` = '$ku[id]'"),0)>0)
{
mysql_query("DELETE FROM `start_collective` WHERE `id_user` = '$ku[id]'");
header("Location:/InviteKolhoz/$ct[id]");
$_SESSION['msg']='Заявка отменена';
}
if($mcu['status']==1)echo "<div class='title'>Описание</div><ul>";
if($mcu['status']==1 && $_GET['gocollective']==$mcu['id_collective'] && isset($_GET['rules']))
{
if(isset($_POST['rules']))
{
mysql_query("UPDATE `kolhoz_collective` SET `rules` = '".my_esc($_POST['rules'])."' WHERE `id` = '$mc[id]'");
header("Location:/InviteKolhoz/$ct[id]");
}
else
{
echo"<div class='rzd2'></div><div class='menuin2'>";
echo "<form method='post'><div class='div'><label for='rules'>Введите описание</label>
<div><textarea id='rules' class='wide' rows='10' name='rules'>".hsc($ct['rules'])."</textarea></div>
<input type='submit' value='Сохранить'>";
echo'</div><div class="div">Описание будет выводиться для желающих вступить в ваш колхоз</div>';
}
echo"</div></div><div class='rzd2'></div>";
include_once '../system/foot.php';
}
if($mc['rules']!=NULL)
{
echo"<div class='rzd2'></div><div class='menuin2'>";
echo "<div class='div'><li><span class='n'>".output_text($ct['rules'])."</span></li></div>";
}
if($_GET['gocollective']==$mcu['id_collective'] && $mcu['status']==1)echo"<div class='div'><a href='/InviteKolhoz/rules/$mc[id]'>Изменить критерии</a></div>";
if($mc['id']<1 && mysql_result(mysql_query("SELECT COUNT(*) FROM `start_collective` WHERE `id_user` = '$ku[id]'"),0)<1)
{
echo"<div class='div'><a href='/InviteKolhoz/go/$ct[id]/'>Подать заявку на вступление</a></div>";
}
echo "</ul></div>";
}
echo"</div></div><div class='rzd2'></div>";
include_once '../system/foot.php';
?>