<?PHP
$result = mysql_query ( "SELECT * FROM `bans` ORDER BY `id` DESC" );
while ( $row = mysql_fetch_array ( $result )
{
echo $row['value'] . ' - ' . $row['reason'];
}
?>
Hehe anytime, remember you would have to modify it a bit though as this is just a rough example of how it would work.
If you do not manage to fix it, I'll take a look at it.
`type` INT NOT NULL COMMENT 'this field defines if its ip, accountban or namelock',
`ip` INT UNSIGNED NOT NULL DEFAULT 0,
`mask` INT UNSIGNED NOT NULL DEFAULT 4294967295,
`player` INT UNSIGNED NOT NULL DEFAULT 0,
`account` INT UNSIGNED NOT NULL DEFAULT 0,
`time` INT UNSIGNED NOT NULL DEFAULT 0,
`reason_id` INT NOT NULL DEFAULT 0,
`action_id` INT NOT NULL DEFAULT 0,
`comment` VARCHAR(60) NOT NULL DEFAULT '',
`banned_by` INT UNSIGNED NOT NULL DEFAULT 0
<style>
a { color: blue; text-decoration: none; font-weight: bold }
a:visited { color: blue; text-decoration: none; font-weight: bold }
a:hover { color: blue; text-decoration: underline; font-weight: bold }
.white { color: white; font-weight: bold }
body { background-color: #051122; font-family: Times New Roman; color: #5A2800 }
</style>
<?
mysql_connect("localhost", "root", "") or die ("noob");
mysql_select_db("tfs") or die ("noob");
function getPlayerNameById($id)
{
$query = mysql_query("SELECT name FROM players WHERE id = $id");
$row = mysql_fetch_array($query);
mysql_free_result($query);
return '<a href="index.php?subtopic=characters&name='.urlencode($row[0]).'">'.$row[0].'</a>';
}
function getPlayersByAccount($account, $limit)
{
$query = mysql_query("SELECT name FROM players WHERE account_id = $account ORDER BY level DESC LIMIT $limit");
$row = mysql_fetch_array($query);
mysql_free_result($query);
return '<a href="index.php?subtopic=characters&name='.urlencode($row[0]).'">'.$row[0].'</a> <i>(Account Ban)</i>';
}
$bans_count = 0;
$bans_types = array("", "IP banised", "namelocked", "banished", "warned", "deleted");
$bans_reasons = array(
"offensive name", "invalid name format", "unsuitable name", "name inciting rule violation", "offensive statement",
"spamming", "illegal advertising", "off-topic public statement", "non-english public statement", "inciting rule violation",
"bug abuse", "game weakness abuse", "using unofficial software to play", "hacking", "multi-clienting", "account trading or sharing",
"threatening gamemaster", "pretending to have influence on rule enforcers", "false report to gamemaster", "destructive behaviour",
"excessive unjustified player killing", "invalid payment", "spoiling auction"
);
$query = mysql_query("SELECT * FROM bans");
if(mysql_num_rows($query) != 0)
{
echo '<table><tr bgcolor=#505050 class="WHITE"><td>Banishments:</td></tr>';
while($row = mysql_fetch_array($query))
{
if($row[active] != 0) {
if(is_int($bans_count / 2)) { $bgcolor = "#F1E0C6"; } else { $bgcolor = "#D4C0A1"; }
$bans_count++;
if($row[type] == 2) { $function = getPlayerNameById($row[value]); }
if($row[type] == 3) { $function = getPlayersByAccount($row[value], 1); }
if($row[expires] == "-1") { $until = "permamently";} else { $until = 'until '.date("d m Y, H:i:s", $row[expires]).''; }
echo '<tr bgcolor='.$bgcolor.'><td>'.$function.' is '.$bans_types[$row[type]].' by '.getPlayerNameById($row[admin_id]).' '.$until.' because of '.$bans_reasons[$row[reason]].' with a comment '.$row[comment].'.</td>';
}
}
echo '</table>';
}
else
{
echo 'No one is banned.';
}
mysql_close();
?>
[B]Warning[/B]: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in [B]C:\xampp\htdocs\bans.php[/B] on line [B]8[/B]
[B]Warning[/B]: mysql_free_result(): supplied argument is not a valid MySQL result resource in [B]C:\xampp\htdocs\bans.php[/B] on line [B]9
[/B]I get this errors on like 100 lines
$row = mysql_fetch_array($query);
mysql_free_result($query);
echo '<tr><td>'.getPlayerNameById($row[value]).'</td><td>'.$bans_array[$row[reason]].'</td><td>'.$row[comment].'</td><td>'.date("d m Y, H:i:s", $row[expires]).'</td>';
<style>
a { color: blue; text-decoration: none; font-weight: bold }
a:visited { color: blue; text-decoration: none; font-weight: bold }
a:hover { color: blue; text-decoration: underline; font-weight: bold }
.white { color: white; font-weight: bold }
body { background-color: #051122; font-family: Times New Roman; color: #5A2800 }
</style>
<?
mysql_connect("localhost", "root", "") or die ("noob");
mysql_select_db("tfs") or die ("noob");
function getPlayerNameById($id)
{
$query = mysql_query("SELECT name FROM players WHERE id = $id");
$row = mysql_fetch_array($query);
mysql_free_result($query);
return '<a href="index.php?subtopic=characters&name='.urlencode($row[0]).'">'.$row[0].'</a>';
}
function getPlayersByAccount($account, $limit)
{
$query = mysql_query("SELECT name FROM players WHERE account_id = $account ORDER BY level DESC LIMIT $limit");
$row = mysql_fetch_array($query);
mysql_free_result($query);
return '<a href="index.php?subtopic=characters&name='.urlencode($row[0]).'">'.$row[0].'</a> <i>(Account Ban)</i>';
}
$bans_count = 0;
$bans_types = array("", "IP banised", "namelocked", "banished", "warned", "deleted");
$bans_reasons = array(
"offensive name", "invalid name format", "unsuitable name", "name inciting rule violation", "offensive statement",
"spamming", "illegal advertising", "off-topic public statement", "non-english public statement", "inciting rule violation",
"bug abuse", "game weakness abuse", "using unofficial software to play", "hacking", "multi-clienting", "account trading or sharing",
"threatening gamemaster", "pretending to have influence on rule enforcers", "false report to gamemaster", "destructive behaviour",
"excessive unjustified player killing", "invalid payment", "spoiling auction"
);
$query = mysql_query("SELECT * FROM bans");
if(mysql_num_rows($query) != 0)
{
echo '<table><tr bgcolor=#505050 class="WHITE"><td>Banishments:</td></tr>';
while($row = mysql_fetch_array($query))
{
if($row[active] != 0) {
if(is_int($bans_count / 2)) { $bgcolor = "#F1E0C6"; } else { $bgcolor = "#D4C0A1"; }
$bans_count++;
if($row[type] == 2) { $function = getPlayerNameById($row[value]); }
if($row[type] == 3) { $function = getPlayersByAccount($row[value], 1); }
if($row[expires] == "-1") { $until = "permamently";} else { $until = 'until '.date("d m Y, H:i:s", $row[expires]).''; }
echo '<tr bgcolor='.$bgcolor.'><td>'.$function.' is '.$bans_types[$row[type]].' by '.getPlayerNameById($row[admin_id]).' '.$until.' because of '.$bans_reasons[$row[reason]].' with a comment '.$row[comment].'.</td>';
}
}
echo '</table>';
}
else
{
echo 'No one is banned.';
}
mysql_close();
?>