Ir para conteúdo
  • Cadastre-se

Suporte [AJUDA] Cobrar Taxa na Venda de Char Site


Posts Recomendados

Salve rapazeada, preciso de ajuda em uma paradinha, minha ideia é o seguinte, já tenho a página de venda de chars no site, porém eu queria que quando o player fosse colocar o char a venda, aparecesse uma mensagem dizendo que ele teria que pagar 50 pontos para colocar, com um botão de confirmar. Alguém manjaria fazer?

script da página:

 

Spoiler
<?PHP
if ($logged) {
    $main_content .= '<center><b><h3>Welcome to our characters market</h3></center></b><br>';
    $main_content .= '<b>NOTE:</b> If you put your character on sale anyone can buy it, you will lose acces to that character and you wont be able to log in with that character until someone buys it, you can also delete your offer by talking to an admin or buying your character back by yourself.<b> When someone buys your character you will get the price in points.</b>';
    $main_content .= '<br>';
    $main_content .= '
        <br>
        <div class="TableContainer">
          <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">Rules to Sell</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>
 
          <table class="Table3" cellpadding="0" cellspacing="0">
             <tbody>
                <tr>
                   <td>
                      <div class="InnerTableContainer">
                         <table style="width:100%;">
                            <tbody>
                               <tr>
                                  <td>
                                     <div class="TableShadowContainerRightTop">
                                        <div class="TableShadowRightTop" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-rt.gif);"></div>
                                     </div>
                                     <div class="TableContentAndRightShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-rm.gif);">
                                        <div class="TableContentContainer">
                                           <table class="TableContent" width="100%" style="border:1px solid #faf0d7;">
                                              <tbody>
                                    <tr>
                                        <td><ul><i><small><li>You can not be online.</li><li>You can not belong to any guild.</li><li>Your account can not be banned.</li><li>Your character must be at least <strong>level 20</strong>.</li>
                                        </small></i></ul></td>
                                    </tr>
                                    </tbody>
                                </table>
                                </div>
                                </div>
                                <div class="TableShadowContainer">
                                <div class="TableBottomShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-bm.gif);">
                                <div class="TableBottomLeftShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-bl.gif);"></div>
                                <div class="TableBottomRightShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-br.gif);"></div>
                                </div>
                                </div>
                                </td>
                                </tr>
                                </tbody>
                                </table>
                                </div>
                                </td>
                                </tr>
                                </tbody>
                                </table><br/>
                                  </div> ';
    $main_content .= '<br>';
    $main_content .= '    <div class="TableContainer">
          <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">Sell character</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>
 
          <table class="Table3" cellpadding="0" cellspacing="0">
             <tbody>
                <tr>
                   <td>
                      <div class="InnerTableContainer">
                         <table style="width:100%;">
                            <tbody>
                               <tr>
                                  <td>
                                     <div class="TableShadowContainerRightTop">
                                        <div class="TableShadowRightTop" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-rt.gif);"></div>
                                     </div>
                                     <div class="TableContentAndRightShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-rm.gif);">
                                        <div class="TableContentContainer">
                                           <table class="TableContent" width="100%" style="border:1px solid #faf0d7;">
                                              <tbody>';
    $main_content .= '<TR BGCOLOR=' . $config['site']['darkborder'] . '><TD CLASS=black width="64px"><B></B>';
 
    $players_from_logged_acc = $account_logged->getPlayersList();
 
    $players_from_logged_acc->addOrder(new SQL_Order(new SQL_Field('name'), SQL_Order::ASC));
    $main_content .= '<center><center>Select the character you want to sell<br><form action="index.php?subtopic=buychar" method="post"><select name="char">';
    foreach ($players_from_logged_acc as $player) {
        $main_content .= '<option value="' . $player->getName() . '">' . $player->getName() . '</option>';
    }
 
    $main_content .= '</select>';
    $main_content .= '<center>Enter the value in Tibia Coins<br><input type="text" name="price" maxlength="5" size="10" > </center><br>';
    $main_content .= '<center><input type="submit" name="submit" value="Sell character"></TD></TR></center>';
    $main_content .= '</form>  </tbody>
                                                </table>
                                                </div>
                                                </div>
                                                <div class="TableShadowContainer">
                                                <div class="TableBottomShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-bm.gif);">
                                                <div class="TableBottomLeftShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-bl.gif);"></div>
                                                <div class="TableBottomRightShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-br.gif);"></div>
                                                </div>
                                                </div>
                                                </td>
                                                </tr>
                                                </tbody>
                                                </table>
                                                </div>
                                                </td>
                                                </tr>
                                                </tbody>
                                                </table><br/>
                                                  </div><br>';
 
    if (isset($_POST['submit'])) {
 
        $char = stripslashes($_POST['char']);
        $price = stripslashes($_POST['price']);
        $mensagem = "";
 
        $charLevel = $SQL->query('SELECT * FROM players WHERE name = "' . $char . '" LIMIT 1');
        foreach ($charLevel as $dados) {
            $level = $dados['level'];
        }      
 
        foreach ($players_from_logged_acc as $player) {
            if ($player->getName() == $char) {
                $check = 1;
                if ($player->isOnline()) {
                    $check = 0;
                    $mensagem = "Your char is online, please log out before placing it for sale! <br /><br />";
                }
                if ($player->getLevel() < 20) {
                    $check = 0;
                    $mensagem = "Your character must have a level greater than 20! <br /><br />";
                }
                if ($price <= 0 or $price > 10000) {
                    $check = 0;
                    $mensagem = "Please enter a price from 1 to 10000 Tibia Coins! <br /><br />";
                }
                if ($price % 25 != 0) {
                    $check = 0;
                    $mensagem = "Please enter a positive value and a multiple of 25, example: 25, 50, 75, 100 ... <br /><br />";
                }
                break;
            } else {
                $check = 0;
            }
        }
 
        if ($char && $price && $check == 1) {
            if (is_numeric(trim($_POST['price']))) {
                $check2 = $SQL->query("SELECT * FROM `players` WHERE `name` = '$char'");
                foreach ($check2 as $re) {
                    $voc = $re['vocation'];
                    $oid = $re['account_id'];
                }
 
                $check1 = $SQL->query("UPDATE `players` SET `account_id` = 1 WHERE `name` = '$char'");
                $check3 = $SQL->query("INSERT INTO `sellchar` VALUES ('','$char','$voc','$price','1','$oid')");
                $main_content .= '<b><center>Character successfully added to sale, Thanks!</b></center>';
                header("Location: index.php?subtopic=buychar");
            } else {
                $main_content .= '<b><center>Price in numbers!!</b></center>';
            }
        } else {
            $main_content .= '<center><h2>' . $mensagem . '</h2></center>';
        }
    }
}
if ($logged) {
 
    if ($action == '') {
 
        $main_content .= '<div class="TableContainer">
  <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">Buy Character</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>
 
  <table class="Table3" cellpadding="0" cellspacing="0">
     <tbody>
        <tr>
           <td>
              <div class="InnerTableContainer">
                 <table style="width:100%;">
                    <tbody>
                       <tr>
                          <td>
                             <div class="TableShadowContainerRightTop">
                                <div class="TableShadowRightTop" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-rt.gif);"></div>
                             </div>
                             <div class="TableContentAndRightShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-rm.gif);">
                                <div class="TableContentContainer">
                                   <table class="TableContent" width="100%" style="border:1px solid #faf0d7;">
                                      <tbody>';
 
        $main_content .= '<TR BGCOLOR=' . $config['site']['vdarkborder'] . '><TD CLASS=white width="64px"><CENTER><B></B></CENTER></TD><TD CLASS=white width="80px"><CENTER><B>Name</B></CENTER></TD><TD CLASS=white width="64px"><CENTER><B>Vocation</B></CENTER></TD><TD CLASS=white width="40px"><CENTER><B>Level</B></CENTER></TD><TD CLASS=white width="40px"><CENTER><B>Coins</B></CENTER></TD><TD CLASS=white width="64px"><CENTER><B>Continue to buy</B></CENTER></TD></TR>';
 
        $getall = $SQL->query('SELECT `id`, `name`, `price`, `status` FROM `sellchar` ORDER BY `id`')->fetchAll();
 
        if (is_array($getall)){
        foreach ($getall as $tt) {
            $namer = $tt['name'];
            $queryt = $SQL->query("SELECT `name`, `vocation`, `level`, `looktype`, `lookaddons`, `lookhead`, `lookbody`, `looklegs`, `lookfeet` FROM `players` WHERE `name` = '$namer'");
            foreach ($queryt as $ty) {
                if ($ty['vocation'] == 0) {
                    $tu = 'No Vocation';
                } else if ($ty['vocation'] == 1) {
                    $tu = 'Sorcerer';
                } else if ($ty['vocation'] == 2) {
                    $tu = 'Druid';
                } else if ($ty['vocation'] == 3) {
                    $tu = 'Paladin';
                } else if ($ty['vocation'] == 4) {
                    $tu = 'Knight';
                } else if ($ty['vocation'] == 5) {
                    $tu = 'Sorcerer';
                } else if ($ty['vocation'] == 6) {
                    $tu = 'Druid';
                } else if ($ty['vocation'] == 7) {
                    $tu = 'Paladin';
                } else if ($ty['vocation'] == 8) {
                    $tu = 'Knight';
                }
                $ee = $tt['name'];
                $ii = $tt['price'];
 
                //inserir aqui o tdd do outfit
 
                $main_content .= '<TR BGCOLOR=' . $config['site']['darkborder'] . '>
 
    <TD height="64px" style="position:relative;"><span style="display:block; position:absolute; top:-15px; left:-10px;"><img src="http://oldersretro.com/outfits/animoutfit.php?id=' . $ty['looktype'] . '&addons=' . $ty['lookaddons'] . '&head=' . $ty['lookhead'] . '&body=' . $ty['lookbody'] . '&legs=' . $ty['looklegs'] . '&feet=' . $ty['lookfeet'] . '"> </span><br/></TD>
 
    <TD CLASS=black width="64px"><CENTER><B><a href="index.php?subtopic=characters&name=' . $tt['name'] . '">' . $tt['name'] . '</a></B></CENTER></TD>
    <TD CLASS=black width="64px"><CENTER><B><small>' . $tu . '</small></B></CENTER></TD>
    <TD CLASS=black width="64px"><CENTER><B>' . $ty['level'] . '</B></CENTER></TD>
    <TD CLASS=black width="64px"><CENTER><B>' . $tt['price'] . '</B></CENTER></TD>
 
    <td>
   <center>
      <form id="myform" name="myform" action="?subtopic=buychar&action=buy" method="post" style="padding:0px;margin:0px;">
            <input type="hidden" name="char" value="' . $ee . '">
            <input type="hidden" name="price" value="' . $ii . '">
            <input type="submit" name="Buy" value="Continue" />
      </form>
   </center>
    </td>
    </TR>
    </form>
 
';
            }
        }
        }
        $main_content .= ' </tbody>
</table>
</div>
</div>
<div class="TableShadowContainer">
<div class="TableBottomShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-bm.gif);">
<div class="TableBottomLeftShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-bl.gif);"></div>
<div class="TableBottomRightShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-br.gif);"></div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table><br/>
  </div>';
    }
 
    if ($action == 'buy') {
 
        $name = $_POST['char'];
        $price = $_POST['price'];
        $ceh = $SQL->query("SELECT `name` FROM `sellchar` WHERE `name` = '$name'");
 
        if ($ceh) {
 
            if ($name == '') {
 
                $main_content .= '<b><center>Select a character to buy first</b>';
            } else {
 
                $user_premium_points = $account_logged->getCustomField('premium_points');
                $user_id = $account_logged->getCustomField('id');
 
                if ($user_premium_points >= $price) {
 
                    $check = $SQL->query("SELECT * FROM `sellchar` WHERE `name` = '$name'");
                    $check1 = $SQL->query("SELECT * FROM `players` WHERE `name` = '$name'");
                    $check2 = $SQL->query("SELECT `oldid` FROM `sellchar` WHERE `name` = '$name'");
                    foreach ($check as $result) {
                        foreach ($check1 as $res) {
                            foreach ($check2 as $ress) {
 
                                $oid = $ress['oldid'];
                                $main_content .= '<center>You bought<b> ' . $name . ' ( ' . $res['level'] . ' ) </b>for <b>' . $result['price'] . ' points.</b><br></center>';
                                $main_content .= '<br>';
                                $main_content .= '<center><b>The character is in your account, have fun!</b></center>';
                                $execute1 = $SQL->query("UPDATE `accounts` SET `premium_points` = `premium_points` - '$price' WHERE `id` = '$user_id'");
                                $execute2 = $SQL->query("UPDATE `players` SET `account_id` = '$user_id' WHERE `name` = '$name'");
                                $execute2 = $SQL->query("UPDATE `accounts` SET `premium_points` = `premium_points` + '$price' WHERE `id` = '$oid'");
                                $execute3 = $SQL->query("DELETE FROM `sellchar` WHERE `name` = '$name'");
                            }
                        }
                    }
                } else {
 
                    $main_content .= '<center><b>You do not have enough tibia coins.</b></center>';
                }
            }
        } else {
            $main_content .= '<center><b>This char can no longer be purchased.</b></center>';
        }
    }
} else {
    //pagina para nao logados
    $main_content .= '<div class="sellinfo">
            <i class="fas fa-bullhorn"></i>You are logged out!<br> <a href="?subtopic=accountmanagement">Click Here</a> to log into your account and start trading characters.
        </div>';
}

 

Link para o post
Compartilhar em outros sites

Troca:

    $players_from_logged_acc = $account_logged->getPlayersList();
 
    $players_from_logged_acc->addOrder(new SQL_Order(new SQL_Field('name'), SQL_Order::ASC));
    $main_content .= '<center><center>Select the character you want to sell<br><form action="index.php?subtopic=buychar" method="post"><select name="char">';
    foreach ($players_from_logged_acc as $player) {
        $main_content .= '<option value="' . $player->getName() . '">' . $player->getName() . '</option>';
    }
 
    $main_content .= '</select>';
    $main_content .= '<center>Enter the value in Tibia Coins<br><input type="text" name="price" maxlength="5" size="10" > </center><br>';
    $main_content .= '<center><input type="submit" name="submit" value="Sell character"></TD></TR></center>';
    $main_content .= '</form>  </tbody>


Por:

$players_from_logged_acc = $account_logged->getPlayersList();

$players_from_logged_acc->addOrder(new SQL_Order(new SQL_Field('name'), SQL_Order::ASC));
$main_content .= '<center><center>Select the character you want to sell<br><form action="index.php?subtopic=buychar" method="post"><select name="char">';
foreach ($players_from_logged_acc as $player) {
    $main_content .= '<option value="' . $player->getName() . '">' . $player->getName() . '</option>';
}

$main_content .= '</select>';
$main_content .= '<center>Enter the value in Tibia Coins<br><input type="text" name="price" maxlength="5" size="10" > </center><br>';

// Verifica se o jogador tem 50 pontos para vender o personagem
if($account_logged->getCustomField("points") >= 50) {
    $main_content .= '<center><input type="submit" name="submit" value="Sell character"></TD></TR></center>';
    $main_content .= '</form>  </tbody>';
} else {
    $main_content .= '<center>You need 50 points to sell your character. </center>';
}

 

Agora para remover os 50 pontos do jogador

Troque:

    if ($char && $price && $check == 1) {
            if (is_numeric(trim($_POST['price']))) {
                $check2 = $SQL->query("SELECT * FROM `players` WHERE `name` = '$char'");
                foreach ($check2 as $re) {
                    $voc = $re['vocation'];
                    $oid = $re['account_id'];
                }
 
                $check1 = $SQL->query("UPDATE `players` SET `account_id` = 1 WHERE `name` = '$char'");
                $check3 = $SQL->query("INSERT INTO `sellchar` VALUES ('','$char','$voc','$price','1','$oid')");
                $main_content .= '<b><center>Character successfully added to sale, Thanks!</b></center>';
                header("Location: index.php?subtopic=buychar");
            } else {
                $main_content .= '<b><center>Price in numbers!!</b></center>';
            }
        } else {
            $main_content .= '<center><h2>' . $mensagem . '</h2></center>';
        }
    }
}

Por:

if ($char && $price && $check == 1) {
    if (is_numeric(trim($_POST['price']))) {
        $check2 = $SQL->query("SELECT * FROM `players` WHERE `name` = '$char'");
        foreach ($check2 as $re) {
            $voc = $re['vocation'];
            $oid = $re['account_id'];
        }

        // Verifica se o jogador tem 50 pontos para vender o personagem
        if($account_logged->getCustomField("points") >= 50) {
            // Desconta os 50 pontos do jogador
            $account_logged->setCustomField("points", $account_logged->getCustomField("points") - 50);

            $check1 = $SQL->query("UPDATE `players` SET `account_id` = 1 WHERE `name` = '$char'");
            $check3 = $SQL->query("INSERT INTO `sellchar` VALUES ('','$char','$voc','$price','1','$oid')");
            $main_content .= '<b><center>Character successfully added to sale, Thanks!</b></center>';
            header("Location: index.php?subtopic=buychar");
        } else {
            $main_content .= '<b><center>You need 50 points to sell your character.</b></center>';
        }
    } else {
        $main_content .= '<b><center>Price in numbers!!</b></center>';
    }
} else {
    $main_content .= '<center><h2>' . $mensagem . '</h2></center>';
}

 

Editado por GamerGoiano (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
2 horas atrás, GamerGoiano disse:

Troca:


    $players_from_logged_acc = $account_logged->getPlayersList();
 
    $players_from_logged_acc->addOrder(new SQL_Order(new SQL_Field('name'), SQL_Order::ASC));
    $main_content .= '<center><center>Select the character you want to sell<br><form action="index.php?subtopic=buychar" method="post"><select name="char">';
    foreach ($players_from_logged_acc as $player) {
        $main_content .= '<option value="' . $player->getName() . '">' . $player->getName() . '</option>';
    }
 
    $main_content .= '</select>';
    $main_content .= '<center>Enter the value in Tibia Coins<br><input type="text" name="price" maxlength="5" size="10" > </center><br>';
    $main_content .= '<center><input type="submit" name="submit" value="Sell character"></TD></TR></center>';
    $main_content .= '</form>  </tbody>


Por:


$players_from_logged_acc = $account_logged->getPlayersList();

$players_from_logged_acc->addOrder(new SQL_Order(new SQL_Field('name'), SQL_Order::ASC));
$main_content .= '<center><center>Select the character you want to sell<br><form action="index.php?subtopic=buychar" method="post"><select name="char">';
foreach ($players_from_logged_acc as $player) {
    $main_content .= '<option value="' . $player->getName() . '">' . $player->getName() . '</option>';
}

$main_content .= '</select>';
$main_content .= '<center>Enter the value in Tibia Coins<br><input type="text" name="price" maxlength="5" size="10" > </center><br>';

// Verifica se o jogador tem 50 pontos para vender o personagem
if($account_logged->getCustomField("points") >= 50) {
    $main_content .= '<center><input type="submit" name="submit" value="Sell character"></TD></TR></center>';
    $main_content .= '</form>  </tbody>';
} else {
    $main_content .= '<center>You need 50 points to sell your character. </center>';
}

 

Agora para remover os 50 pontos do jogador

Troque:


    if ($char && $price && $check == 1) {
            if (is_numeric(trim($_POST['price']))) {
                $check2 = $SQL->query("SELECT * FROM `players` WHERE `name` = '$char'");
                foreach ($check2 as $re) {
                    $voc = $re['vocation'];
                    $oid = $re['account_id'];
                }
 
                $check1 = $SQL->query("UPDATE `players` SET `account_id` = 1 WHERE `name` = '$char'");
                $check3 = $SQL->query("INSERT INTO `sellchar` VALUES ('','$char','$voc','$price','1','$oid')");
                $main_content .= '<b><center>Character successfully added to sale, Thanks!</b></center>';
                header("Location: index.php?subtopic=buychar");
            } else {
                $main_content .= '<b><center>Price in numbers!!</b></center>';
            }
        } else {
            $main_content .= '<center><h2>' . $mensagem . '</h2></center>';
        }
    }
}

Por:


if ($char && $price && $check == 1) {
    if (is_numeric(trim($_POST['price']))) {
        $check2 = $SQL->query("SELECT * FROM `players` WHERE `name` = '$char'");
        foreach ($check2 as $re) {
            $voc = $re['vocation'];
            $oid = $re['account_id'];
        }

        // Verifica se o jogador tem 50 pontos para vender o personagem
        if($account_logged->getCustomField("points") >= 50) {
            // Desconta os 50 pontos do jogador
            $account_logged->setCustomField("points", $account_logged->getCustomField("points") - 50);

            $check1 = $SQL->query("UPDATE `players` SET `account_id` = 1 WHERE `name` = '$char'");
            $check3 = $SQL->query("INSERT INTO `sellchar` VALUES ('','$char','$voc','$price','1','$oid')");
            $main_content .= '<b><center>Character successfully added to sale, Thanks!</b></center>';
            header("Location: index.php?subtopic=buychar");
        } else {
            $main_content .= '<b><center>You need 50 points to sell your character.</b></center>';
        }
    } else {
        $main_content .= '<b><center>Price in numbers!!</b></center>';
    }
} else {
    $main_content .= '<center><h2>' . $mensagem . '</h2></center>';
}

 

Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\pages\buychar.php on line 101

Link para o post
Compartilhar em outros sites
1 minuto atrás, GamerGoiano disse:

Recomende usar VSCODE ou Notepad++ para editar códigos assim, voce comeu alguma letra ali no código
@yuriowns

eu uso o VSCODE


código:

 

Spoiler
<?PHP
if ($logged) {
    $main_content .= '<center><b><h3>Welcome to our characters market</h3></center></b><br>';
    $main_content .= '<b>NOTE:</b> If you put your character on sale anyone can buy it, you will lose acces to that character and you wont be able to log in with that character until someone buys it, you can also delete your offer by talking to an admin or buying your character back by yourself.<b> When someone buys your character you will get the price in points.</b>';
    $main_content .= '<br>';
    $main_content .= '
        <br>
        <div class="TableContainer">
          <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">Rules to Sell</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>
 
          <table class="Table3" cellpadding="0" cellspacing="0">
             <tbody>
                <tr>
                   <td>
                      <div class="InnerTableContainer">
                         <table style="width:100%;">
                            <tbody>
                               <tr>
                                  <td>
                                     <div class="TableShadowContainerRightTop">
                                        <div class="TableShadowRightTop" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-rt.gif);"></div>
                                     </div>
                                     <div class="TableContentAndRightShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-rm.gif);">
                                        <div class="TableContentContainer">
                                           <table class="TableContent" width="100%" style="border:1px solid #faf0d7;">
                                              <tbody>
                                    <tr>
                                        <td><ul><i><small><li>You can not be online.</li><li>You can not belong to any guild.</li><li>Your account can not be banned.</li><li>Your character must be at least <strong>level 20</strong>.</li>
                                        </small></i></ul></td>
                                    </tr>
                                    </tbody>
                                </table>
                                </div>
                                </div>
                                <div class="TableShadowContainer">
                                <div class="TableBottomShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-bm.gif);">
                                <div class="TableBottomLeftShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-bl.gif);"></div>
                                <div class="TableBottomRightShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-br.gif);"></div>
                                </div>
                                </div>
                                </td>
                                </tr>
                                </tbody>
                                </table>
                                </div>
                                </td>
                                </tr>
                                </tbody>
                                </table><br/>
                                  </div> ';
    $main_content .= '<br>';
    $main_content .= '    <div class="TableContainer">
          <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">Sell character</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>
 
          <table class="Table3" cellpadding="0" cellspacing="0">
             <tbody>
                <tr>
                   <td>
                      <div class="InnerTableContainer">
                         <table style="width:100%;">
                            <tbody>
                               <tr>
                                  <td>
                                     <div class="TableShadowContainerRightTop">
                                        <div class="TableShadowRightTop" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-rt.gif);"></div>
                                     </div>
                                     <div class="TableContentAndRightShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-rm.gif);">
                                        <div class="TableContentContainer">
                                           <table class="TableContent" width="100%" style="border:1px solid #faf0d7;">
                                              <tbody>';
                                              $players_from_logged_acc = $account_logged->getPlayersList();
 
                                              $players_from_logged_acc->addOrder(new SQL_Order(new SQL_Field('name'), SQL_Order::ASC));
                                              $main_content .= '<center><center>Select the character you want to sell<br><form action="index.php?subtopic=buychar" method="post"><select name="char">';
                                              foreach ($players_from_logged_acc as $player) {
                                                  $main_content .= '<option value="' . $player->getName() . '">' . $player->getName() . '</option>';
                                              }
                                             
                                              $main_content .= '</select>';
                                              $main_content .= '<center>Enter the value in Tibia Coins<br><input type="text" name="price" maxlength="5" size="10" > </center><br>';
                                             
                                              // Verifica se o jogador tem 50 pontos para vender o personagem
                                              if($account_logged->getCustomField("points") >= 50) {
                                                  $main_content .= '<center><input type="submit" name="submit" value="Sell character"></TD></TR></center>';
                                                  $main_content .= '</form>  </tbody>';
                                              } else {
                                                  $main_content .= '<center>You need 50 points to sell your character. </center>';
                                              }
                                                </table>
                                                </div>
                                                </div>
                                                <div class="TableShadowContainer">
                                                <div class="TableBottomShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-bm.gif);">
                                                <div class="TableBottomLeftShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-bl.gif);"></div>
                                                <div class="TableBottomRightShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-br.gif);"></div>
                                                </div>
                                                </div>
                                                </td>
                                                </tr>
                                                </tbody>
                                                </table>
                                                </div>
                                                </td>
                                                </tr>
                                                </tbody>
                                                </table><br/>
                                                  </div><br>';
 
    if (isset($_POST['submit'])) {
 
        $char = stripslashes($_POST['char']);
        $price = stripslashes($_POST['price']);
        $mensagem = "";
 
        $charLevel = $SQL->query('SELECT * FROM players WHERE name = "' . $char . '" LIMIT 1');
        foreach ($charLevel as $dados) {
            $level = $dados['level'];
        }      
 
        foreach ($players_from_logged_acc as $player) {
            if ($player->getName() == $char) {
                $check = 1;
                if ($player->isOnline()) {
                    $check = 0;
                    $mensagem = "Your char is online, please log out before placing it for sale! <br /><br />";
                }
                if ($player->getLevel() < 20) {
                    $check = 0;
                    $mensagem = "Your character must have a level greater than 20! <br /><br />";
                }
                if ($price <= 0 or $price > 10000) {
                    $check = 0;
                    $mensagem = "Please enter a price from 1 to 10000 Tibia Coins! <br /><br />";
                }
                if ($price % 25 != 0) {
                    $check = 0;
                    $mensagem = "Please enter a positive value and a multiple of 25, example: 25, 50, 75, 100 ... <br /><br />";
                }
                break;
            } else {
                $check = 0;
            }
        }
 
        if ($char && $price && $check == 1) {
            if (is_numeric(trim($_POST['price']))) {
                $check2 = $SQL->query("SELECT * FROM `players` WHERE `name` = '$char'");
                foreach ($check2 as $re) {
                    $voc = $re['vocation'];
                    $oid = $re['account_id'];
                }
       
                // Verifica se o jogador tem 50 pontos para vender o personagem
                if($account_logged->getCustomField("points") >= 50) {
                    // Desconta os 50 pontos do jogador
                    $account_logged->setCustomField("points", $account_logged->getCustomField("points") - 50);
       
                    $check1 = $SQL->query("UPDATE `players` SET `account_id` = 1 WHERE `name` = '$char'");
                    $check3 = $SQL->query("INSERT INTO `sellchar` VALUES ('','$char','$voc','$price','1','$oid')");
                    $main_content .= '<b><center>Character successfully added to sale, Thanks!</b></center>';
                    header("Location: index.php?subtopic=buychar");
                } else {
                    $main_content .= '<b><center>You need 50 points to sell your character.</b></center>';
                }
            } else {
                $main_content .= '<b><center>Price in numbers!!</b></center>';
            }
        } else {
            $main_content .= '<center><h2>' . $mensagem . '</h2></center>';
        }
if ($logged) {
 
    if ($action == '') {
 
        $main_content .= '<div class="TableContainer">
  <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">Buy Character</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>
 
  <table class="Table3" cellpadding="0" cellspacing="0">
     <tbody>
        <tr>
           <td>
              <div class="InnerTableContainer">
                 <table style="width:100%;">
                    <tbody>
                       <tr>
                          <td>
                             <div class="TableShadowContainerRightTop">
                                <div class="TableShadowRightTop" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-rt.gif);"></div>
                             </div>
                             <div class="TableContentAndRightShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-rm.gif);">
                                <div class="TableContentContainer">
                                   <table class="TableContent" width="100%" style="border:1px solid #faf0d7;">
                                      <tbody>';
 
        $main_content .= '<TR BGCOLOR=' . $config['site']['vdarkborder'] . '><TD CLASS=white width="64px"><CENTER><B></B></CENTER></TD><TD CLASS=white width="80px"><CENTER><B>Name</B></CENTER></TD><TD CLASS=white width="64px"><CENTER><B>Vocation</B></CENTER></TD><TD CLASS=white width="40px"><CENTER><B>Level</B></CENTER></TD><TD CLASS=white width="40px"><CENTER><B>Coins</B></CENTER></TD><TD CLASS=white width="64px"><CENTER><B>Continue to buy</B></CENTER></TD></TR>';
 
        $getall = $SQL->query('SELECT `id`, `name`, `price`, `status` FROM `sellchar` ORDER BY `id`')->fetchAll();
 
        if (is_array($getall)){
        foreach ($getall as $tt) {
            $namer = $tt['name'];
            $queryt = $SQL->query("SELECT `name`, `vocation`, `level`, `looktype`, `lookaddons`, `lookhead`, `lookbody`, `looklegs`, `lookfeet` FROM `players` WHERE `name` = '$namer'");
            foreach ($queryt as $ty) {
                if ($ty['vocation'] == 0) {
                    $tu = 'No Vocation';
                } else if ($ty['vocation'] == 1) {
                    $tu = 'Sorcerer';
                } else if ($ty['vocation'] == 2) {
                    $tu = 'Druid';
                } else if ($ty['vocation'] == 3) {
                    $tu = 'Paladin';
                } else if ($ty['vocation'] == 4) {
                    $tu = 'Knight';
                } else if ($ty['vocation'] == 5) {
                    $tu = 'Sorcerer';
                } else if ($ty['vocation'] == 6) {
                    $tu = 'Druid';
                } else if ($ty['vocation'] == 7) {
                    $tu = 'Paladin';
                } else if ($ty['vocation'] == 😎 {
                    $tu = 'Knight';
                }
                $ee = $tt['name'];
                $ii = $tt['price'];
 
                //inserir aqui o tdd do outfit
 
                $main_content .= '<TR BGCOLOR=' . $config['site']['darkborder'] . '>
 
    <TD height="64px" style="position:relative;"><span style="display:block; position:absolute; top:-15px; left:-10px;"><img src="http://oldersretro.com/outfits/animoutfit.php?id=' . $ty['looktype'] . '&addons=' . $ty['lookaddons'] . '&head=' . $ty['lookhead'] . '&body=' . $ty['lookbody'] . '&legs=' . $ty['looklegs'] . '&feet=' . $ty['lookfeet'] . '"> </span><br/></TD>
 
    <TD CLASS=black width="64px"><CENTER><B><a href="index.php?subtopic=characters&name=' . $tt['name'] . '">' . $tt['name'] . '</a></B></CENTER></TD>
    <TD CLASS=black width="64px"><CENTER><B><small>' . $tu . '</small></B></CENTER></TD>
    <TD CLASS=black width="64px"><CENTER><B>' . $ty['level'] . '</B></CENTER></TD>
    <TD CLASS=black width="64px"><CENTER><B>' . $tt['price'] . '</B></CENTER></TD>
 
    <td>
   <center>
      <form id="myform" name="myform" action="?subtopic=buychar&action=buy" method="post" style="padding:0px;margin:0px;">
            <input type="hidden" name="char" value="' . $ee . '">
            <input type="hidden" name="price" value="' . $ii . '">
            <input type="submit" name="Buy" value="Continue" />
      </form>
   </center>
    </td>
    </TR>
    </form>
 
';
            }
        }
        }
        $main_content .= ' </tbody>
</table>
</div>
</div>
<div class="TableShadowContainer">
<div class="TableBottomShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-bm.gif);">
<div class="TableBottomLeftShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-bl.gif);"></div>
<div class="TableBottomRightShadow" style="background-image:url(' . $layout_name . '/images/global/content/table-shadow-br.gif);"></div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table><br/>
  </div>';
    }
 
    if ($action == 'buy') {
 
        $name = $_POST['char'];
        $price = $_POST['price'];
        $ceh = $SQL->query("SELECT `name` FROM `sellchar` WHERE `name` = '$name'");
 
        if ($ceh) {
 
            if ($name == '') {
 
                $main_content .= '<b><center>Select a character to buy first</b>';
            } else {
 
                $user_premium_points = $account_logged->getCustomField('premium_points');
                $user_id = $account_logged->getCustomField('id');
 
                if ($user_premium_points >= $price) {
 
                    $check = $SQL->query("SELECT * FROM `sellchar` WHERE `name` = '$name'");
                    $check1 = $SQL->query("SELECT * FROM `players` WHERE `name` = '$name'");
                    $check2 = $SQL->query("SELECT `oldid` FROM `sellchar` WHERE `name` = '$name'");
                    foreach ($check as $result) {
                        foreach ($check1 as $res) {
                            foreach ($check2 as $ress) {
 
                                $oid = $ress['oldid'];
                                $main_content .= '<center>You bought<b> ' . $name . ' ( ' . $res['level'] . ' ) </b>for <b>' . $result['price'] . ' points.</b><br></center>';
                                $main_content .= '<br>';
                                $main_content .= '<center><b>The character is in your account, have fun!</b></center>';
                                $execute1 = $SQL->query("UPDATE `accounts` SET `premium_points` = `premium_points` - '$price' WHERE `id` = '$user_id'");
                                $execute2 = $SQL->query("UPDATE `players` SET `account_id` = '$user_id' WHERE `name` = '$name'");
                                $execute2 = $SQL->query("UPDATE `accounts` SET `premium_points` = `premium_points` + '$price' WHERE `id` = '$oid'");
                                $execute3 = $SQL->query("DELETE FROM `sellchar` WHERE `name` = '$name'");
                            }
                        }
                    }
                } else {
 
                    $main_content .= '<center><b>You do not have enough tibia coins.</b></center>';
                }
            }
        } else {
            $main_content .= '<center><b>This char can no longer be purchased.</b></center>';
        }
    }
} else {
    //pagina para nao logados
    $main_content .= '<div class="sellinfo">
            <i class="fas fa-bullhorn"></i>You are logged out!<br> <a href="?subtopic=accountmanagement">Click Here</a> to log into your account and start trading characters.
        </div>';
}

 

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por braianlomas
      Como faço para corrigir esse problema para meu cliente, eu uso o tfs 0.3.6  
      Quero resolver esse problema que tenho no meu cliente, como e onde posso resolver?  
      Eu uso o tfs 0.3.6, não tenho as fontes do cliente, se você puder me dar eu vou amá-las para sempre  
       

       
    • Por A.Mokk
      Ola pessoal, estou tentando compilar o TFS 1.5 Downgrade para 8.60 atraves do MSVC 2022, ao tentar compilar da o seguinte erro:
       
       
      Fiz o download do MSVC, GitDash, TFS-SDK-3.2, e de varios boosts que tentei, ao fazer o seguinte procedimento no GitDash:
       
      Ao chegar em ./bootstrap-vcpkg.bat o GitDash nao consegue realizar o procedimento corretamente, alguem poderia me ajudar ?

      Tentei de diversas formas mas o mesmo erro sempre persiste, atualmente meu servidor utiliza TFS 0.4, consigo compilar sem nenhum problema no MSVC 2010, porem, as limitações do TFS 0.4 estão me fazendo precisar atualizar, se alguem souber como corrigir esses erros eu agradeço !

      Tutoriais utilizados :
      Compiling on Windows (vcpkg) · otland/forgottenserver Wiki · GitHub
      Compiling on Windows · otland/forgottenserver Wiki · GitHub
      Compilando TFS 1.3 com vídeo-aula - Tutoriais Infraestrutura & Proteção - Tibia King - Tudo sobre Tibia, OTServ e Bots!
      Compilar TFS 1.3 Vcpkg - Tutoriais Infraestrutura & Proteção - Tibia King - Tudo sobre Tibia, OTServ e Bots!
       
      O que acontece no Powershell:
       
    • Por thunmin
      .Qual servidor ou website você utiliza como base? 
      Canary 2.3.6
      Qual o motivo deste tópico? 
      Queria fazer com que os players não pudessem mexer no aleta sio, pois, agora os mesmos estão conseguindo mexer nos itens
      Está surgindo algum erro? Se sim coloque-o aqui. 
       
      Você tem o código disponível? Se tiver publique-o aqui: 
         
      Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 
       
    • Por thunmin
      .Qual servidor ou website você utiliza como base? 
      canary para o cliente 13.16
      Qual o motivo deste tópico? 
      Não consigo encontrar onde ajusta
      to com o problema no 13.16  o exausted, por exemplo os kinas era pra combar exori, erori gran e exori min, porém não ta indo ta dando exausted o char ta soltando magia ou runa e não consegue usar as potions
      Está surgindo algum erro? Se sim coloque-o aqui. 
       
      Você tem o código disponível? Se tiver publique-o aqui: 
         
      Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 
       
    • Por Andersontatuador
      Olá galera da TK, me chamo Anderson estou procurando alguém profissional em otservs e site.
      Já tenho um servidor o site e o cliente preciso só de uma pessoal competente, que esteja empenhado a trabalhar,
      não quero nada de graça, pois nessa onda fui mais roubado do quer eu pagar um profissional.
      caso alguém se interesse entrar em contato comigo através do whatsapp
      82 9 9304-9462
       
      Está surgindo algum erro? Se sim coloque-o aqui. 
       
      Você tem o código disponível? Se tiver publique-o aqui: 
         
      Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 
       
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo