Файл: monst/core/pag/group/no_group.php
Строк: 40
<?
if ( !empty($_POST['name']) ) {
if ( $GROUP ) {
g('/main');
}
$name = null_html($_POST['name']);
$err = '';
if ( !empty($user['group_id']) ) {
$err .= $lang['group.php']['error']['in_group'].'<br/>';
}
if ( mb_strlen($name, 'UTF-8') > 30 ) {
$err .= $lang['group.php']['error']['long'].'<br/>';
}
$find = $_group -> findOne(
[
'name' => $name
]
);
if ( $find ) {
$err .= $lang['group.php']['error']['exist'].'<br/>';
}
if ( $err ) {
?>
<div class='error_box'>
<?=$err?>
</div>
<a href='/group'><div class='bt_black'><?=$lang['group.php']['retry']?></div></a>
<?
} else {
$id = new_id('_group');
$_group -> insert(
[
'id' => $id,
'name' => $name,
'leader_id' => $user['id'],
'data' => [
'1' => $user['id'],
],
'dungeon_count' => 0,
'dungeon_cooldown' => [],
]
);
$_users -> update(
[
'id' => $user['id']
],
[
'$set' => [
'group_id' => $id
]
]
);
g('/group');
}
}
?>
<div style='text-align: center;'>
<form method='post' action='/group'>
<?=$lang['group.php']['name']?>:<br/>
<input name='name'/><br/>
<input type='submit' value='<?=$lang['group.php']['submit']['create']?>'/>
</form>
</div>
<?