Файл: bratstva.php
Строк: 236
<?php
include_once('./inc/head.php');
include_once('./inc/prov.php');
title('Братства');
$profil = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$id_us."'"));
if($uinf['id'] == $profil['id'] or $uinf['adm'] == '1')
$new_msg = mysql_result(mysql_query("SELECT COUNT(*) FROM `ferm_privat` WHERE `komu` = '".$uinf['login']."' and `view` = '1'"), 0);
if($uinf['id'] == $profil['id'] or $uinf['adm'] == '1')
echo '<div class="title"><b>'.$uinf['login'].' <a href="./privat.php?privat=vhod"><img src="http://144.76.127.94/view/image/icons/post.png" height="15" width="15" align="top" alt="ic">'.$new_msg.'</a> | '.$uinf['hp'].'<img src="http://warbk.com/graph/ico/hp.png" width="16" height="16" > | <img src="http://warbk.com/img/lvl.png" width="16" height="16" > '.$uinf['lvl'].'</b> | <b>Золото: </b> '.$uinf['zoloto'].' <img src="./theme/gold.png" height="16" width="16" align="top" alt="ic"> | <b>Рубли: </b> '.$uinf['rub'].' <img src="http://144.76.127.94/view/image/icons/buy_gold.png" height="16" width="16" align="top" alt="ic"></div>';
switch(htmlspecialchars($_GET['clan'])) {
default;
echo '<div class="menulink">Братства</div>';
if($uinf['id_clan'] != '0') {
echo '<div class="menulink"><a href="?clan=myclan"><img src="/img/gerbaa.png" />Моё братство</a></div>';
}
if($uinf['id_clan'] == '0') {
echo '<div class="menulink"><a href="?clan=creat"><img src="/img/gerba.png"/>Создать братство</a></div>';
}
echo '<div class="menulink"><a href="?clan=allbratstv"><img src="/img/gerda.gif" />Список братств</a></div>';
break;
case 'myclan':
echo '<div class="menulink">Моё братство</div>';
if($uinf['id_clan'] != '0') {
echo '<div class="menulink"><b>'.$uclan['name'].'</b> - <font size="1px;">'.$uclan['opis'].'</font></div>';
echo '<div class="menulink"><center><img width="300" src="/img/favicon.gif"></center></div>';
echo '<div class="user"><b>Объявление</b></div>';
echo '<div class="content">'.$uclan['obyav'].'</div>';
if($uinf['id_clan'] != '0' && $uclan['id_user'] == $uinf['id']) {
echo '<div class="content"><form action="?clan=myclan&mode=editop" method="post"/>';
echo '<input type="text" name="opis" value="'.$uclan['obyav'].'"/><br/>';
echo '<input type="submit" value="Изменить"/></form>';
echo '</div>';
if(htmlspecialchars($_GET['mode']) == 'editop')
{
$opis = htmlspecialchars($_POST['opis']);
mysql_query("UPDATE `clan` SET `obyav` = '".$opis."' WHERE `id` = '".$uclan['id']."'");
$_SESSION['result'] = 'Вы изменили девиз!';
header("Location: http://warbk.com/start.php?start=result");
}
}
echo '<div class="user"><b>Характеристика</b></div>';
echo '<div class="content">';
echo '<b>Уровень:</b> '.$uclan['lvl_clan'].'<br/>';
echo '<b>Опыт:</b> '.$uclan['oput'].'<br/>';
echo '<b>Боннус к баллам:</b> '.($uclan['lvl_clan'] * 5).'%<br/>';
echo '<b>Вместимость играков:</b> <a href="?clan=mysoclan&id='.$uclan['id'].'">'.$count_mc.'</a>/'.$uclan['max_igrakov'].'<br/>';
echo '<b>Глава:</b> <a href="http://warbk.com/start.php?start=profil&id='.$uclan['id_user'].'">'.$uclan['name_user'].'</a><br/>';
echo '</div>';
} else {
echo '<div class="content">Вы не состоите в легионе!</div>';
}
break;
case 'mysoclan':
echo '<div class="menulink"><font color=#14FF38>В Легионе</font></div>';
$id = abs(intval(htmlspecialchars($_GET['id'])));
$search_clan = mysql_num_rows(mysql_query("SELECT `id` FROM `clan` WHERE `id` = '".$id."'"));
$c_us = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `id_clan` = '".$id."'"), 0);
if($search_clan != '0') {
$view_cu = mysql_query("SELECT * FROM `users` WHERE `id_clan` = '".$id."' ORDER BY `id` ASC LIMIT $start, $kmess");
while($v_cu = mysql_fetch_assoc($view_cu))
{
echo '<div class="menulink"><a href="http://warbk.com/start.php?start=profil&id='.$v_cu['id'].'">'.$v_cu['login'].'</a>';
if($uinf['id_clan'] != '0' && $id == $uclan['id'] && $uclan['id_user'] == $uinf['id'] && $v_cu['id'] != $uclan['id_user']) {
echo ' -> <a href="?clan=mysoclan&mode=delus&id='.$v_cu['id'].'">Выгнать</a>';
}
echo '</div>';
}
} else {
echo '<div class="content">Такого братства нет!</div>';
}
if ($c_us > $kmess) {
echo '<div class="content"><center>';
echo '' . pagenav('?clan=mysoclan&id=$id&', $start, $c_us, $kmess) . '';
echo '</center></div>';
}
if(htmlspecialchars($_GET['mode']) == 'delus')
{
$id = abs(intval($_GET['id']));
$id_i = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."'"));
if($id_i['id_clan'] == $uclan['id'] && $uinf['id'] == $uclan['id_user'] && $id_i['id'] != $uclan['id_user'])
{
mysql_query("UPDATE `users` SET `id_clan` = '0' WHERE `id` = '".$id."'");
mysql_query("DELETE FROM `prig_clan` WHERE `id_prig` = '".$id."' and `id_clan` = '".$uclan['id']."'");
$_SESSION['result'] = 'Вы выгнали игрока из братства!';
header("Location: http://warbk.com/start.php?start=result");
} else {
$_SESSION['result'] = 'Ошибка!';
header("Location: http://warbk.com/start.php?start=result");
}
}
break;
case 'prin':
$id = htmlspecialchars($_GET['id']);
//echo $id;
//echo $info['id'];
if($uinf['id_clan'] == '0') {
$cnt = mysql_num_rows(mysql_query("SELECT `id` FROM `prig_clan` WHERE `id_prig` = '".$uinf['id']."' and `id_clan` = '".$id."'"));
if($cnt != '0') {
$up_clans = mysql_query("UPDATE `users` SET `id_clan` = '".$id."' WHERE `id` = '".$uinf['id']."'");
$_SESSION['result'] = 'Вы вступили в братство!';
header("Location: http://warbk.com/start.php?start=result");
} else {
$_SESSION['result'] = 'Вас не приглашали в братство!';
header("Location: http://warbk.com/start.php?start=result");
}
} else {
$_SESSION['result'] = 'Вы уже в братстве!';
header("Location: http://warbk.com/start.php?start=result");
}
break;
case 'allbratstv':
echo '<div class="menulink">Список братств</div>';
$count_b = mysql_result(mysql_query("SELECT COUNT(*) FROM `clan`"), 0);
if($count_b == '0') {
echo '<div class="content">';
echo 'Братств нет!';
echo '</div>';
} else {
$sel_bratstv = mysql_query("SELECT * FROM `clan` ORDER BY `id` DESC LIMIT $start, $kmess");
while($sel_b = mysql_fetch_assoc($sel_bratstv)) {
$count_gamer = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `id_clan` = '".$sel_b['id']."'"), 0);
echo '<div class="content">';
echo '<b>Название:</b> '.$sel_b['name'].'<br/>';
echo '<b>Уровень:</b> '.$sel_b['lvl_clan'].'<br/>';
echo '<b>Играков:</b> <a href="?clan=mysoclan&id='.$sel_b['id'].'">'.$count_gamer.'</a>/'.$sel_b['max_igrakov'].'<br/>';
echo '<b>Создатель:</b> <a href="http://warbk.com/start.php?start=profil&id='.$sel_b['id_user'].'">'.$sel_b['name_user'].'</a><br/>';
echo '</div>';
}
if ($count_b > $kmess) {
echo '<div class="content"><center>';
echo '' . pagenav('?clan=allbratstv&', $start, $count_b, $kmess) . '';
echo '</center></div>';
}
}
break;
case 'creat':
echo '<div class="menulink">Создание братства</div>';
echo '<div class="user">Стоимость создания - 40 руб.</div>';
echo '<div class="content"><form action="?clan=creat&sozd=ok" method="POST"/>';
echo 'Название:<br/><input type="text" name="name"/><br/>';
echo 'Девиз:<br/><input type="text" name="opis"/><br/>';
echo '<input type="submit" value="Создать"/></form></div>';
if(htmlspecialchars($_GET['sozd']) == 'ok') {
if($uinf['id_clan'] == '0') {
if($uinf['rub'] >= '40') {
if($uinf['lvl'] >= '5') {
$name = htmlspecialchars($_POST['name']);
$opis = htmlspecialchars($_POST['opis']);
$reg_clan = mysql_real_escape_string(mysql_query("INSERT INTO `clan` VALUES(0, '".$name."', '".$opis."', '', '7', '200', '1', '".$uinf['id']."', '".$uinf['login']."', '".time()."')"));
$id_clan = mysql_result(mysql_query("SELECT `id` FROM `clan` WHERE `id_user` = '".$uinf['id']."'"), 0);
$up_bablo = mysql_query("UPDATE `users` SET `rub` = `rub` - 40, `id_clan` = '".$id_clan."' WHERE `id` = '".$uinf['id']."'");
$_SESSION['result'] = '<b>Братство '.$name.' успешно создано!</b><br/>';
header("Location: http://warbk.com/start.php?start=result");
} else {
$_SESSION['result'] = '<b>Ваш уровень должен быть 5 или больше!</b><br/>';
header("Location: http://warbk.com/start.php?start=result");
}
} else {
$_SESSION['result'] = '<b>Недостаточно рублей!</b><br/>';
header("Location: http://warbk.com/start.php?start=result");
}
} else {
$_SESSION['result'] = '<b>Вы уже состоите в клане!</b><br/>';
header("Location: http://warbk.com/start.php?start=result");
}
}
break;
}
if($_SERVER['REQUEST_URI'] != '/bratstva.php' and $_SERVER['REQUEST_URI'] != '/bratstva.php?')
{
echo '<div class="menulink"><a href="?"><font color="black">Вернуться</font></a></div>';
}
include_once('./inc/foot.php');
?>