Файл: test.zfarm.mobi/msclub/msindex.php
Строк: 481
<?php
what(0, 'msclan');
if(isset($_GET['msdellog']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_clog` WHERE `club` = '".num($user['msclub'])."' LIMIT 1"),0)!=0){
$post = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_clog` WHERE `club` = '".num($user['msclub'])."'"));
if(isset($_GET['msdel'])){
$msg = mysql_query("SELECT * FROM `mystyle_clog` WHERE `club` = '".num($user['msclub'])."' ORDER BY `id` DESC");
while($del = mysql_fetch_array($msg))
{
mysql_query("DELETE FROM `mystyle_clog` WHERE `club` = '".num($user['msclub'])."' LIMIT 1");
}
///////// Лог Пользователя ///// By MyStyle
$text = 'История удалена';
$_SESSION['msg'] = $text;
header("Location: ./?msclub&msdellog");
exit;
}
echo '<div>
<div class="feedbackPanel">Действительно удалить всю историю?
<div style="text-align: center;">
<div class="fl" style="width: 49%;">
<a class="btn" href="./?msclub&msdellog&msdel">
<img width="16" height="16" alt="o" src="/images/icons/tick.png"/>
<span>Уверен</span>
</a>
</div>
<div class="fr" style="width: 49%;">
<a class="btn" href="./?msclub&msdellog">
<img width="16" height="16" alt="o" src="/images/icons/cross.png"/>
<span>На главную!</span>
</a>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>';
}elseif(isset($_GET['msclog']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_clog` WHERE `club` = '".num($user['msclub'])."'"),0)!=0){
if($clubuser['admin'] == 1 || $clubuser['admin'] == 2 || $clubuser['admin'] == 3 || $clubuser['admin'] == 4)echo '<a class="btn" href="./?msclub&msdellog">Очистить историю</a>';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_clog` WHERE `club` = '".num($user['msclub'])."' ORDER BY `id` DESC"),0);
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
$start=$user['set']*$page-$user['set'];
$q=mysql_query("SELECT * FROM `mystyle_clog` WHERE `club` = '".num($user['msclub'])."' ORDER BY `id` DESC LIMIT $start, $user[set]");
while($post=mysql_fetch_array($q))
{
echo '<div class="btn">';
echo users($post['user']);
echo ' '.$post['msg'].'';
echo '<span class="fr minor nobr">'.vremja($post['time']).'</span>';
echo '</div>';
}
if ($k_page>1)str("?msclub&msclog&",$k_page,$page); // Вывод страниц
echo '<div>
<div class="feedbackPanel">
<div style="text-align: center;">
<div class="fl" style="width: 49%;">
<a class="btn" href="?msclub">
<img width="16" height="16" alt="o" src="/images/icons/tick.png"/>
<span>В клан!</span>
</a>
</div>
<div class="fr" style="width: 49%;">
<a class="btn" href="./">
<img width="16" height="16" alt="o" src="/images/icons/cross.png"/>
<span>На главную!</span>
</a>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>';
}elseif(isset($_GET['mscuserinfo']) && num($_GET['mscuserinfo'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_cuser` WHERE `user` = '".num($_GET['mscuserinfo'])."'"),0)!=0){
$post = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_cuser` WHERE `user` = '".num($_GET['mscuserinfo'])."'"));
echo '<div class="feedbackPanel">';
echo users($post['user']);
echo '</div>';
echo '<span class="fr like">'.msclubstat($post['admin']).'</span>';
echo '<div class="btn">';
echo 'Вклад монет: '.$post['money'].'<br />';
echo 'Вклад баксов: '.$post['ruby'].'<br />';
echo 'Рейтинг: '.rating($post['rating']).' (<span class="like">'.$post['rating'].'</span>)<br />';
echo '</div>';
echo '<div>
<div class="feedbackPanel">
<div style="text-align: center;">
<div class="fl" style="width: 49%;">
<a class="btn" href="?msclub">
<img width="16" height="16" alt="o" src="/images/icons/tick.png"/>
<span>В клан!</span>
</a>
</div>
<div class="fr" style="width: 49%;">
<a class="btn" href="./">
<img width="16" height="16" alt="o" src="/images/icons/cross.png"/>
<span>На главную!</span>
</a>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>';
}elseif(isset($_GET['msclub_exit']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_cuser` WHERE `user` = '".$user['id']."' AND `type` = '".num($user['msclub'])."'"),0)!=0){
$post = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_cuser` WHERE `user` = '".$user['id']."' AND `type` = '".num($user['msclub'])."'"));
if(isset($_GET['exit'])){
mysql_query("DELETE FROM `mystyle_cuser` WHERE `user` = '".$post['user']."' LIMIT 1");
mysql_query("UPDATE `mystyle_user` SET `msclub` = '".num(0)."' WHERE `id` = '".num($user['id'])."'");
$text = 'Вы вышли из клана';
$_SESSION['msg'] = $text;
header("Location: ./?msclub");
exit;
}else{
echo '<div>
<div class="feedbackPanel">
<div class="whiteLink">Вы уверены?</div>
<div style="text-align: center;">
<div class="fl" style="width: 49%;">
<a class="btn" href="?msclub&msclub_exit&exit">
<img width="16" height="16" alt="o" src="/images/icons/tick.png"/>
<span>Подтверждаю!</span>
</a>
</div>
<div class="fr" style="width: 49%;">
<a class="btn" href="./">
<img width="16" height="16" alt="o" src="/images/icons/cross.png"/>
<span>Отказываюсь!</span>
</a>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>';
}
}elseif(isset($_GET['mschat']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_cchat` WHERE `alt` = '".num($user['msclub'])."'"),0)!=0){
$post = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_cchat` WHERE `alt` = '".num($user['msclub'])."'"));
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_croom` WHERE `alt` = '".num($user['msclub'])."'"),0);
if ($k_post==0){
echo '<div>
<div class="feedbackPanel">
<div class="whiteLink">В чате пусто</div>
</div></div>';
}
if(isset($_POST['name']))
{
$name = my_esc($_POST['name']);
if (preg_match("#[a-z]+#ui", $name) && preg_match("#[а-я]+#ui", $name))err_game('Разрешается использовать символы только русского или только английского алфавита');
elseif (preg_match("#(^ )|( $)#ui", $name))err_game('Запрещено использовать пробел в начале и конце текста');
elseif (strlen2($name)<5)err_game('Короткий текст');
elseif (strlen2($name)>255)err_game('Длина текста превышает 255 символа');
else
{
mysql_query("INSERT INTO `mystyle_croom` SET `time` = '".$time."', `msg` = '".$name."', `alt`= '".$user['msclub']."', `user` = '".$user['id']."'");
///////// Лог Пользователя ///// By MyStyle
$text = 'Добавлено!';
$_SESSION['msg'] = $text;
header("Location: ./?msclub&mschat");
exit;
}
}
echo '<form id="id1" action="" method="post">
<div>
<label>Сообщение:<br><textarea class="wide" class="btn bold" name="name"></textarea></label></div>
<div><input type="submit" class="btn bold" style="width: 98%; font-size: 16px;" value="Отправить"></div></form></div>';
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
$start=$user['set']*$page-$user['set'];
$q=mysql_query("SELECT * FROM `mystyle_croom` WHERE `alt` = '".num($user['msclub'])."' ORDER BY `id` DESC LIMIT $start, $user[set]");
while($post=mysql_fetch_array($q))
{
$sr = $start+1;
echo '<div class="btn">';
echo users($post['user']);
echo '<br />';
echo mat(smile(bbcode(check($post['msg']))));
echo '<br />';
echo 'Добавил: '.vremja($post['time']).'';
echo '</div>';
$start++;
}
if ($k_page>1)str("?mschat&",$k_page,$page);
echo '<div>
<div class="feedbackPanel">
<div style="text-align: center;">
<div class="fl" style="width: 49%;">
<a class="btn" href="?msclub">
<img width="16" height="16" alt="o" src="/images/icons/tick.png"/>
<span>В клан!</span>
</a>
</div>
<div class="fr" style="width: 49%;">
<a class="btn" href="./">
<img width="16" height="16" alt="o" src="/images/icons/cross.png"/>
<span>На главную!</span>
</a>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>';
}elseif(isset($_GET['msclub_user_link']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_cuser` WHERE `type` = '".num($user['msclub'])."'"),0)!=0){
echo '<div>
<div class="feedbackPanel">
<div class="whiteLink">Пользователи</div>
</div></div>';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_cuser` WHERE `type` = '".$user['msclub']."' ORDER BY `rating` DESC"),0);
if ($k_post==0)
{
echo '<div>
<div class="feedbackPanel">
<div class="whiteLink">Пользователей нет</div>
</div></div>';
}
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
$start=$user['set']*$page-$user['set'];
$q=mysql_query("SELECT * FROM `mystyle_cuser` WHERE `type` = '".$user['msclub']."' ORDER BY `rating` DESC LIMIT $start, $user[set]");
while($post=mysql_fetch_array($q))
{
echo '<div class="btn">';
echo '<a class="fr btnp" href="./?msclub&mscuserinfo='.$post['user'].'" title="">Инфо.</a>';
echo users($post['user']);
echo '</div><div style="clear: both;"></div>';
}
if ($k_page>1)str("./?msclub&msclub_user_link&",$k_page,$page);
echo '<div>
<div class="feedbackPanel"><div style="text-align: center;">
<div class="fl" style="width: 49%;">
<a class="btn" href="?msclub">
<img width="16" height="16" alt="o" src="/images/icons/tick.png"/>
<span>В клан!</span>
</a>
</div>
<div class="fr" style="width: 49%;">
<a class="btn" href="./">
<img width="16" height="16" alt="o" src="/images/icons/cross.png"/>
<span>На главную!</span>
</a>
</div>
<div style="clear: both;"></div>
</div>
</div></div>';
}elseif(isset($_GET['msclub_user_reg_ok']) && num($_GET['msclub_user_reg_ok'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_club_reg_user` WHERE `id` = '".num($_GET['msclub_user_reg_ok'])."'"),0) && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_club` WHERE `id` = '".num($user['msclub'])."'"),0)!=0){
$post = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_club_reg_user` WHERE `type` = '".num($user['msclub'])."'"));
$msclub = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_club` WHERE `user` = '".$user['id']."' AND `id` = '".num($user['msclub'])."'"));
if($msclub['admin'] == $user['id']){
mysql_query("UPDATE `mystyle_user` SET `msclub` = '".num($user['msclub'])."' WHERE `id` = '".num($post['user'])."'");
mysql_query("INSERT INTO `mystyle_cuser` SET `type` = '".num($user['msclub'])."', `user` = '".$post['user']."'");
mysql_query("DELETE FROM `mystyle_club_reg_user` WHERE `user` = '".$post['user']."' LIMIT 1");
$msg = 'Доброго Вам времени суток!
Мы приняли вас в наш клан. Спасибо за ваш выбор.';
mysql_query("INSERT INTO `mystyle_mail` SET `id_user` = '".$post['user']."', `id_kont` = '".$user['id']."', `msg` = '".my_esc($msg)."', `time` = '$time', `type` = 'to'");
mysql_query("INSERT INTO `mystyle_mail` SET `id_user` = '".$user['id']."', `id_kont` = '".$post['user']."', `msg` = '".my_esc($msg)."', `time` = '$time', `type` = 'at', `read` = '1'");
$msg = 'Вступил в наш клан.';
mysql_query("INSERT INTO `mystyle_clog` SET `club` = '".num($user['msclub'])."', `msg` = '".$msg."', `user` = '".$post['user']."', `time` = '".$time."'");
$text = 'Выполнено!';
$_SESSION['msg'] = $text;
header("Location: ./?msclub");
exit;
}else{
$text = 'Вы не админ клана!';
$_SESSION['msg'] = $text;
header("Location: ./");
exit;
}
}elseif(isset($_GET['msreglooc']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_club_reg_user` WHERE `type` = '".num($user['msclub'])."'"),0)!=0){
$post = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_club_reg_user` WHERE `type` = '".num($user['msclub'])."'"));
$msclub = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_club` WHERE `user` = '".$user['id']."' AND `id` = '".num($user['msclub'])."'"));
if($msclub['admin'] == $user['id']){
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_club_reg_user` WHERE `type` = '".$user['msclub']."'"),0);
if ($k_post==0)
{
echo '<div>
<div class="feedbackPanel">
<div class="whiteLink">Заявок нет!</div>
<div style="text-align: center;">
<div class="fl" style="width: 49%;">
<a class="btn" href="?msclub">
<img width="16" height="16" alt="o" src="/images/icons/tick.png"/>
<span>В клан!</span>
</a>
</div>
<div class="fr" style="width: 49%;">
<a class="btn" href="./">
<img width="16" height="16" alt="o" src="/images/icons/cross.png"/>
<span>На главную!</span>
</a>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>';
}
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
$start=$user['set']*$page-$user['set'];
$q=mysql_query("SELECT * FROM `mystyle_club_reg_user` WHERE `type` = '".$user['msclub']."' ORDER BY `id` DESC LIMIT $start, $user[set]");
while($post=mysql_fetch_array($q))
{
echo '<div class="btn">';
echo users($post['user']);
echo ' <a href="./?msclub&msclub_user_reg_ok='.$post['id'].'" class="btnp">Принять</a> <a href="" class="btnp">Отказать</a></div>';
}
if ($k_page>1)str("?",$k_page,$page);
}else{
$text = 'Вы не админ клана!';
$_SESSION['msg'] = $text;
header("Location: ./");
exit;
}
}elseif(isset($_GET['msclub_user']) && num($_GET['msclub_user'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_club` WHERE `id` = '".num($_GET['msclub_user'])."'"),0)!=0){
$post = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_cuser` WHERE `type` = '".num($_GET['msclub_user'])."'"));
$post_y = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_club_reg_user` WHERE `user` = '".num($user['id'])."'"));
if($post_y['user']){
$text = 'Вы уже подали заявку.';
$_SESSION['msg'] = $text;
header("Location: ./?msclan");
exit;
}elseif($user['msclub']){
$text = 'Вы уже есть в клане! Чтобы вступить в новый выйдите из предыдущего.';
$_SESSION['msg'] = $text;
header("Location: ./?msclan");
exit;
}elseif($post['user'] == $user['id']){
$text = 'Вы уже есть в этом клане!';
$_SESSION['msg'] = $text;
header("Location: ./?msclan");
exit;
}else{
mysql_query("INSERT INTO `mystyle_club_reg_user` SET `type` = '".num($_GET['msclub_user'])."', `user` = '".$user['id']."'");
$text = 'Заявка на поступление подана';
$_SESSION['msg'] = $text;
header("Location: ./?msclan");
exit;
}
}elseif(isset($_GET['msforum_room']) && num($_GET['msforum_room'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_cforum` WHERE `id` = '".num($_GET['msforum_room'])."' AND `alt` = '".$user['msclub']."'"),0)!=0){
$admin = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_club` WHERE `id` = '".num($user['msclub'])."'"));
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_cforum` WHERE `room` = '".num($_GET['msforum_room'])."' AND `alt` = '".$user['msclub']."'"),0);
if ($k_post==0)
{
echo '<div>
<div class="feedbackPanel">
<div class="whiteLink">На форуме пусто!</div>
<div style="text-align: center;">
<div class="fl" style="width: 49%;">
<a class="btn" href="?msclub">
<img width="16" height="16" alt="o" src="/images/icons/tick.png"/>
<span>В клан!</span>
</a>
</div>
<div class="fr" style="width: 49%;">
<a class="btn" href="./">
<img width="16" height="16" alt="o" src="/images/icons/cross.png"/>
<span>На главную!</span>
</a>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>';
}
if(isset($_GET['name'])){
if(isset($_POST['name']))
{
$name = my_esc($_POST['name']);
if(!preg_match("#^([A-zА-я0-9-_ ])+$#ui", $name))err_game('В тексте присутствуют запрещенные символы');
elseif (preg_match("#[a-z]+#ui", $name) && preg_match("#[а-я]+#ui", $name))err_game('Разрешается использовать символы только русского или только английского алфавита');
elseif (preg_match("#(^ )|( $)#ui", $name))err_game('Запрещено использовать пробел в начале и конце текста');
elseif (strlen2($name)<2)err_game('Короткий текст');
elseif (strlen2($name)>32)err_game('Длина текста превышает 32 символа');
else
{
mysql_query("INSERT INTO `mystyle_cforum` SET `time` = '".$time."', `msg` = '".$name."', `alt`= '".$user['msclub']."', `room` = '".num($_GET['msforum_room'])."', `user` = '".$user['id']."'");
header("Location: ./?msclub&msforum_room=".num($_GET['msforum_room'])."");
exit;
}
}
echo '<div class="emptyPanel">';
echo '<form method="post" id="id1"><div style="width:0px;height:0px;position:absolute;left:-100px;top:-100px;overflow:hidden"></div>';
echo '<div class="pt12"><label for="pass">Введите текст:</div>
<div><input class="btnp" type="name" id="nick" value="" name="name"/></div>
<div class="pt12"><input type="submit" value="Готово!" class="btn bold" style="width: 100%; font-size: 16px;"/></div>
</form></div></div>';
}
echo '<a class="btn" href="?msclub&msforum_room='.num($_GET['msforum_room']).'&name">Написать</a>';
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
$start=$user['set']*$page-$user['set'];
$q=mysql_query("SELECT * FROM `mystyle_cforum` WHERE `room` = '".num($_GET['msforum_room'])."' AND `alt` = '".$user['msclub']."' ORDER BY `id` DESC LIMIT $start, $user[set]");
while($post=mysql_fetch_array($q))
{
echo '<div class="btn">';
echo users($post['user']);
echo ' | '.vremja($post['time']).'<br />';
if($post['msg']){
echo mat(smile(bbcode(check($post['msg']))));
}else{
echo 'Текста не существует';
}
echo '</div>';
}
if ($k_page>1)str("?msforum&",$k_page,$page);
echo '<div>
<div class="feedbackPanel">
<div style="text-align: center;">
<div class="fl" style="width: 49%;">
<a class="btn" href="?msclub">
<img width="16" height="16" alt="o" src="/images/icons/tick.png"/>
<span>В клан!</span>
</a>
</div>
<div class="fr" style="width: 49%;">
<a class="btn" href="./">
<img width="16" height="16" alt="o" src="/images/icons/cross.png"/>
<span>На главную!</span>
</a>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>';
}elseif(isset($_GET['msforum']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_cforum` WHERE `type` = '".num($user['msclub'])."'"),0)!=0){
$admin = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_club` WHERE `id` = '".num($user['msclub'])."'"));
if(isset($_GET['name']) && $admin['admin'] == $user['id']){
if(isset($_POST['name']))
{
$name = my_esc($_POST['name']);
if(!preg_match("#^([A-zА-я0-9-_ ])+$#ui", $name))err_game('В названии присутствуют запрещенные символы');
elseif (preg_match("#[a-z]+#ui", $name) && preg_match("#[а-я]+#ui", $name))err_game('Разрешается использовать символы только русского или только английского алфавита');
elseif (preg_match("#(^ )|( $)#ui", $name))err_game('Запрещено использовать пробел в начале и конце названия');
elseif (strlen2($name)<2)err_game('Короткое название');
elseif (strlen2($name)>32)err_game('Длина названия превышает 32 символа');
else
{
mysql_query("INSERT INTO `mystyle_cforum` SET `type` = '".$user['msclub']."', `alt` = '".$user['msclub']."', `name` = '".$name."'");
header("Location: ./?msclub&msforum");
exit;
}
}
echo '<div class="emptyPanel">';
echo '<h1 class="body">Создание комнаты:</h1>';
echo '<form method="post" id="id1"><div style="width:0px;height:0px;position:absolute;left:-100px;top:-100px;overflow:hidden"></div>';
echo '<div class="pt12"><label for="pass">Введите название:</div>
<div><input class="btnp" type="name" id="nick" value="" name="name"/></div>
<div class="pt12"><input type="submit" value="Готово!" class="btn bold" style="width: 100%; font-size: 16px;"/></div>
</form></div></div>';
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_cforum` WHERE `alt` = '".$user['msclub']."' AND `type` = '".$user['msclub']."'"),0);
if ($k_post==0)
{
echo '<div>
<div class="feedbackPanel">
<div class="whiteLink">На форуме пусто!</div>
<div style="text-align: center;">
<div class="fl" style="width: 49%;">
<a class="btn" href="?msclub">
<img width="16" height="16" alt="o" src="/images/icons/tick.png"/>
<span>В клан!</span>
</a>
</div>
<div class="fr" style="width: 49%;">
<a class="btn" href="./">
<img width="16" height="16" alt="o" src="/images/icons/cross.png"/>
<span>На главную!</span>
</a>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>';
}
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
$start=$user['set']*$page-$user['set'];
$q=mysql_query("SELECT * FROM `mystyle_cforum` WHERE `alt` = '".$user['msclub']."' AND `type` = '".$user['msclub']."' LIMIT $start, $user[set]");
while($post=mysql_fetch_array($q))
{
echo '<a href="./?msclub&msforum_room='.$post['id'].'" class="btn" title=""><img width="16" height="16" alt="o" src="/images/m_cherep2.png"/>
'.$post['name'].'
('.mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_cforum` WHERE `room` = '".$post['id']."'"), 0).')</a>';
}
if ($k_page>1)str("?msclub&msforum&",$k_page,$page);
if($admin['admin'] == $user['id'])echo '<a href="./?msclub&msforum&name" class="btn" title="">Создать комнату</a>';
echo '<div>
<div class="feedbackPanel">
<div style="text-align: center;">
<div class="fl" style="width: 49%;">
<a class="btn" href="?msclub">
<img width="16" height="16" alt="o" src="/images/icons/tick.png"/>
<span>В клан!</span>
</a>
</div>
<div class="fr" style="width: 49%;">
<a class="btn" href="./">
<img width="16" height="16" alt="o" src="/images/icons/cross.png"/>
<span>На главную!</span>
</a>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>';
}elseif(isset($_GET['msclub']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_club` WHERE `type` = '".num($user['msclub'])."'"),0)<1){
if(isset($_GET['name'])){
if(isset($_POST['name']))
{
$need = 2500;
if($user['ruby']>=$need){
$name = my_esc($_POST['name']);
$msclub_reg = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_club_reg_user` WHERE `user` = '".$user['id']."'"));
if(mysql_num_rows(mysql_query("SELECT * FROM `mystyle_club` WHERE `name`='".$name."'")) != 0)err_game('Это название уже существует');
elseif($msclub_reg['user'])err_game('Вы подали заявку в другой клан.');
elseif(!preg_match("#^([A-zА-я0-9-_ ])+$#ui", $name))err_game('В названии присутствуют запрещенные символы');
elseif (preg_match("#[a-z]+#ui", $name) && preg_match("#[а-я]+#ui", $name))err_game('Разрешается использовать символы только русского или только английского алфавита');
elseif (preg_match("#(^ )|( $)#ui", $name))err_game('Запрещено использовать пробел в начале и конце названия');
elseif (strlen2($name)<2)err_game('Короткое название');
elseif (strlen2($name)>32)err_game('Длина названия превышает 32 символа');
else
{
$baks = $user['ruby']-$need;
mysql_query("INSERT INTO `mystyle_club` SET `admin` = '".$user['id']."', `name` = '".$name."', `user` = '".$user['id']."'");
$reg = mysql_insert_id();
mysql_query("UPDATE `mystyle_club` SET `type` = '".num($reg)."' WHERE `id` = '".num($reg)."'");
mysql_query("INSERT INTO `mystyle_cchat` SET `alt` = '".num($reg)."', `type` = '".num($reg)."', `name` = '".$name."'");
mysql_query("INSERT INTO `mystyle_cforum` SET `alt` = '".num($reg)."', `type` = '".num($reg)."', `name` = '".$name."'");
mysql_query("UPDATE `mystyle_user` SET `msclub` = '".num($reg)."', `ruby` = '".$baks ."' WHERE `id` = '".num($user['id'])."'");
mysql_query("INSERT INTO `mystyle_cuser` SET `type` = '".num($reg)."', `user` = '".$user['id']."', `admin` = '".num(1)."'");
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_cfarm` WHERE `club` = '".num($reg)."'"),0)<9){
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".num($reg)."'");
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".num($reg)."'");
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".num($reg)."'");
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".num($reg)."'");
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".num($reg)."'");
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".num($reg)."'");
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".num($reg)."'");
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".num($reg)."'");
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".num($reg)."'");
}
$text = 'Клан создан';
$_SESSION['msg'] = $text;
header("Location: ./?msclub");
exit;
}
}else{
err_ruby($need-$user['ruby']);
}
}
echo '<div class="emptyPanel">';
echo '<h1 class="body">Создание клана:</h1>';
echo '<form method="post" id="id1"><div style="width:0px;height:0px;position:absolute;left:-100px;top:-100px;overflow:hidden"></div>';
echo '<div class="pt12"><label for="pass">Введите название:</div>
<div><input class="btnp" type="name" id="nick" value="" name="name"/></div>
<div class="pt12"><input type="submit" value="Готово!" class="btn bold" style="width: 100%; font-size: 16px;"/></div>
</form></div></div>';
}else{
echo '<div class="feedbackPanel">Создание клана стоит 2500 зомби баксов!</div>';
echo '<div>
<div class="feedbackPanel">
<div class="whiteLink">Вы уверены?</div>
<div style="text-align: center;">
<div class="fl" style="width: 49%;">
<a class="btn" href="?msclub&msreg&name">
<img width="16" height="16" alt="o" src="/images/icons/tick.png"/>
<span>Подтверждаю!</span>
</a>
</div>
<div class="fr" style="width: 49%;">
<a class="btn" href="./">
<img width="16" height="16" alt="o" src="/images/icons/cross.png"/>
<span>Отказываюсь!</span>
</a>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>';
}
}else{
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_cfarm` WHERE `club` = '".$user['msclub']."'"),0)<9){
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".$user['msclub']."'");
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".$user['msclub']."'");
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".$user['msclub']."'");
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".$user['msclub']."'");
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".$user['msclub']."'");
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".$user['msclub']."'");
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".$user['msclub']."'");
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".$user['msclub']."'");
mysql_query("INSERT INTO `mystyle_cfarm` SET `club` = '".$user['msclub']."'");
}
echo '<div>
<div class="feedbackPanel">
<div class="whiteLink">Клан: '.$msclub['name'].'</div>
<div style="text-align: center;">
<div class="fl" style="width: 49%;">
<a class="btn" href="./?msclub&msforum">
<img width="16" height="16" alt="o" src="/images/icons/tick.png"/>
<span>Форум ('.mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_cforum` WHERE `room` != '0' AND `alt` = '".$user['msclub']."' AND `msg` != ''"), 0).')</span>
</a>
</div>
<div class="fr" style="width: 49%;">
<a class="btn" href="./?msclub&mschat">
<img width="16" height="16" alt="o" src="/images/icons/tick.png"/>
<span>Чат ('.mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_croom` WHERE `alt` = '".$user['msclub']."'"), 0).')</span>
</a>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>';
echo '<div class="modall-indexx"><div><div>
<span class="hidden-phone"> '.check($msclub['status']).' </span>
</div></div></div><div style="clear: both;"></div><br />';
echo '<div class="btn">';
echo 'Уровень: <b class="fr level">'.$msclub['level'].'</b><br /><div style="clear: both;"></div>';
echo 'Зомби баксов: <b class="fr level"><a href="./?msclubbacsadd">Пополнить</a> '.$msclub['ruby'].'</b><br /><div style="clear: both;"></div>';
echo 'Монет: <b class="fr level"><a href="./?msclubmoneyadd">Пополнить</a> '.$msclub['money'].'</b><br /><div style="clear: both;"></div>';
$x = $krs / $level['rating'] * 100;
echo '<div>Опыт: <span class="fr level">'.($msclub['level']<$bigl?"".rating($krs)."/<a class="fr like">".rating($levels['rating'])."":"".rating($msclub['rating'])."").' </a></span><div style="clear: both;"></div></div>';
echo '</div>';
$newsq = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_cnews` WHERE `type` = '".$user['msclub']."' ORDER BY `time` DESC LIMIT 1"));
echo '<a href="./?msnewsclub" class="btn" title="">Новости <span class="fr like">('.vremja($newsq['time']).')</span></a>';
echo '<a href="./?mssunduk" class="btn" title="">Сундук</a>';
echo '<a href="./?msfarm" class="btn" title="">Ферма</a>';
echo '<a href="./?mswarehouse" class="btn" title="">Склад <span class="fr level">('.mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_cwarehouse` WHERE `club` = '".$user['msclub']."'"), 0).')</span></a>';
echo '<a href="./?msclub&msclog" class="btn" title="">Лог зомбяков <span class="fr level">('.mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_clog` WHERE `club` = '".$user['msclub']."'"), 0).')</span></a>';
echo '<a href="./?msclub&msclub_user_link" class="btn" title="">Пользователи <span class="fr level">('.mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_cuser` WHERE `type` = '".$user['msclub']."'"), 0).')</span></a>';
if($club['admin'])echo '<a href="./?msclub&msreglooc" class="btn" title="">Заявки <span class="fr level">('.mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_club_reg_user` WHERE `type` = '".$user['msclub']."'"), 0).')</span></a>';
if($clubuser['admin'] == 1 || $clubuser['admin'] == 2 || $clubuser['admin'] == 3 || $clubuser['admin'] == 4)echo '<a href="./?mspanel" class="btn" title="">Админ панель</a>';
echo '<a href="./?msclub&msclub_exit" class="btn faith" title="">Выход из клана</a>';
}
echo '<div class="feedbackPanel">Клан увеличивает ваш опыт при любом действии на 200%</div>';
?>