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' ;
2019-06-20 21:48:46 +00:00
$status = null ;
2018-03-03 17:16:13 +00:00
2018-03-03 12:29:30 +00:00
if ( ! $user [ 'klan' ]) {
2018-03-03 11:50:13 +00:00
die ( err ( 'Вы не состоите в клане!' ));
}
2018-03-03 20:56:05 +00:00
$klan = db :: c () -> query ( 'SELECT * FROM `clans` WHERE `id` = ?i' , $user [ 'klan' ]) -> fetch_assoc ();
2018-03-03 12:29:30 +00:00
$polno = [];
2018-03-03 11:50:13 +00:00
$polno = unserialize ( $klan [ 'vozm' ]);
2019-06-20 21:48:46 +00:00
if ( isset ( $_POST [ 'zamok' ])) {
db :: c () -> query ( 'UPDATE `clans` SET `zamok` = 1 WHERE `glava` = ?i' , $_SESSION [ 'uid' ]);
$status = " Начат с б о р средств на строительство Кланового Замка. " ;
header ( " Location: klan.php " );
}
if ( isset ( $_POST [ 'kr' ]) && ( $_POST [ 'kolv' ] > 0 )) {
if ( $user [ 'money' ] >= $_POST [ 'kolv' ]) {
db :: c () -> query ( 'UPDATE `clans` SET `zbor` = `zbor` + ?i WHERE `id` = ?i' , $_POST [ 'kolv' ], $user [ 'klan' ]);
db :: c () -> query ( 'UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i' , $_POST [ 'kolv' ], $user [ 'id' ]);
header ( " Location: klan.php " );
} else $status = 'Н е хватает денег!' ;
}
2019-06-20 23:37:39 +00:00
if ( ! empty ( $_POST [ 'login' ]) AND $_POST [ 'action' ] == 'add_member' AND $polno [ $user [ 'id' ]][ 0 ] == 1 ) {
$sok = db :: c () -> query ( 'SELECT `id`,`level` FROM `users` WHERE `klan` = "?s" AND `align` = 0 AND `login` = "?s"' , '' , $_POST [ 'login' ]) -> fetch_assoc ();
$proverka = db :: c () -> query ( 'SELECT 1 FROM `effects` WHERE `type` = 20 AND `owner` = ?i' , $sok [ 'id' ]) -> getNumRows ();
if ( ! $proverka ) echo " Нет проверки! " ;
elseif ( $sok [ 'level' ] > 0 && $user [ 'money' ] >= 100 ) {
2019-06-20 23:40:39 +00:00
db :: c () -> query ( 'UPDATE `users` SET `money` = `money` - 100 WHERE `id` = ?i' , $_SESSION [ 'uid' ]);
db :: c () -> query ( 'UPDATE `users` SET `status` = "?s", `klan` = "?s", `align` = ?i WHERE `id` = ?i' , 'Боец' , $klan [ 'id' ], $klan [ 'align' ], $sok [ 'id' ]);
2019-06-21 00:02:15 +00:00
$status = 'Персонаж «' . $_POST [ 'login' ] . '» успешно принят в клан.' ;
2019-06-20 23:37:39 +00:00
} else $status = 'Н е хватает денег, или е г о попросту не существует.' ;
}
2019-06-20 23:55:10 +00:00
if ( ! empty ( $_POST [ 'login' ]) AND $_POST [ 'action' ] == 'remove_member' AND $polno [ $user [ 'id' ]][ 0 ] == 1 ) {
2019-06-20 23:37:39 +00:00
$sok = db :: c () -> query ( 'SELECT `id` FROM `users` WHERE `klan` = "?s" AND `login` = "?s"' , $klan [ 'id' ], $_POST [ 'login' ]) -> fetch_assoc ();
if ( $sok [ 'id' ] != $klan [ 'glava' ] AND $user [ 'money' ] >= 30 ) {
db :: c () -> query ( 'UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i' , $_SESSION [ 'uid' ]);
db :: c () -> query ( 'UPDATE `users` SET `klan` = null, `align` = 0 WHERE `id` = ?i' , $sok [ 'id' ]);
2019-06-21 00:02:15 +00:00
$status = 'Персонаж «' . $_POST [ 'login' ] . '» покинул клан.' ;
2019-06-20 23:37:39 +00:00
}
}
2019-06-20 23:55:10 +00:00
if ( ! empty ( $_POST [ 'login' ]) AND $_POST [ 'action' ] == 'change_owner' AND $klan [ 'glava' ] == $_SESSION [ 'uid' ]) { //смена главы
$sok = db :: c () -> query ( 'SELECT `id` FROM `users` WHERE `klan` = "?s" AND `login` = "?s"' , $klan [ 'id' ], $_POST [ 'login' ]) -> fetch_assoc ();
2019-06-20 23:37:39 +00:00
//mysql_query('update `users` set `money` = `money` - 30 WHERE `id` = '.$_SESSION['uid'].';');
//mysql_query('update `users` set `klan` = \'\', `align` = 0 WHERE `id` = '.$sok['id'].';');
2019-06-20 23:55:10 +00:00
db :: c () -> query ( 'UPDATE `clans` SET `glava` = ?i WHERE `id` = ?i' , $sok [ 'id' ], $klan [ 'id' ]);
db :: c () -> query ( 'UPDATE `users` SET `status` = null WHERE `id` = ?i' , $sok [ 'id' ]);
db :: c () -> query ( 'UPDATE `users` SET `status` = "?s" WHERE `id` = ?i' , 'Боец' , $_SESSION [ 'uid' ]);
2019-06-20 23:37:39 +00:00
$klan [ 'glava' ] = $sok [ 'id' ];
}
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 " >
</ head >
2018-03-03 12:29:30 +00:00
< body >
2019-06-20 21:48:46 +00:00
< div id = hint3 class = ahint >< ? php if ( ! empty ( $status )) err ( $status ); ?> </div>
< table style = " width: 100% " >
2018-03-03 11:50:13 +00:00
< tr >
2019-06-20 21:48:46 +00:00
< td style = " width: 50%; vertical-align: top; " rowspan = 2 >
< h3 >< img src = " ./i/klan/<?= $klan['short'] ?>.gif " >< ? = $klan [ 'name' ] ?> </h3>
Количество рейтинговых очков клана : < b >< ? = $klan [ 'rating' ] ?> </b><br>
2018-03-03 12:29:30 +00:00
< ? php
2019-06-20 21:48:46 +00:00
if ( $klan [ 'zamok' ] == 2 ) echo 'У Вашего клана есть Замок<br><br>' ;
else echo 'У клана пока нет Замка<br><br>' ;
2018-03-03 15:52:28 +00:00
?>
2019-06-21 00:02:15 +00:00
< div >< span id = " add_member " >
2019-06-20 23:37:39 +00:00
< input type = " submit " onclick = " use('add_member') " value = " Принять в клан " >
2019-06-21 00:02:15 +00:00
</ span > ( стоимость услуги : < B > 100 </ B > кр . ) </ div >
< div >< span id = " remove_member " >
2019-06-20 23:37:39 +00:00
< input type = " submit " onclick = " use('remove_member') " value = " Выгнать из клана " >
2019-06-21 00:02:15 +00:00
</ span > ( стоимость услуги : < B > 30 </ B > кр . ) </ div >
< div >< span id = " edit_status " >
2019-06-20 23:37:39 +00:00
< input type = " submit " onclick = " use('edit_status') " value = " Редактировать статус " >
2019-06-21 00:02:15 +00:00
</ span ></ div >
< div >< span id = " change_owner " >
2019-06-20 23:55:10 +00:00
< input type = " submit " onclick = " use('change_owner') " value = " Сменить главу клана " >
2019-06-21 00:02:15 +00:00
</ span > ( сложить с себя полномочия , назначив < b style = " color: teal; " > Главой Клана </ b > другого персонажа ) </ div >
2019-06-20 23:37:39 +00:00
2018-03-03 15:52:28 +00:00
< ? php
2019-06-20 22:05:32 +00:00
if ( ! empty ( $_POST [ 'login' ])) {
$sok = db :: c () -> query ( 'SELECT * FROM `users` WHERE `klan` = "?s" AND `login` = "?s"' , $klan [ 'id' ], $user [ 'id' ]) -> fetch_assoc ();
}
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> " ;
2018-03-03 15:52:28 +00:00
if ( $polno [ $user [ 'id' ]][ 0 ] == 1 ) echo ' < INPUT TYPE = " button " onclick = " findlogin( \ 'Принять в клан \ ', \ 'login2 \ '); " value = " Принять в клан " title = " Принять в клан " > ( это вам обойдется в < B > 100 </ B > кр . ) < BR >
< INPUT TYPE = " button " onclick = " findlogin( \ 'Выгнать из клана \ ', \ 'login1 \ '); " value = " Выгнать из клана " title = " Выгнать из клана " > ( это вам обойдется в < B > 30 </ B > кр . ) < BR > ' ;
if ( $klan [ 'glava' ] == $user [ 'id' ]) echo '<INPUT TYPE="button" onclick="findlogin(\'Сменить главу клана\', \'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(\'Редактировать статус соклановца\', \'login\');" value="Редактировать статус соклановца" title="Редактировать статус соклановца"><BR>' ;
2018-03-03 12:29:30 +00:00
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 13:56:40 +00:00
< form method = " post " >
< button type = " submit " name = " zamok " value = " zamok " > С б о р средств на постройку Замка </ 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' ])) {
2018-03-03 14:14:53 +00:00
err ( 'Сумма собрана, но замки ещё не введены в игру. 🙁' );
2018-03-03 12:29:30 +00:00
}
2018-03-03 12:55:24 +00:00
2018-03-03 15:23:47 +00:00
if ( $klan [ 'rating' ] >= '1000000' AND $klan [ 'zamok' ] == 1 AND $klan [ 'zbor' ] < '25000' ) {
2018-03-03 12:29:30 +00:00
$ex = $klan [ 'zbor' ];
2018-03-03 12:55:24 +00:00
echo " С б о р средств на постройку кланового замка: $ex кр./25000 кр.<BR> " ;
echo '
2018-03-03 13:56:40 +00:00
< FORM method = " post " >
2018-03-03 12:55:24 +00:00
< input name = " kolv " size = " 10 " >
2018-03-03 13:56:40 +00:00
< button type = " submit " name = " kr " value = " kr " > Пожертвовать </ 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
2019-06-20 22:49:26 +00:00
if ( ! empty ( $_POST [ 'login' ]) AND $_POST [ 'action' ] == 'edit_status' ) {
2019-06-20 22:13:43 +00:00
$sok = db :: c () -> query ( 'SELECT `id`, `status` FROM `users` WHERE `klan` = "?s" AND `login` = "?s"' , $klan [ 'id' ], $_POST [ 'login' ]) -> fetch_assoc ();
2019-06-20 22:49:26 +00:00
if ( ! empty ( $_POST [ 'status' ])) {
$st = strip_tags ( str_replace ( " < " , " < " , str_replace ( " > " , " > " , $_POST [ 'status' ])), " <B><I><U> " );
2018-03-03 12:29:30 +00:00
}
2019-06-20 22:49:26 +00:00
if ( $sok AND $sok [ 'id' ] != $klan [ 'glava' ]) {
if ( ! empty ( $_POST [ 'save' ])) {
2018-03-03 12:29:30 +00:00
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 ;
}
2018-01-28 16:40:49 +00:00
2019-06-20 22:05:32 +00:00
db :: c () -> query ( 'UPDATE `users` SET `status` = "?s" WHERE `id` = ?i' , $st , $sok [ 'id' ]);
2018-03-03 12:29:30 +00:00
if ( $klan [ 'glava' ] == $user [ 'id' ]) {
2019-06-20 22:05:32 +00:00
db :: c () -> query ( 'UPDATE `clans` SET `vozm` = "?s" WHERE `id` = ?i' , serialize ( $polno ), $klan [ 'id' ]);
2018-03-03 11:50:13 +00:00
}
2018-03-03 12:29:30 +00:00
$sok [ 'status' ] = $st ;
}
2019-06-20 23:02:30 +00:00
echo '<BR><fieldset ><legend>Редактирование статуса "' , $_POST [ 'login' ], ' " </legend>
2019-06-20 22:49:26 +00:00
Звание в клане < input 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>' ;
2019-06-20 22:49:26 +00:00
} elseif ( $sok [ 'id' ] == $klan [ 'glava' ]) {
2019-06-20 23:02:30 +00:00
echo '<fieldset ><legend>Редактирование статуса "' , $_POST [ 'login' ], ' " </legend>
2019-06-20 22:49:26 +00:00
Звание в клане < input disabled value = " Глава клана " >< BR >
< input type = checkbox disabled checked > Может принимать / выгонять членов клана < br >
< input type = checkbox disabled checked > Может менять статус членов клана < br > ' ;
} else $status = 'Персонаж не найден или не состоит в клане!' ;
2018-01-28 16:40:49 +00:00
2018-03-03 12:29:30 +00:00
}
2019-06-20 23:37:39 +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 >
2019-06-20 23:02:30 +00:00
< h3 > Соклановцы </ h3 >
< ? php
$data = db :: c () -> query ( 'SELECT `id`, `login`, `status`, `level`, `room`, `align`, (select `id` from `online` WHERE `date` >= ?i AND `id` = users.`id`) AS `online` FROM `users` WHERE `klan` = ?i ORDER BY `online` DESC , `login` ASC' , ( time () - 60 ), $klan [ 'id' ]);
while ( $row = $data -> fetch_assoc ()) {
if ( $row [ 'online' ] > 0 ) {
echo '💡 <A HREF="javascript:top.AddToPrivate(\'' , nick :: id ( $row [ 'id' ]) -> short (), '\', top.CtrlPress)" target=refreshed><img src="i/lock.gif" width=20 height=15></A>' ;
echo nick :: id ( $row [ 'id' ]) -> full ();
if ( $row [ 'id' ] == $klan [ 'glava' ]) {
echo ' - <b style="color: #008080;">Глава клана</b>' ;
} else {
echo ' - ' , $row [ 'status' ], '' ;
}
if ( $row [ 'room' ] > 500 && $row [ 'room' ] < 561 ) {
$rrm = 'Башня смерти, участвует в турнире' ;
} else {
$rrm = $rooms [ $row [ 'room' ]];
}
echo ' - <i>' , $rrm , '</i><BR>' ;
} else if ( $row [ 'online' ] < 1 ) {
echo '<div style="background-color: #eee;"><img src="i/lock1.gif" width=20 height=15>' ;
echo nick :: id ( $row [ 'id' ]) -> full ();
if ( $row [ 'id' ] == $klan [ 'glava' ]) {
echo ' - <b style="color: #008080;">Глава клана</b>' ;
} elseif ( ! empty ( $row [ 'status' ])) {
echo ' - ' , $row [ 'status' ], '' ;
}
echo '</div>' ;
}
}
?>
2018-03-03 11:50:13 +00:00
</ td >
</ tr >
2018-01-28 16:40:49 +00:00
</ table >
2019-06-20 21:48:46 +00:00
< script type = " text/javascript " >
function show ( ele ) {
var srcElement = document . getElementById ( ele );
if ( srcElement != null ) {
if ( srcElement . style . display == " block " ) {
srcElement . style . display = 'none' ;
2019-06-20 23:02:30 +00:00
} else {
2019-06-20 21:48:46 +00:00
srcElement . style . display = 'block' ;
}
}
}
var Hint3Name = '' ;
// Заголовок, название скрипта, имя поля с логином
function findlogin ( title , name ) {
document . all ( " hint3 " ) . innerHTML = '<table><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 method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><INPUT TYPE=hidden name=sd4 value="6"><td colspan=2>' +
'Укажите логин персонажа:<small></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 = '' ;
2019-06-20 23:02:30 +00:00
} else {
2019-06-20 21:48:46 +00:00
top . frames [ 'main' ] . location = 'main.php?edit=' + Math . random ()
}
}
function closehint3 () {
document . all ( " hint3 " ) . style . visibility = " hidden " ;
Hint3Name = '' ;
}
function use ( option ) {
2019-06-20 23:57:48 +00:00
document . getElementById ( option ) . innerHTML = " <form method='post'><input placeholder='Имя персонажа' name='login'><button name='action' value=' " + option + " ' type='submit'>Ок</button><button>× </button></form> " ;
2019-06-20 21:48:46 +00:00
}
</ script >
2018-01-28 16:40:49 +00:00
</ body >
</ html >