• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Show ban comment in "bans"

Hellrage

Worr
Joined
Oct 30, 2007
Messages
2,477
Reaction score
5
Location
Sweden
Hello I use Nicaw and Avesta and I want to show ban comment in "bans".

Website looks like this:
3yDwnyIUFx.png


Here is my modified code for bans.php
PHP:
<div class="mid">
<?php
$SQL = AAC::$SQL;
$SQL->myQuery('SELECT players.name, bans.comment, bans.expires, bans.active FROM bans, players WHERE bans.type = 2 AND players.id = bans.value OR bans.type = 3 AND players.account_id = bans.value ORDER BY expires ASC');

echo '<table style="width:100%">'."\n";
echo '<tr class="color0"><td style="width:25%"><b>Name</b></td><td style="width:25%"><b>Reason</b></td><td style="width:25%"><b>Ban Ends</b></td><td style="width:25%"><b>Time Left</b></td></tr>'."\n";
while ($ban = $SQL->fetch_array()){
	if(!$ban['active']) continue;
	$time = date("jS F Y H:i:s",(int) $ban['expires']);
	$d = floor(($ban['expires'] - time())/(24*3600));
	$h = floor(($ban['expires'] - time() - $d * 24*3600)/3600);
	if ($d != 0)
		$timeleft = $d.'d '.$h.'h';
	else
		$timeleft = $h.'h';
	if ($ban['expires'] - time() > 0 && (($ban['expires'] - time()) < $cfg['max_ban_time'] || $cfg['max_ban_time'] == 0)){
		$i++;
		echo '<tr '.getStyle($i).'><td>'.$ban['name'].'</td><td>'.$comment.'</td><td>'.$time.'</td><td>'.$timeleft.'</td></tr>'."\n";
	}
}
echo '</table>'."\n";
?>
</div>

Does anybody know why I cant see ban comment (under "reason")?

edit: Thanks Cykotitan, added rep. No need to bump thread though.
 
Last edited:
Code:
<div class="mid">
<?php
$SQL = AAC::$SQL;
$SQL->myQuery('SELECT players.name, bans.comment, bans.expires, bans.active FROM bans, players WHERE bans.type = 2 AND players.id = bans.value OR bans.type = 3 AND players.account_id = bans.value ORDER BY expires ASC');

echo '<table style="width:100%">'."\n";
echo '<tr class="color0"><td style="width:25%"><b>Name</b></td><td style="width:25%"><b>Reason</b></td><td style="width:25%"><b>Ban Ends</b></td><td style="width:25%"><b>Time Left</b></td></tr>'."\n";
while ($ban = $SQL->fetch_array()){
	if(!$ban['active']) continue;
	$time = date("jS F Y H:i:s",(int) $ban['expires']);
	$d = floor(($ban['expires'] - time())/(24*3600));
	$h = floor(($ban['expires'] - time() - $d * 24*3600)/3600);
	if ($d != 0)
		$timeleft = $d.'d '.$h.'h';
	else
		$timeleft = $h.'h';
	if ($ban['expires'] - time() > 0 && (($ban['expires'] - time()) < $cfg['max_ban_time'] || $cfg['max_ban_time'] == 0)){
		$i++;
		echo '<tr '.getStyle($i).'><td>'.$ban['name'].'</td><td>'.$ban['comment'].'</td><td>'.$time.'</td><td>'.$timeleft.'</td></tr>'."\n";
	}
}
echo '</table>'."\n";
?>
</div>
 
Back
Top