game/modules_data/_clan_new.php

283 lines
14 KiB
PHP
Raw Normal View History

2022-06-06 21:30:34 +00:00
<?
if(!defined('GAME'))
{
die();
}
$res = mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id` = '".mysql_real_escape_string($u->info['clan'])."' LIMIT 1"));
$cpr = explode('|',$u->info['clan_prava']);
if(isset($_POST['invite']) && ($u->info['clan_prava']=='glava' || $cpr[0]==1))
{
$data = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['logingo'])."'"));
if($u->testAlign( $res['align'] , $data['id'] ) == 0 ) {
2023-01-10 16:29:32 +00:00
echo 'У персонажа стоит ограничение на смену склонности. Вы не можете выдать данную склонность!';
2022-06-06 21:30:34 +00:00
}elseif($data['palpro'] < time()) {
2023-01-10 16:29:32 +00:00
echo 'Нельзя принимать в клан без проверки...';
2022-06-06 21:30:34 +00:00
}elseif($data['clan']=='0' && $data['align']=='0') {
$u->insertAlign( $res['align'] , $data['id'] );
mysql_query("UPDATE `users` SET `align` = '".$res['align']."',`clan` = '".(int)$u->info['clan']."' WHERE `login` = '".mysql_real_escape_string($_POST['logingo'])."';");
if($res['money1']>=100)
{
$res['money1'] -= 100;
mysql_query("UPDATE `clan` SET `money1` = `money1` - 100 WHERE `id` = '".$res['id']."'");
}else{
mysql_query("UPDATE `users` SET `money` = `money` - 100 WHERE `id` = '".$u->info['id']."'");
}
}else{
2023-01-10 16:29:32 +00:00
echo 'Не выйдет...';
2022-06-06 21:30:34 +00:00
}
}
if(isset($_POST['dissmis']) && ($u->info['clan_prava']=='glava' || $cpr[1]==1))
{
$data = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['logingo'])."'"));
if($data['clan']==$u->info['clan'] && $data['clan_prava']!='glava') {
$u->deleteAlign( $data['align'] , $data['id'] );
mysql_query("UPDATE `users` SET `clan` = '0',`align` = '0',`mod_zvanie` = '' WHERE `login` = '".mysql_real_escape_string($_POST['logingo'])."';");
if($res['money1']>=30)
{
$res['money1'] -= 30;
mysql_query("UPDATE `clan` SET `money1` = `money1` - 30 WHERE `id` = '".$res['id']."'");
}else{
mysql_query("UPDATE `users` SET `money` = `money` - 30 WHERE `id` = '".$u->info['id']."'");
}
}else{
2023-01-10 16:29:32 +00:00
echo 'Не выйдет...';
2022-06-06 21:30:34 +00:00
}
}
if(isset($_POST['rang']) && ($u->info['clan_prava']=='glava' || $cpr[2]==1))
{
$data = mysql_fetch_array(mysql_query("SELECT `clan_prava`,`clan` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['logingo'])."'"));
if($data['clan']==$u->info['clan'] && $data['clan_prava']!='glava') {
mysql_query("UPDATE `users` SET `mod_zvanie` = '".mysql_real_escape_string($_POST['rang'])."' WHERE `login` = '".mysql_real_escape_string($_POST['logingo'])."';");
}else{
2023-01-10 16:29:32 +00:00
echo 'Не выйдет...';
2022-06-06 21:30:34 +00:00
}
}
if(isset($_POST['persedit']) && ($u->info['clan_prava']=='glava' || $cpr[2]==1)) {
$data = mysql_fetch_array(mysql_query("SELECT `clan` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['logingo'])."';"));
if($data['clan']==$u->info['clan']) {
$edit=1;
$prava = mysql_fetch_array(mysql_query("SELECT `clan_prava`,`mod_zvanie` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['logingo'])."';"));
$edcpr = explode('|',$prava[0]);
}else{
2023-01-10 16:29:32 +00:00
echo 'Не выйдет...';
2022-06-06 21:30:34 +00:00
}
}
if($_POST['save'] && ($u->info['clan_prava']=='glava' || $cpr[2]==1)) {
$st = strip_tags($_POST['status']);
/*
$st = str_replace('<scr>','<script>',$st);
$st = str_replace('</scr>','</script>',$st);
*/
if ($_POST['priem']=='on') { $ecpr[0]=1; } else { $ecpr[0]=0;}
if ($_POST['vigon']=='on') { $ecpr[1]=1; } else { $ecpr[1]=0;}
if ($_POST['editpriv']=='on') { $ecpr[2]=1; } else { $ecpr[2]=0;}
if ($_POST['givekazna']=='on') { $ecpr[3]=1; } else { $ecpr[3]=0;}
if ($_POST['usekazna']=='on') { $ecpr[4]=1; } else { $ecpr[4]=0;}
$igogo = implode('|',$ecpr);
mysql_query("UPDATE `users` SET `mod_zvanie` = '".mysql_real_escape_string($st)."' WHERE `login` = '".mysql_real_escape_string($_POST['login'])."' AND `clan` = '".mysql_real_escape_string($res['id'])."' ORDER BY `id` ASC LIMIT 1");
$prava['mod_zvanie'] = $st;
if ($cpr[2]==1 || $u->info['clan_prava']=='glava') {
mysql_query("UPDATE `users` SET `clan_prava` = '".$igogo."' WHERE `login` = '".mysql_real_escape_string($_POST['login'])."' AND `clan` = '".mysql_real_escape_string($res['id'])."' AND `clan_prava` != 'glava' ORDER BY `id` ASC LIMIT 1");
2023-01-10 16:29:32 +00:00
echo 'Права успешно изменены.';
2022-06-06 21:30:34 +00:00
}
}
if($_POST['igogo'] && $_POST['lojit'] && ($u->info['clan_prava']=='glava' || $cpr[3]==1) ) {
$_POST['igogo'] = round($_POST['igogo'],2);
2023-01-10 16:29:32 +00:00
if($_POST['igogo']<0 OR $_POST['igogo']>$u->info['money']){echo'не-а';}else{
if(mysql_query("UPDATE `clan` SET `money1` = `money1`+'".mysql_real_escape_string($_POST['igogo'])."' WHERE `id` = '".mysql_real_escape_string($u->info['clan'])."';")){echo'Успешно';
2022-06-06 21:30:34 +00:00
mysql_query("UPDATE `users` SET `money`=`money`-'".mysql_real_escape_string($_POST['igogo'])."' WHERE `id` = '".mysql_real_escape_string($u->info['id'])."'");
2023-01-10 16:29:32 +00:00
$u->addDelo(1,$u->info['id'],'&quot;<font color=#C65F00>Clan'.$u->info['clan'].'.'.$u->info['city'].'</font>&quot;: Положено <b>'.mysql_real_escape_string($_POST['igogo']).'</b> кр. в казну клана',time(),$u->info['city'],'Clan'.$u->info['clan'].'.'.$u->info['city'].'',0,0);
}else{echo'Что-то не так...';}
2022-06-06 21:30:34 +00:00
$res['money1']+=$_POST['igogo'];
}
}
if($_POST['igogo'] && $_POST['zabrat'] && ($u->info['clan_prava']=='glava' || $cpr[4]==1)) {
$_POST['igogo'] = round($_POST['igogo'],2);
2023-01-10 16:29:32 +00:00
if($_POST['igogo']<0){echo'не-а';}else{
if($res['money1']<$_POST['igogo']){echo'не-а';}else{
if(mysql_query("UPDATE `clan` SET `money1` = `money1`-'".mysql_real_escape_string($_POST['igogo'])."' WHERE `id` = '".mysql_real_escape_string($u->info['clan'])."';")){echo'Успешно';
2022-06-06 21:30:34 +00:00
mysql_query("UPDATE `users` SET `money`=`money`+'".mysql_real_escape_string($_POST['igogo'])."' WHERE `id` = '".mysql_real_escape_string($u->info['id'])."'");
2023-01-10 16:29:32 +00:00
$u->addDelo(1,$u->info['id'],'&quot;<font color=#C65F00>Clan'.$u->info['clan'].'.'.$u->info['city'].'</font>&quot;: Взято <b>'.mysql_real_escape_string($_POST['igogo']).'</b> кр. из казны клана',time(),$u->info['city'],'Clan'.$u->info['clan'].'.'.$u->info['city'].'',0,0);
}else{echo'Что-то не так...';}
2022-06-06 21:30:34 +00:00
$res['money1']-=$_POST['igogo'];
}
}
}
?>
<body style="margin:10px; margin-top:5px;" bgcolor=e2e0e0>
<style>
.modpow {
background-color:#ddd5bf;
}
.mt {
background-color:#b1a993;
padding-left:10px;
padding-right:10px;
padding-top:5px;
padding-bottom:5px;
}
.md {
padding:10px;
}
</style>
<script>
function openMod(title,dat)
{
var d = document.getElementById('useMagic');
if(d!=undefined)
{
2023-01-10 16:29:32 +00:00
document.getElementById('modtitle').innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top">'+title+'</td><td width="30" valign="top"><div align="right"><a title="Закрыть окно" onClick="closeMod(); return false;" href="#">x</a></div></td></tr></table>';
2022-06-06 21:30:34 +00:00
document.getElementById('moddata').innerHTML = dat;
d.style.display = '';
}
}
function closeMod()
{
var d = document.getElementById('useMagic');
if(d!=undefined)
{
document.getElementById('modtitle').innerHTML = '';
document.getElementById('moddata').innerHTML = '';
d.style.display = 'none';
}
}
</script>
<div id="useMagic" style="display:none; position:absolute; border:solid 1px #776f59; left: 50px; top: 186px;" class="modpow">
<div class="mt" id="modtitle"></div><div class="md" id="moddata"></div></div>
<center><h3><img src="https://<?=$c['img']?>/i/align/align<?=$res['align'];?>.gif"> <img title="<?=$res['name'];?>" src="https://<?=$c['img']?>/i/clan/<?=$res['name_mini'];?>.gif"> <?=$res['name'];?></h3></center>
2023-01-10 16:29:32 +00:00
<input style="float:right;margin:1px" type="button" value="Вернуться" onClick="document.location='main.php'"><input style="float:right;margin:1px" type="button" value="Обновить" onClick="document.location='main.php?clan&rnd=<?=$code;?>'"><br>
2022-06-06 21:30:34 +00:00
<TABLE width="100%" cellpadding="5" cellspacing="10">
<TR><TD valign=top>
2023-01-10 16:29:32 +00:00
<small>Казна клана: <b><span style="color:green"><?=round($res['money1']);?></span> кр.</b></small>
2022-06-06 21:30:34 +00:00
<form method=post>
<input type=text value="0.00" style='width:40px;' name=igogo>
<?if($cpr[3]==1 || $u->info['clan_prava']=='glava'){?>
2023-01-10 16:29:32 +00:00
<input type=submit value="Положить" name=lojit>
2022-06-06 21:30:34 +00:00
<?}if($cpr[4]==1 || $u->info['clan_prava']=='glava'){?>
2023-01-10 16:29:32 +00:00
<input type=submit value="Забрать" name=zabrat>
2022-06-06 21:30:34 +00:00
<?}?>
</form>
<br><br>
2023-03-31 16:54:33 +00:00
<?php if($u->info['clan_prava'] == 'glava' || $cpr[0]==1) { ?>
<input type="button" style="width:144px;" value="Принять в клан" onClick="openMod('<b>Введите логин</b>','<form action=\'main.php?clan=1&usemod=<?= $code; ?>\' method=\'post\'>Логин: <input type=\'text\' style=\'width:144px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'Принять\'></form>');">
2023-01-10 16:29:32 +00:00
(Это обойдется вам в <b>100 кр.</b>)<br>
<small>(Перед приемом в клан,персонаж должен пройти проверку у паладинов)</small><br>
2023-03-31 16:54:33 +00:00
<?php } if($u->info['clan_prava'] == 'glava' || $cpr[1]==1) { ?>
<input type="button" style="width:144px;" value="Выгнать из клана" onClick="openMod('<b>Введите логин</b>','<form action=\'main.php?clan=1&usemod=<?= $code; ?>\' method=\'post\'>Логин: <input type=\'text\' style=\'width:144px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'dissmis\' value=\'Выгнать\'></form>');">
2023-01-10 16:29:32 +00:00
(Это обойдется вам в <b>30 кр.</b>)<br>
2023-03-31 16:54:33 +00:00
<?php } if($u->info['clan_prava'] == 'glava' || $cpr[2]==1) { ?>
<!--<input type="button" style="width:144px;" value="Редактировать права" onClick="openMod('<b>Введите логин</b>','<form action=\'main.php?clan=1&usemod=<?= $code; ?>\' method=\'post\'>Логин: &nbsp;<input type=\'text\' style=\'width:144px;\' id=\'logingo\' name=\'logingo\'><br>Звание: <input type=\'text\' style=\'width:144px;\' id=\'rang\' name=\'rang\'><br> <input style=\'float:right;\' type=\'submit\' name=\'rerang\' value=\'Сменить звание\'></form>');"><br>-->
<input type="button" style="width:144px;" value="Редактировать" onClick="openMod('<b>Введите логин</b>','<form action=\'main.php?clan=1&usemod=<?= $code; ?>\' method=\'post\'>Логин: <input type=\'text\' style=\'width:144px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'persedit\' value=\'Редактировать\'></form>');"><br><br><br>
<?php } ?>
2022-06-06 21:30:34 +00:00
<?
if($edit==1){
echo'
<form method=post>
Редактирование прав <b>'.htmlspecialchars($_POST['logingo'],NULL).'</b><br>
2023-01-10 16:29:32 +00:00
Звание в клане <input type=text value="',$prava['mod_zvanie'],'" name=status><BR>
<input type=checkbox name=priem';if ($edcpr[0]==1) { echo ' checked ';} echo'>Прием в клан<BR>
<input type=checkbox name=vigon';if ($edcpr[1]==1) { echo ' checked ';} echo'>Изгнание из клана<BR>
<input type=checkbox name=editpriv';if ($edcpr[2]==1) { echo ' checked ';} echo'>Редактирование прав<BR>
<input type=checkbox name=givekazna';if ($edcpr[3]==1) { echo ' checked ';} echo'>Пополнение казны клана<BR>
<input type=checkbox name=usekazna';if ($edcpr[4]==1) { echo ' checked ';} echo'>Использование казны клана<BR>
<input type=hidden value="'.htmlspecialchars($_POST['logingo'],NULL).'" name=login><input type=submit value="Сохранить" name=save>
2022-06-06 21:30:34 +00:00
</form>';
}
?>
</TD><TD valign=top align=right>
<TABLE cellspacing=0 cellpadding=2 width="300"><TR><TD>
<center>
2023-01-10 16:29:32 +00:00
<h4><a href="javascript:void(0)" onClick="top.chat.addto('klan','private')"><IMG border=0 SRC=https://<?=$c['img']?>/i/lock.gif WIDTH=20 HEIGHT=15 ALT="Приватно"></a> Соклановцы</H4>
2022-06-06 21:30:34 +00:00
<table bgcolor=#eeeeee>
<tr>
<td align=left>
<?
$res1 = mysql_query("SELECT `login`,`id`,`align`,`level`,`mod_zvanie`,`online`,`clan_prava` FROM `users` WHERE `clan` = '".mysql_real_escape_string($u->info['clan'])."' ORDER BY `online` DESC");
while($data = mysql_fetch_array($res1)) {
if ($data['online']>time()-120) {
echo '<A href="javascript:void(0)" onClick="top.chat.addto(\''.$data['login'].'\',\'private\')"><img src="https://'.$c['img'].'/i/lock.gif" width=20 height=15></A>
2023-01-10 16:29:32 +00:00
<img title="'.$res['name'].'" src="https://'.$c['img'].'/i/clan/'.$res['name_mini'].'.gif"><b>'.$data['login'].'</b> ['.$data['level'].']<a href="info/'.$data['id'].'" target="_blank"><img title="Инф. о '.$data['login'].'" src="https://'.$c['img'].'/i/inf_capitalcity.gif"></a>';
2022-06-06 21:30:34 +00:00
if ($data['clan_prava'] == 'glava') {
2023-01-10 16:29:32 +00:00
echo ' - <b>Глава клана</b>';
2022-06-06 21:30:34 +00:00
} else {
echo ' - ',$data['mod_zvanie'],'';
}
echo '<BR>';
}
elseif ($data['online']<time()-120) {
echo '<img src="https://'.$c['img'].'/i/offline.gif" width=20 height=15>
2023-01-10 16:29:32 +00:00
<img title="'.$res['name'].'" src="https://'.$c['img'].'/i/clan/'.$res['name_mini'].'.gif"><font color=grey><b>'.$data['login'].'</b> ['.$data['level'].']<a href="info/'.$data['id'].'" target="_blank"><img title="Инф. о '.$data['login'].'" src="https://'.$c['img'].'/inf_dis.gif"></a>';
2022-06-06 21:30:34 +00:00
if ($data['clan_prava'] == 'glava') {
2023-01-10 16:29:32 +00:00
echo ' - <b>Глава клана</b>';
2022-06-06 21:30:34 +00:00
} else {
echo ' - ',$data['mod_zvanie'],'</font>';
}
echo '<BR>';
}
2023-01-10 16:29:32 +00:00
//echo '<img title="Свет" src="https://'.$c['img'].'/i/align/align'.$data['align'].'.gif"><img title="'.$res['name'].'" src="https://'.$c['img'].'/i/clan/'.$res['name_mini'].'.gif"><b>'.$data['login'].'</b> ['.$data['level'].']<a href="info/'.$data['id'].'" target="_blank"><img title="Инф. о '.$data['login'].'" src="https://'.$c['img'].'/i/inf_capitalcity.gif"></a> - '.$data['mod_zvanie'].'<br>';
2022-06-06 21:30:34 +00:00
}
?>
</td>
</tr>
</table>
</center>
</TD></TR><TR><TD>
2023-01-10 16:29:32 +00:00
<small>(список обновляется <strike>в полночь</strike> каждый раз)</small>
2022-06-06 21:30:34 +00:00
</TD></TR></TABLE><br />
</TD>
</TR>
</TABLE>
</FORM>
<hr>
</body>