Znote / ZnoteAAC

Developement repository for the Znote AAC project. A website portal to represent and manage your Open Tibia server.
MIT License
146 stars 127 forks source link

Suggestion: add Ban page #162

Open kauezatarin opened 10 years ago

kauezatarin commented 10 years ago

A page that shows all banned players form the server and the remaining time of ban. That should be useful to see how many time you are banned without need trying to login on tibia.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/4332506-suggestion-add-ban-page?utm_campaign=plugin&utm_content=tracker%2F532683&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F532683&utm_medium=issues&utm_source=github).
peonso commented 10 years ago

Really bad etiquette from server owner to display a list of banned players. It's the kind of information that should be private, and the only way to secure this is by forcing player to log in to be able to see his own banishment information.

kauezatarin commented 10 years ago

The only players that should be banned are those who doesn't respect the server rulles, so why we should hide this players? But anyway i think that could exist something on the site showing that the player is banned, it should be like a line on myaccount page...

peonso commented 10 years ago

Yeah, it should be displayed somewhere, maybe even at characterprofile. I my point of view the problem is to have a section itself destinated just to exhibit them as banned players, it's not a matter of protecting players that not respect the server, but to show them respect nevertheless.

att3 commented 10 years ago

I think that a page with list of banned players wouldn't be very good idea. But it would be great to see if one of your characters is banned at account management. Example character view Char ,Druid , 2200, Char1 ,Druid , 2000, (banned until. 22.2.2015) Char2 ,Druid , 2200,

Well, tbh I think that "ban" text could be also displayed at character profile e.g Name : Test123 (banned)

peonso commented 10 years ago

I was starting something, but that shit is trouble, haha, each version stores it differently at database.

// return bans by account
function fetch_account_bans($accountid) {
    if (Config('TFSVersion') === 'TFS_02') {
        $array = mysql_select_multi("SELECT `type`, `player`, `action_id`, `reason_id`, `comment`, `time`, FROM `bans` WHERE `account`=$accountid LIMIT 0, 30");
    }
    elseif (Config('TFSVersion') === 'TFS_03') {
        $chars = user_character_list($accountid);
        $array = mysql_select_multi("SELECT `type`, `value` AS `account`, `comment`, `expires` AS `time`, FROM `bans` WHERE `value`=$accountid, `type`='3' LIMIT 0, 30");
        foreach ($chars as $char) {
            $data = user_character_data($char, 'lastip');
            $charip = $data['lastip'];
            $array = mysql_select_multi("SELECT `type`, `value` AS `player`, `comment`, `expires` AS `time`, FROM `bans` WHERE `value`=$char, `type`='2' LIMIT 0, 30");
        }
    }
    elseif (Config('TFSVersion') === 'TFS_10') {
        $array = 'NULL';
    }
    return $array;
}

// return bans by player
function fetch_player_bans($charid) {

    $data = user_character_data($charid, 'account_id', 'lastip');

    $accountid = $data['account_id'];
    $charip = $data['lastip'];

    if (Config('TFSVersion') === 'TFS_02') {
    $array = mysql_select_multi("SELECT `type`, `player`, `action_id`, `reason_id`, `comment`, `time`, FROM `bans` WHERE `player`=$charid LIMIT 0, 30");
    }
    elseif (Config('TFSVersion') === 'TFS_03') {
    $array = 'NULL';
    }
    elseif (Config('TFSVersion') === 'TFS_10') {
    $array = 'NULL';
    }
    return $array;
}
peonso commented 10 years ago

And this at myaccount, really just some first draft

    <!-- Banishment info -->
    <?php
    // check bans
    $bans = fetch_account_bans($session_user_id);
    //display bans
    if ($bans && !empty($bans)) {
    ?>
    <h2>Banishment Information</h2> <?php
        foreach ($bans as $ban) { ?>
        <table class="table table-striped table-hover">
            <tr>
                <td><strong>Type:</strong></td>
                <td><?php 
                foreach ($config['ban_type'] as $key=>$value) {
                    if ($ban['type'] == $key) {
                    echo $value;
                    }
                } ?></td>
            </tr>
            <tr>
                <td><strong>Character:</strong></td>
                <td></td>
            </tr>
            <tr>
                <td><strong>Reason:</strong></td>
                <td></td>
            </tr>
            <tr>
                <td><strong>Comment:</strong></td>
                <td></td>
            </tr>
            <tr>
                <td><strong>Date:</strong></td>
                <td></td>
            </tr>
            <tr>
                <td><strong>Until:</strong></td>
                <td></td>
            </tr>
        </table>    
    <?php
        }
    } ?>
    <!-- end of Banishment info -->     
peonso commented 10 years ago

And something like that for character profile

            <li><font class="profile_font" name="profile_font_status">Status:</font> <?php }}
                    $bans = fetch_player_bans($charid)
                    if ($bans && !empty($bans)) {
                        foreach ($bans as $ban) { 
                            echo '<font color="red"><b>Banned until ';
                            echo date("d M Y, H:i",$ban['time']);
                            echo '</b></font>';
                        }
                    }   
                    elseif ($config['TFSVersion'] == 'TFS_10') {
                        if ($profile_data['online']) {
                            echo '<font class="profile_font" name="profile_font_online" color="green"><b>ONLINE</b></font>';
                        } else {
                            echo '<font class="profile_font" name="profile_font_online" color="red"><b>OFFLINE</b></font>';
                        }
                    } else {
                        if ($profile_data['online'] == 1) {
                            echo '<font class="profile_font" name="profile_font_online" color="green"><b>ONLINE</b></font>';
                        } else {
                            echo '<font class="profile_font" name="profile_font_online" color="red"><b>OFFLINE</b></font>';
                        }
                    }
                ?></li>
kauezatarin commented 10 years ago

the first script I should add to engine\function\general.php ?

peonso commented 10 years ago

It's not working. It's just an idea/start.

Nottinghster commented 5 years ago

This is the ban page that I did for my server, maybe you guys can adapt to all TFS versions

<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
<?PHP
$ban_reason = array (
    "OFFENSIVE NAME",
    "NAME CONTAINING PART OF SENTENCE",
    "NAME WITH NONSENSICAL LETTER COMBO",
    "INVALID NAME FORMAT",
    "NAME NOT DESCRIBING PERSON",
    "NAME OF CELEBRITY",
    "NAME REFERRING TO COUNTRY",
    "NAMEFAKING PLAYER IDENTITY",
    "NAMEFAKING OFFICIAL POSITION",
    "OFFENSIVE STATEMENT",
    "SPAMMING",
    "ADVERTISEMENT NOT RELATED TO GAME",
    "REAL MONEY ADVERTISEMENT",
    "NON-ENGLISH PUBLIC STATEMENT",
    "OFF-TOPIC PUBLIC STATEMENT",
    "INCITING RULE VIOLATION",
    "BUG ABUSE",
    "GAME WEAKNESS ABUSE",
    "USING MACRO",
    "USING UNOFFICIAL SOFTWARE TO PLAY",
    "HACKING",
    "MULTI-CLIENTING",
    "ACCOUNT TRADING",
    "ACCOUNT SHARING",
    "THREATENING GAMEMASTER",
    "PRETENDING TO HAVE OFFICIAL POSITION",
    "PRETENDING TO HAVE INFLUENCE ON GAMEMASTER",
    "FALSE REPORT TO GAMEMASTER",
    "EXCESSIVE UNJUSTIFED PLAYER KILLING",
    "DESTRUCTIVE BEHAVIOUR",
    "SPOILING AUCTION",
    "INVALID PAYMENT",
    "NOTHING"
);

$players_banned = mysql_select_multi('SELECT `bans`.`value`, `bans`.`comment`, `bans`.`admin_id`, `bans`.`expires`, `bans`.`added`, `bans`.`reason` FROM `bans`, `players` WHERE `players`.`account_id` = `bans`.`value` AND `bans`.`type` = 3 AND `bans`.`active` = 1 GROUP BY `bans`.`value` ORDER BY `bans`.`added` DESC');
if(!$players_banned) { ?>
<h2><center><b>There are no players banned on <?php echo $config['site_title'] ?>!</b></center></h2>
<?php } else {
    $number_of_players = 0;        
    foreach($players_banned as $player) {
        $nick = mysql_select_multi("SELECT name, id, level, account_id FROM `players` WHERE account_id =".$player['value']." ORDER BY level DESC LIMIT 1");
        $gmnick = mysql_select_multi("SELECT name, id FROM `players` WHERE id =".$player['admin_id']."");

        if($player['admin_id'] >= "1")
            $banby = "<a href=characterprofile.php?name=".$gmnick['name']."><font color ='green'>".$gmnick['name']."</font></a>";
        else
            $banby = "Auto Ban";

        $number_of_players++;

        if(is_int($number_of_players / 2))
            $bgcolor = '#F1E0C6';
        else
            $bgcolor = '#D4C0A1';

        if ($player['expires'] == -1) // If the banishment is permanent
            $expires = "PERMANENT";
        else
            $expires = date("d/m/Y, G:i:s", $player['expires']);

        $players_rows .= '<TR BGCOLOR='.$bgcolor.'>
            <TD align="center"><A HREF="characterprofile.php?name='.$nick['name'].'">'.$nick['name'].'</A></TD>
            <TD align="center">'.$ban_reason[$player['reason']].'</TD>
            <TD align="center">'.$player['comment'].'</TD>
            <TD align="center">'.$banby.'</TD>
            <TD align="center">'.date("d/m/Y, G:i:s", $player['added']).'</TD>
            <TD align="center">'.$expires.'</TD>
        </TR>';
    } ?>

    <!-- List of players -->
    <h1>Banned Players</h1>
    <TABLE BORDER="2" CELLSPACING="1" CELLPADDING="4" WIDTH="100%">
        <TR><TD CLASS="white"><b><center>Banned Player</center></b></TD>
        <TD class="white"><b><center>Reason</center></b></TD>
        <TD class="white"><b><center>Comment</center></b></TD>
        <TD class="white"><b><center>Banned By</center></b></TD>
        <TD class="white"><b><center>Added</center></b></TD>
        <TD class="white"><b><center>Expires</center></b></TD></TR><?php echo $players_rows ?>
    </TABLE>

<?php } ?>

<?php include 'layout/overall/footer.php'; ?>
djblah commented 4 years ago

This is the ban page that I did for my server, maybe you guys can adapt to all TFS versions

<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
<?PHP
$ban_reason = array (
  "OFFENSIVE NAME",
  "NAME CONTAINING PART OF SENTENCE",
  "NAME WITH NONSENSICAL LETTER COMBO",
  "INVALID NAME FORMAT",
  "NAME NOT DESCRIBING PERSON",
  "NAME OF CELEBRITY",
  "NAME REFERRING TO COUNTRY",
  "NAMEFAKING PLAYER IDENTITY",
  "NAMEFAKING OFFICIAL POSITION",
  "OFFENSIVE STATEMENT",
  "SPAMMING",
  "ADVERTISEMENT NOT RELATED TO GAME",
  "REAL MONEY ADVERTISEMENT",
  "NON-ENGLISH PUBLIC STATEMENT",
  "OFF-TOPIC PUBLIC STATEMENT",
  "INCITING RULE VIOLATION",
  "BUG ABUSE",
  "GAME WEAKNESS ABUSE",
  "USING MACRO",
  "USING UNOFFICIAL SOFTWARE TO PLAY",
  "HACKING",
  "MULTI-CLIENTING",
  "ACCOUNT TRADING",
  "ACCOUNT SHARING",
  "THREATENING GAMEMASTER",
  "PRETENDING TO HAVE OFFICIAL POSITION",
  "PRETENDING TO HAVE INFLUENCE ON GAMEMASTER",
  "FALSE REPORT TO GAMEMASTER",
  "EXCESSIVE UNJUSTIFED PLAYER KILLING",
  "DESTRUCTIVE BEHAVIOUR",
  "SPOILING AUCTION",
  "INVALID PAYMENT",
  "NOTHING"
);

$players_banned = mysql_select_multi('SELECT `bans`.`value`, `bans`.`comment`, `bans`.`admin_id`, `bans`.`expires`, `bans`.`added`, `bans`.`reason` FROM `bans`, `players` WHERE `players`.`account_id` = `bans`.`value` AND `bans`.`type` = 3 AND `bans`.`active` = 1 GROUP BY `bans`.`value` ORDER BY `bans`.`added` DESC');
if(!$players_banned) { ?>
<h2><center><b>There are no players banned on <?php echo $config['site_title'] ?>!</b></center></h2>
<?php } else {
    $number_of_players = 0;        
    foreach($players_banned as $player) {
        $nick = mysql_select_multi("SELECT name, id, level, account_id FROM `players` WHERE account_id =".$player['value']." ORDER BY level DESC LIMIT 1");
        $gmnick = mysql_select_multi("SELECT name, id FROM `players` WHERE id =".$player['admin_id']."");

        if($player['admin_id'] >= "1")
            $banby = "<a href=characterprofile.php?name=".$gmnick['name']."><font color ='green'>".$gmnick['name']."</font></a>";
        else
            $banby = "Auto Ban";

        $number_of_players++;

        if(is_int($number_of_players / 2))
            $bgcolor = '#F1E0C6';
        else
            $bgcolor = '#D4C0A1';

        if ($player['expires'] == -1) // If the banishment is permanent
            $expires = "PERMANENT";
        else
            $expires = date("d/m/Y, G:i:s", $player['expires']);

        $players_rows .= '<TR BGCOLOR='.$bgcolor.'>
          <TD align="center"><A HREF="characterprofile.php?name='.$nick['name'].'">'.$nick['name'].'</A></TD>
          <TD align="center">'.$ban_reason[$player['reason']].'</TD>
          <TD align="center">'.$player['comment'].'</TD>
          <TD align="center">'.$banby.'</TD>
          <TD align="center">'.date("d/m/Y, G:i:s", $player['added']).'</TD>
          <TD align="center">'.$expires.'</TD>
      </TR>';
    } ?>

    <!-- List of players -->
  <h1>Banned Players</h1>
  <TABLE BORDER="2" CELLSPACING="1" CELLPADDING="4" WIDTH="100%">
      <TR><TD CLASS="white"><b><center>Banned Player</center></b></TD>
      <TD class="white"><b><center>Reason</center></b></TD>
      <TD class="white"><b><center>Comment</center></b></TD>
      <TD class="white"><b><center>Banned By</center></b></TD>
      <TD class="white"><b><center>Added</center></b></TD>
      <TD class="white"><b><center>Expires</center></b></TD></TR><?php echo $players_rows ?>
  </TABLE>

<?php } ?>

<?php include 'layout/overall/footer.php'; ?>

I give it to a player but it doesn't show me anything just the title of the page