• 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!

[Gesior ACC] Fixed (!) Ban List for TFS 0.2~

Samme

.::EmmaS-SammE::.
Senator
Joined
Mar 4, 2008
Messages
2,398
Reaction score
50
Location
/poland
Because my last thread with ban list has too many spam about "doesnt work" I make a new thread with working one.

I think you all know what is it, so maybe lets install it? ;)

Open index.php and after:

PHP:
    case "latestnews":
        $topic = "Latest News";
        $subtopic = "latestnews";
        include("latestnews.php");
    break;

ADD

PHP:
    case "bans":
        $topic = "Ban List (Scripted By Samme from Otland.net)";
        $subtopic = "bans";
        include("bans.php");
    break;

Then create new file and name it bans.php then paste there this code:

PHP:
<?PHP
//////////////////
/// CREATED BY ///
///   SAMME    ///
/////  FROM  /////
/// OTLAND.NET ///
//////////////////

//Please respect the copyrights!//

$ban_reason = array("offensive name", "name containing part of sentence", "name with nonsensical letter combination", "invalid name format", "name not describing person", "name of celebrity", "name reffering to country", "Offtopic (Forum)", "name to fake official position", "offensive statement", "spamming", "advertisement not related to game", "macro use", "<center>--></center>", "off-topic public statement", "inciting rule violation", "bug abuse", "game weakness abuse", "Macro Use", "Destructive Behaviour", "<center>--></center>", "multi-clienting", "account trading", "<center>--></center>", "threatening gamemaster", "pretending to have official position", "pretending to have influence on gamemaster", "false report to gamemaster", "excessive unjustified player killing", "destructive behaviour", "spoiling auction", "invalid payment");

$players_banned = $SQL->query('SELECT `bans`.`account`, `bans`.`comment`, `bans`.`banned_by`, `bans`.`time`, `bans`.`reason_id` FROM `bans`, `players` WHERE `players`.`account_id` = `bans`.`account` AND `bans`.`time` > '.time().' AND `bans`.`type` = 3 GROUP BY `bans`.`account` ORDER BY `bans`.`time`')->fetchAll();
$number_of_players = 0;
if(!$players_banned) {
$main_content .= '<center><i>There are no players banned on '.$config['server']['serverName'].'</i></center>';
} else {
foreach($players_banned as $player) {
    $nick = $SQL->query("SELECT name, id, level, account_id FROM `players` WHERE account_id =".$player['account']." ORDER BY level DESC LIMIT 1")->fetch(); 
	$banned_by = $SQL->query("SELECT name, id FROM `players` WHERE id =".$player['banned_by']."")->fetch(); 
		
	
    if($player['banned_by'] >= "1")
        $banby = "<a href=?subtopic=characters&name=".urlencode($banned_by[0])."><font color ='green'>$banned_by[0]</font></a>";
    else
        $banby = "Auto Ban";
        
    if($player['time'] == "-1")
        $time = "Permament";
    else
        $time = date("d/m/Y, G:i:s", $player['time']);
        
    $number_of_players++;
    if(is_int($number_of_players / 2))
        $bgcolor = $config['site']['darkborder'];
    else
        $bgcolor = $config['site']['lightborder'];
    $players_rows .= '<TR BGCOLOR='.$bgcolor.'><TD WIDTH=15%><A HREF="?subtopic=characters&name='.$nick['name'].'">'.$nick['name'].'</A></TD><TD WIDTH=5%>'.$ban_reason[$player['reason_id']].'</TD><TD WIDTH=20%>'.$player['comment'].'</TD><TD>'.$banby.'</TD><TD>'.$time.'</TD></TR>';
}
    //list of players
    $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><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>Expires</center></b></TD></TR>'.$players_rows.'</TABLE>';
}
    //COPY RIGHTS!! DO NOT DELETE!
    $main_content .= '<br/><p align="right">Scripted by <B>Samme</B> from Otland.net</p>';
?>

In some cases you'll have to figure ban reasons.

Script was tested and it work!

Hope you like it! :thumbup:
 
Thanks for comments, thats nice to see peoples who respect the copyrights :) a lot of person just remove copyrights.
 
Sorry but, Fatal error: Call to a member function query() on a non-object in C:\SERVER\xampp\htdocs\aac\bans.php on line 13.
Bye.
 
Fatal error: Call to a member function query() on a non-object in /var/www/ban.php on line 13
 
bump!
Its really good ;), cant you do so you change the comment what you have been bann people for? ;D
 
Looks good. Hope you fix that bug though :)

Red
 
I have an problem with it. I´ve already created all, but my button for the Bans List doesn`t exist... but when I write http://localhost/index.php?subtopic=bans than I can see the bans can anyone help me??

Sorry for my english

Edit your layout.php file to create a link to the ban list.

Something like
HTML:
<a href="?subtopic=bans">Ban List</a>
 
ITS NOT WORKING

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1 no such column: bans.value' in C:\xampplite\htdocs\bans.php:4 Stack trace: #0 C:\xampplite\htdocs\bans.php(4): PDO->query('SELECT `bans`.`...') #1 C:\xampplite\htdocs\index.php(78): include('C:\xampplite\ht...') #2 {main} thrown in C:\xampplite\htdocs\bans.php on line 4
 
ITS NOT WORKING

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1 no such column: bans.value' in C:\xampplite\htdocs\bans.php:4 Stack trace: #0 C:\xampplite\htdocs\bans.php(4): PDO->query('SELECT `bans`.`...') #1 C:\xampplite\htdocs\index.php(78): include('C:\xampplite\ht...') #2 {main} thrown in C:\xampplite\htdocs\bans.php on line 4

no such column: bans.value
Means, you don't have an 'value' column in your bans table. IDK if the structure was changed in the past 2 years, so post your bans table structure in here!
 
Back
Top