2018-01-28 16:40:49 +00:00
< ? php
ob_start ( " ob_gzhandler " );
2018-03-03 11:50:13 +00:00
session_start ();
if ( $_SESSION [ 'uid' ] == null ) header ( " Location: index.php " );
include_once 'config.php' ;
include_once 'functions.php' ;
2018-03-03 12:29:30 +00:00
if ( ! $user [ 'klan' ]) {
2018-03-03 11:50:13 +00:00
die ( err ( 'Вы не состоите в клане!' ));
}
$klan = db :: c () -> query ( 'SELECT * FROM `clans` WHERE `id` = ?i' , $u -> i ()[ 'klan' ]) -> fetch_assoc ();
2018-03-03 12:29:30 +00:00
$polno = [];
2018-03-03 11:50:13 +00:00
$polno = unserialize ( $klan [ 'vozm' ]);
2018-01-28 16:40:49 +00:00
?>
2018-03-03 11:50:13 +00:00
<! doctype html >
< html >
< head >
< link rel = stylesheet href = " css/main.css " >
< meta charset = " utf-8 " >
< script type = " text/javascript " >
function show ( ele ) {
var srcElement = document . getElementById ( ele );
if ( srcElement != null ) {
if ( srcElement . style . display == " block " ) {
srcElement . style . display = 'none' ;
}
else {
srcElement . style . display = 'block' ;
}
}
}
2018-01-28 16:40:49 +00:00
2018-03-03 11:50:13 +00:00
var Hint3Name = '' ;
// Заголовок, название скрипта, имя поля с логином
function findlogin ( title , script , name ) {
document . all ( " hint3 " ) . innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: pointer" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
'<form action="' + script + '" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><INPUT TYPE=hidden name=sd4 value="6"><td colspan=2>' +
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT TYPE=text NAME="' + name + '"></TD><TD width=50%><INPUT TYPE="submit" value=" »» "></TD></TR></TABLE></FORM></td></tr></table>' ;
document . all ( " hint3 " ) . style . visibility = " visible " ;
document . all ( " hint3 " ) . style . left = 100 ;
document . all ( " hint3 " ) . style . top = 100 ;
document . all ( name ) . focus ();
Hint3Name = name ;
}
function returned2 ( s ) {
if ( top . oldlocation != '' ) {
top . frames [ 'main' ] . location = top . oldlocation + '?' + s + 'tmp=' + Math . random ();
top . oldlocation = '' ;
}
else {
top . frames [ 'main' ] . location = 'main.php?edit=' + Math . random ()
}
}
function closehint3 () {
document . all ( " hint3 " ) . style . visibility = " hidden " ;
Hint3Name = '' ;
}
</ script >
</ head >
2018-03-03 12:29:30 +00:00
< body >
2018-03-03 11:50:13 +00:00
< div id = hint3 class = ahint ></ div >
2018-01-28 16:40:49 +00:00
< table width = 100 %>
2018-03-03 11:50:13 +00:00
< tr >
< td width = 50 % rowspan = 2 valign = top >
2018-03-03 12:29:30 +00:00
< ? php
2018-03-03 12:55:24 +00:00
$zamok = filter_var ( INPUT_POST , 'zamok' , FILTER_VALIDATE_INT );
2018-03-03 12:29:30 +00:00
$start_zamok = filter_var ( INPUT_POST , 'start_zamok' , FILTER_VALIDATE_INT );
$kr = filter_var ( INPUT_POST , 'kr' , FILTER_VALIDATE_INT );
2018-01-28 16:40:49 +00:00
2018-03-03 12:29:30 +00:00
if ( $zamok ) {
2018-03-03 12:55:24 +00:00
db :: c () -> query ( 'UPDATE `clans` SET `zamok` = ?i WHERE `glava` = ?i' , 1 , $user [ 'id' ]);
echo " Начат с б о р средств на строительство Кланового Замка. " ;
2018-03-03 12:29:30 +00:00
header ( " Location: klan.php " );
}
2018-01-28 16:40:49 +00:00
2018-03-03 12:29:30 +00:00
if ( $kr ) {
2018-03-03 12:55:24 +00:00
$a = filter_var ( INPUT_POST , 'kolv' , FILTER_VALIDATE_INT );
2018-03-03 12:29:30 +00:00
$b = $user [ 'klan' ];
2018-01-28 16:40:49 +00:00
2018-03-03 12:29:30 +00:00
if ( $a > 0 ) {
if ( $user [ 'money' ] >= $a ) {
$cc = mysql_query ( " update `clans` set `zbor`=`zbor`+ $a WHERE `id`=' $b ' " );
mysql_query ( " update `users` set `money`=`money`- $a WHERE `id`= { $user [ 'id' ] } " );
header ( " Location: klan.php " );
} else echo " У В а с не достаточно денег" ;
} else echo " Вы ошиблись с вводом суммы " ;
}
2018-03-03 11:50:13 +00:00
2018-03-03 12:29:30 +00:00
if ( $start_zamok ) {
$b = $user [ 'klan' ];
header ( " Location: klan.php " );
mysql_query ( " update `clans` set `zamok`='2' WHERE `id`=' $b ' " );
2018-03-03 12:55:24 +00:00
// Внезапно, базы такой и нет...
// mysql_query("INSERT INTO `z_clan`(`name_clan` , `hEAD`) VALUES ('''{$USER['KLAN']}','{$user['login']}');");
2018-03-03 12:29:30 +00:00
}
2018-03-03 11:50:13 +00:00
2018-03-03 12:29:30 +00:00
echo '<h3><img src="./i/klan/' , $klan [ 'short' ], '.gif">' , $klan [ 'name' ], ' </ h3 >
2018-03-03 12:55:24 +00:00
Количество рейтинговых очков клана : < b > ', $klan[' rating '], ' </ b >< br > ' ;
2018-03-03 12:29:30 +00:00
if ( $klan [ 'zamok' ] == 2 ) {
2018-03-03 12:55:24 +00:00
echo 'У Вашего клана есть Замок<br><br>' ;
2018-03-03 12:29:30 +00:00
} else {
2018-03-03 12:55:24 +00:00
echo 'У клана пока нет Замка<br><br>' ;
2018-03-03 12:29:30 +00:00
}
if ( $klan [ 'glava' ] == $user [ 'id' ] OR $polno [ $user [ 'id' ]][ 0 ] == 1 OR $polno [ $user [ 'id' ]][ 1 ] == 1 ) {
echo " <form method=post> " ;
if ( $polno [ $user [ 'id' ]][ 0 ] == 1 ) echo ' < INPUT TYPE = " button " onclick = " findlogin( \ 'Принять в клан \ ', \ 'klan.php \ ', \ 'login2 \ '); " value = " Принять в клан " title = " Принять в клан " > ( это вам обойдется в < B > 100 </ B > кр . ) < BR >
2018-01-28 16:40:49 +00:00
< INPUT TYPE = " button " onclick = " findlogin( \ 'Выгнать из клана \ ', \ 'klan.php \ ', \ 'login1 \ '); " value = " Выгнать из клана " title = " Выгнать из клана " > ( это вам обойдется в < B > 30 </ B > кр . ) < BR > ' ;
2018-03-03 12:29:30 +00:00
if ( $klan [ 'glava' ] == $user [ 'id' ]) echo '<INPUT TYPE="button" onclick="findlogin(\'Сменить главу клана\', \'klan.php\', \'login3\');" value="Сменить главу клана" title="Сменить главу клана"> (<b>Вы</b> вправе сложить с себя полномочия, назначив <b>Главой Клана</b> другого персонажа)<BR>' ;
if ( $polno [ $user [ 'id' ]][ 1 ] == 1 OR $klan [ 'glava' ] == $user [ 'id' ]) echo '<INPUT TYPE="button" onclick="findlogin(\'Редактировать статус соклановца\', \'klan.php\', \'login\');" value="Редактировать статус соклановца" title="Редактировать статус соклановца"><BR>' ;
if (( $klan [ 'glava' ] == $user [ 'id' ]) AND ( $klan [ 'zamok' ] == '0' )) {
2018-01-28 16:40:49 +00:00
2018-03-03 12:29:30 +00:00
if ( $klan [ 'rating' ] < '1000000' ) {
2018-03-03 12:55:24 +00:00
echo sprintf ( '[%s/1000000] Недостаточно рейтинга для постройки кланового замка.' , $klan [ 'rating' ]);
2018-03-03 12:29:30 +00:00
} else {
echo '
2018-03-03 12:55:24 +00:00
< form action = " klan.php " method = " POST " >
2018-03-03 13:04:46 +00:00
< button type = " submit " name = " zamok " value = " 1 " > С б о р средств на постройку Замка </ button >
2018-03-03 12:55:24 +00:00
( 25000 кр . ) < BR >
</ FORM > ' ;
2018-01-28 16:40:49 +00:00
}
2018-03-03 12:29:30 +00:00
}
2018-01-28 16:40:49 +00:00
2018-03-03 12:29:30 +00:00
if (( $klan [ 'zbor' ] >= '25000' ) AND ( $klan [ 'zamok' ] == '1' ) AND ( $klan [ 'glava' ] == $user [ 'id' ])) {
echo '
2018-03-03 12:55:24 +00:00
< form action = " klan.php " method = " POST " >
2018-03-03 13:04:46 +00:00
< button type = " submit " name = " start_zamok " value = " 1 " > Построить замок </ button >
2018-03-03 12:55:24 +00:00
( Построить замок на Клановой улице ) < BR >
</ FORM > ' ;
2018-03-03 12:29:30 +00:00
}
2018-03-03 12:55:24 +00:00
2018-03-03 12:29:30 +00:00
if ( $klan [ 'rating' ] >= '1000000' AND $klan [ 'zamok' ] == '1' ) {
$ex = $klan [ 'zbor' ];
2018-03-03 12:55:24 +00:00
echo " С б о р средств на постройку кланового замка: $ex кр./25000 кр.<BR> " ;
echo '
< FORM action = " klan.php " method = " POST " >
< input name = " kolv " size = " 10 " >
2018-03-03 13:04:46 +00:00
< button type = " submit " name = " kr " value = " 1 " > Пожертвовать </ button >
2018-03-03 12:55:24 +00:00
</ FORM > ' ;
2018-03-03 12:29:30 +00:00
}
2018-01-28 16:40:49 +00:00
2018-03-03 12:29:30 +00:00
if ( $_POST [ 'login' ]) {
$sok = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `users` WHERE `klan` = \'' . $klan [ 'id' ] . '\' AND `login` = \'' . $_POST [ 'login' ] . '\' LIMIT 1;' ));
$st = strip_tags ( str_replace ( " < " , " < " , str_replace ( " > " , " > " , $_POST [ 'status' ])), " <B><I><U> " );
if ( $klan [ 'glava' ] == $sok [ 'id' ]) {
$st = " <font color=#008080><b>Глава клана</b></font> " ;
}
if ( $sok ) {
if ( $_POST [ 'save' ]) {
if ( $_POST [ 'vin' ] == 'on' ) {
$polno [ $sok [ 'id' ]][ 0 ] = 1 ;
} else {
$polno [ $sok [ 'id' ]][ 0 ] = 0 ;
}
if ( $_POST [ 'tus' ] == 'on' ) {
$polno [ $sok [ 'id' ]][ 1 ] = 1 ;
} else {
$polno [ $sok [ 'id' ]][ 1 ] = 0 ;
}
$id_checked = mysql_real_escape_string ( $sok [ 'id' ]);
2018-01-28 16:40:49 +00:00
2018-03-03 12:29:30 +00:00
if ( ! mysql_query ( " UPDATE `users` SET `status` = ' { $st } ' WHERE `id` = ' { $id_checked } '; " )) echo ( mysql_error ());
if ( $klan [ 'glava' ] == $user [ 'id' ]) {
mysql_query ( 'UPDATE `clans` SET `vozm` = \'' . serialize ( $polno ) . '\' WHERE `id` = \'' . $klan [ 'id' ] . '\';' );
2018-03-03 11:50:13 +00:00
}
2018-03-03 12:29:30 +00:00
$sok [ 'status' ] = $st ;
}
echo '<BR><fieldset ><legend>Редактирование статуса "' , $sok [ 'login' ], ' " </legend>
2018-03-03 11:50:13 +00:00
Звание в клане < input type = text value = " ', $sok['status'] , ' " name = status >< BR > ' ;
2018-03-03 12:29:30 +00:00
if ( $klan [ 'glava' ] == $user [ 'id' ]) {
echo '<input type=checkbox name=vin ' ;
if ( $polno [ $sok [ 'id' ]][ 0 ] == 1 ) {
echo ' checked ' ;
}
echo ' > Может принимать / выгонять членов клана < BR >
2018-03-03 11:50:13 +00:00
< input type = checkbox name = tus ' ;
2018-03-03 12:29:30 +00:00
if ( $polno [ $sok [ 'id' ]][ 1 ] == 1 ) {
echo ' checked ' ;
2018-03-03 11:50:13 +00:00
}
2018-03-03 12:29:30 +00:00
echo '>Может менять статус членов клана<BR>' ;
2018-03-03 11:50:13 +00:00
}
2018-03-03 12:29:30 +00:00
echo '<input type=hidden value="' , $sok [ 'login' ], '" name=login><input type=submit value="Сохранить" name=save></fieldset>' ;
}
2018-01-28 16:40:49 +00:00
2018-03-03 12:29:30 +00:00
}
if ( $_POST [ 'login3' ] && $klan [ 'glava' ] == $user [ 'id' ]) {
$sok = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `users` WHERE `klan` = \'' . $klan [ 'id' ] . '\' AND `login` = \'' . $_POST [ 'login3' ] . '\' LIMIT 1;' ));
//mysql_query('update `users` set `money` = `money` - 30 WHERE `id` = '.$_SESSION['uid'].';');
//mysql_query('update `users` set `klan` = \'\', `align` = 0 WHERE `id` = '.$sok['id'].';');
mysql_query ( 'update `clans` set `glava` = \'' . $sok [ 'id' ] . '\' WHERE `id` = ' . $klan [ 'id' ] . ';' );
mysql_query ( 'update `users` set `status` = \'<font color=#008080><b>Глава клана</b></font>\' WHERE `id` = ' . $sok [ 'id' ] . ';' );
mysql_query ( 'update `users` set `status` = \'боец\' WHERE `id` = ' . $user [ 'id' ] . ';' );
$klan [ 'glava' ] = $sok [ 'id' ];
}
if ( $_POST [ 'login2' ] && $polno [ $user [ 'id' ]][ 0 ] == 1 ) {
$sok = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `users` WHERE `klan` = \'\' AND `align` = \'0\' AND `login` = \'' . $_POST [ 'login2' ] . '\' LIMIT 1;' ));
$eff = mysql_fetch_array ( mysql_query ( " SELECT * FROM `effects` WHERE `owner` = ' " . $sok [ 'id' ] . " ' AND `type` = 20 LIMIT 1; " ));
if ( ! $eff ) {
echo " Нет проверки! " ;
} elseif ( $sok [ 'level' ] > 0 && $user [ 'money' ] >= 100 ) {
echo 'Персонаж "' , $sok [ 'login' ], '" успешно принят в клан.' ;
mysql_query ( 'update `users` set `money` = `money` - 100 WHERE `id` = ' . $_SESSION [ 'uid' ] . ';' );
mysql_query ( 'update `users` set `status`= \'боец\', `klan` = \'' . $klan [ 'id' ] . '\', `align` = \'' . $klan [ 'align' ] . '\' WHERE `id` = ' . $sok [ 'id' ] . ';' );
} else {
echo " Н е хватает денег, или е г о попросту не существует." ;
2018-03-03 11:50:13 +00:00
}
2018-03-03 12:29:30 +00:00
}
if ( $_POST [ 'login1' ] && $polno [ $user [ 'id' ]][ 0 ] == 1 ) {
$sok = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `users` WHERE `klan` = \'' . $klan [ 'id' ] . '\' AND `login` = \'' . $_POST [ 'login1' ] . '\' LIMIT 1;' ));
if ( $sok && $user [ 'money' ] >= 30 && $klan [ 'glava' ] != $sok [ 'id' ]) {
echo 'Персонаж "' , $sok [ 'login' ], '" покинул клан.' ;
mysql_query ( 'update `users` set `money` = `money` - 30 WHERE `id` = ' . $_SESSION [ 'uid' ] . ';' );
mysql_query ( 'update `users` set `klan` = \'\', `align` = 0 WHERE `id` = ' . $sok [ 'id' ] . ';' );
2018-03-03 11:50:13 +00:00
}
}
2018-03-03 12:29:30 +00:00
} else {
echo 'У вашего клана нет реликтов, или глава клана вам их не предоставил. ;)' ;
}
?>
2018-01-28 16:40:49 +00:00
2018-03-03 11:50:13 +00:00
</ td >
2018-01-28 16:40:49 +00:00
2018-03-03 11:50:13 +00:00
< td align = right >
< INPUT TYPE = " button " onClick = " location.href='main.php'; " value = " Вернуться " title = " Вернуться " >
</ td >
</ tr >
< tr >
< td valign = top >
2018-03-03 12:29:30 +00:00
< h3 >< a href = " javascript:top.AddToPrivate('klan', top.CtrlPress) " target = refreshed >< img src = " i/lock.gif " ></ a >
Соклановцы
</ h3 >
< table bgcolor = #eeeeee>
< tr >
< td >
< ?
$data = mysql_query ( " SELECT `id`, `login`, `status`, `level`, `room`, `align`, (select `id` from `online` WHERE `date` >= " . ( time () - 60 ) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `klan` = ' " . $klan [ 'id' ] . " ' order by online DESC, login asc ; " );
while ( $row = mysql_fetch_array ( $data )) {
if ( $row [ 'online' ] > 0 ) {
echo '<A HREF="javascript:top.AddToPrivate(\'' , nick7 ( $row [ 'id' ]), '\', top.CtrlPress)" target=refreshed><img src="i/lock.gif" width=20 height=15></A>' ;
nick2 ( $row [ 'id' ]);
if ( $row [ 'id' ] == $klan [ 'glava' ]) {
echo ' - <font color=#008080><b>Глава клана</b></font>' ;
} else {
echo ' - ' , $row [ 'status' ], '' ;
}
if ( $row [ 'room' ] > 500 && $row [ 'room' ] < 561 ) {
$rrm = 'Башня смерти, участвует в турнире' ;
} else {
$rrm = $rooms [ $row [ 'room' ]];
2018-03-03 11:50:13 +00:00
}
2018-03-03 12:29:30 +00:00
echo ' - <i>' , $rrm , '</i><BR>' ;
} else if ( $row [ 'online' ] < 1 ) {
echo '<img src="i/lock1.gif" width=20 height=15>' ;
nick2 ( $row [ 'id' ]);
if ( $row [ 'id' ] == $klan [ 'glava' ]) {
echo ' - <font color=#008080><b>Глава клана</b></font>' ;
} else {
echo ' - ' , $row [ 'status' ], '' ;
}
echo ' - <i><small><font color=gray>персонаж не в клубе</font></small></i><BR>' ;
2018-03-03 11:50:13 +00:00
}
2018-03-03 12:29:30 +00:00
}
?>
</ td >
</ tr >
</ table >
2018-03-03 11:50:13 +00:00
</ td >
</ tr >
2018-01-28 16:40:49 +00:00
</ table >
</ body >
</ html >