lvl required and premium is not a problem as seen on the picture.
@slawkens
I used
PHP:
<?php
ini_set("display_errors",1);
error_reporting(E_ALL);
//code goes here
?>
To see if there was any errors while I was trying to debug in localhost but I don't have those lines in production, those errors may be an issue but let try to simplify the problem im experiencing using a gif
View attachment 46086
Post automatically merged: May 29, 2020
So putting that
if before the
$action "create" ?
Sorry I kind of missunderstood probably what you meant, can you elaborate a little bit more
Looks like the whole guilds.php is working with that structure
if($action == "something"){}
And once inside that if there's several validations for the logic flow
Spoiler
PHP:
[LIST=1]
[*]if($action == "create") {
[*] $guild_name = trim($_REQUEST['name']);
[*] $leader = $_REQUEST['leader'];
[*] $todo = $_REQUEST['todo'];
[*] $guild_password = trim($_REQUEST['password']);
[*] if(!$logged)
[*] $guild_errors[] = 'You are not logged in. You can\'t create guild.';
[*] if(empty($guild_errors))
[*] {
[*] $account_players = $account_logged->getPlayers();
[*] foreach($account_players as $player)
[*] {
[*] $player_rank = $player->getRank();
[*] if(empty($player_rank))
[*] if($player->getLevel() >= $config['site']['guild_need_level'])
[*] if(!$config['site']['guild_need_pacc'] || $account_logged->isPremium())
[*] $array_of_player_nig[] = $player->getName();
[*] }
[*] }
[*] if(count($array_of_player_nig) == 0)
[*] $guild_errors[] = 'On your account all characters are in guilds or have too low level to create new guild.';
[*] if($todo == "save") {
[*] if(!check_guild_name($guild_name)) {
[*] $guild_errors[] = 'Invalid guild name format.';
[*] }
[*] if(!check_name($leader)) {
[*] $guild_errors[] = 'Invalid character name format.';
[*] }
[*] if(empty($guild_errors)) {
[*] $player = new Player();
[*] $player->find($leader);
[*] if(!$player->isLoaded())
[*] $guild_errors[] = 'Character <b>'.htmlspecialchars($leader).'</b> doesn\'t exist.';
[*] }
[*] if(empty($guild_errors)) {
[*] $guild = new Guild();
[*] $guild->find($guild_name);
[*] if($guild->isLoaded())
[*] $guild_errors[] = 'Guild <b>'.htmlspecialchars($guild_name).'</b> already exist. Select other name.';
[*] }
[*] if(empty($guild_errors)) {
[*] $bad_char = TRUE;
[*] foreach($array_of_player_nig as $nick_from_list)
[*] if($nick_from_list == $player->getName())
[*] $bad_char = FALSE;
[*] if($bad_char)
[*] $guild_errors[] = 'Character <b>'.htmlspecialchars($leader).'</b> isn\'t on your account or is already in guild.';
[*] }
[*] if(empty($guild_errors)) {
[*] if($player->getLevel() < $config['site']['guild_need_level'])
[*] $guild_errors[] = 'Character <b>'.htmlspecialchars($leader).'</b> has too low level. To create guild you need character with level <b>'.$config['site']['guild_need_level'].'</b>.';
[*] if($config['site']['guild_need_pacc'] && !$account_logged->isPremium())
[*] $guild_errors[] = 'Character <b>'.htmlspecialchars($leader).'</b> is on FREE account. To create guild you need PREMIUM account.';
[*] }
[*] if(empty($guild_errors)) {
[*] if (!$account_logged->isValidPassword($guild_password))
[*] $guild_errors[] = 'Wrong password, please check it and try again.';
[*] }
[*] }
[*]
[*] if(!empty($guild_errors)) {
[*] $main_content .= '
[*] <div class="TableContainer" >
[*] <table class="Table1" cellpadding="0" cellspacing="0" >
[*] <div class="CaptionContainer" >
[*] <div class="CaptionInnerContainer" >
[*] <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
[*] <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
[*] <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
[*] <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
[*] <div class="Text" >Error</div>
[*] <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
[*] <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
[*] <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
[*] <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
[*] </div>
[*] </div>
[*] <tr>
[*] <td>
[*] <div class="InnerTableContainer" >
[*] <table style="width:100%;" >
[*] <tr>
[*] <td>';
[*] foreach($guild_errors as $guild_error)
[*] $main_content .= '<p>'.$guild_error.'</p>';
[*] $main_content .= '
[*] </td>
[*] </tr>
[*] </table>
[*] </div>
[*] </td>
[*] </tr>
[*] </table>
[*] </div><BR>
[*] <TABLE BORDER=0 WIDTH=100%>
[*] <TR>
[*] <TD ALIGN=center>
[*] <table border="0" cellspacing="0" cellpadding="0" >
[*] <form action="?subtopic=guilds" method="post" >
[*] <tr>
[*] <td style="border:0px;" >';
[*] if ($logged)
[*] if(count($array_of_player_nig) > 0)
[*] $main_content .= '
[*] <input type="hidden" name=action value=create >';
[*] $main_content .= '
[*] <input type="hidden" name=name value="'.$guild_name.'" >
[*] <input type="hidden" name=leader value="'.$leader.'" >
[*] <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
[*] <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
[*] <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
[*] </div>
[*] </div>
[*] </td>
[*] </tr>
[*] </form>
[*] </table>
[*] </TD>
[*] </TR>
[*] </TABLE>';
[*] } else {
[*] if($todo == "save")
[*] {
[*] $new_guild = new Guild();
[*] $new_guild->setCreationData(time());
[*] $new_guild->setName($guild_name);
[*] $new_guild->setOwner($player);
[*] $new_guild->setDescription('New guild. Leader must edit this text :)');
[*] $new_guild->setGuildLogo('image/gif', Website::getFileContents('./images/guildlogos/default_logo.gif'));
[*]
[*] $new_guild->save();
[*] $ranks = $new_guild->getGuildRanksList(true);
[*] foreach($ranks as $rank)
[*] if($rank->getLevel() == 3)
[*] {
[*] $player->setRank($rank);
[*] $player->save();
[*] }
[*] $main_content .= '
[*] <div class="TableContainer" >
[*] <table class="Table1" cellpadding="0" cellspacing="0" >
[*] <div class="CaptionContainer" >
[*] <div class="CaptionInnerContainer" >
[*] <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
[*] <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
[*] <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
[*] <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
[*] <div class="Text" >Guild Founded!</div>
[*] <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
[*] <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
[*] <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
[*] <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
[*] </div>
[*] </div>
[*] <tr>
[*] <td>
[*] <div class="InnerTableContainer" >
[*] <table style="width:100%;" >
[*] <tr>
[*] <td>You have founded the '.htmlspecialchars($guild_name).'. Now go ahead and invite the first members.</td>
[*] </tr>
[*] </table>
[*] </div>
[*] </td>
[*] </tr>
[*] </table>
[*] </div><br>
[*] <TABLE BORDER=0 WIDTH=100%>
[*] <TR>
[*] <TD ALIGN=center>
[*] <table border="0" cellspacing="0" cellpadding="0" >
[*] <form action="?subtopic=guilds" method="post" >
[*] <tr>
[*] <td style="border:0px;" >
[*] <input type="hidden" name=action value=view >
[*] <input type="hidden" name=GuildName value="'.$guild_name.'" >
[*] <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
[*] <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
[*] <input class="ButtonText" type="image" name="Continue" alt="Continue" src="'.$layout_name.'/images/global/buttons/_sbutton_continue.gif" >
[*] </div>
[*] </div>
[*] </td>
[*] </tr>
[*] </form>
[*] </table>
[*] </TD>
[*] </TR>
[*] </TABLE>';
[*] } else {
[*] #form to create
[*] $main_content .= 'Do you want to found a new guild? none of your characters may hold one of the two highest ranks in any other guild.<BR><BR>Now enter the name of the new guild, specify the name of your character that should become the first leader and confirm with your account password. Then click on "Submit". Note that the first two data cannot be changed later.<BR><BR>';
[*] $main_content .= '
[*] <FORM ACTION="?subtopic=guilds" METHOD="post">
[*] <div class="TableContainer" >
[*] <table class="Table1" cellpadding="0" cellspacing="0" >
[*] <div class="CaptionContainer" >
[*] <div class="CaptionInnerContainer" >
[*] <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
[*] <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
[*] <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
[*] <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
[*] <div class="Text" >Found Guild</div>
[*] <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
[*] <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
[*] <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
[*] <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
[*] </div>
[*] </div>
[*] <tr>
[*] <td>
[*] <div class="InnerTableContainer" >
[*] <table style="width:100%;" >
[*] <TR>
[*] <TD BGCOLOR=#D4C0A1>
[*] <TABLE BORDER=0 CELLPADDING=1>
[*] <TR>
[*] <TD>Guild Name:</TD>
[*] <TD><INPUT NAME="name" VALUE="'.$_REQUEST['name'].'" SIZE=30 MAXLENGTH=29></TD>
[*] </TR>
[*] <TR>
[*] <TD>Leader:</TD>
[*] <TD>
[*] <SELECT NAME="leader">';
[*] if(count($array_of_player_nig) > 0) {
[*] sort($array_of_player_nig);
[*] foreach($array_of_player_nig as $nick)
[*] $main_content .= '<OPTION>'.htmlspecialchars($nick).'</OPTION>';
[*] }
[*] $main_content .= '
[*] </SELECT>
[*] </TD>
[*] </TR>
[*] <TR>
[*] <TD>Password:</TD>
[*] <TD><INPUT TYPE=password NAME="password" SIZE=30 MAXLENGTH=29></TD>
[*] </TR>
[*] </TABLE>
[*] </TD>
[*] </TR>
[*] </table>
[*] </div>
[*] </td>
[*] </tr>
[*] </table>
[*] </div><BR>
[*] <TABLE BORDER=0 WIDTH=100%>
[*] <TR>
[*] <TD ALIGN=center><IMG SRC="'.$layout_name.'/images/global/general/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR></TD>
[*] <TD ALIGN=center>
[*] <table border="0" cellspacing="0" cellpadding="0" >
[*] <form action="?subtopic=guilds" method="post" >
[*] <tr>
[*] <td style="border:0px;" >
[*] <input type="hidden" name="todo" value="save" >
[*] <input type="hidden" name="action" value="create" >
[*] <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
[*] <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
[*] <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
[*] </div>
[*] </div>
[*] </td>
[*] <tr>
[*] </form>
[*] </table>
[*] </TD>
[*] <TD ALIGN=center>
[*] <table border="0" cellspacing="0" cellpadding="0" >
[*] <form action="?subtopic=guilds" method="post" >
[*] <tr>
[*] <td style="border:0px;" >
[*] <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
[*] <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
[*] <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
[*] </div>
[*] </div>
[*] </td>
[*] </tr>
[*] </form>
[*] </table>
[*] </TD>
[*] <TD ALIGN=center><IMG SRC="'.$layout_name.'/images/global/general/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR></TD>
[*] </TR>
[*] </TABLE>';
[*] }
[*] }
[*]}
[/LIST]