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

Namelocks showerd script fix

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,764
Solutions
1
Reaction score
226
Location
Chile, Santiago
I have this script from gesior

PHP:
<?PHP 
$zap = $SQL->query('SELECT  `player_namelocks`.`player_id` ,  `player_namelocks`.`name` ,  `player_namelocks`.`new_name` ,  `player_namelocks`.`date` ,  `players`.`id` 
FROM  `player_namelocks` ,  `players` 
WHERE  `player_namelocks`.`player_id` =  `players`.`id` 
ORDER BY  `player_namelocks`.`date` DESC 
LIMIT 0 , 1000 '); 
    foreach($zap as $namelock) { 
        $players++; 
        $number++; 
             if(is_int($players / 2)) 
                $bgcolor = $config['site']['lightborder']; 
            else 
                $bgcolor = $config['site']['darkborder']; 
        $content .= '<TR BGCOLOR='.$bgcolor.'><TD>'.$number.'.</TD><TD>'.$namelock['name'].'</TD><TD><a href="?subtopic=characters&name='.urlencode($namelock['new_name']).'">'.$namelock['new_name'].'</a></TD><TD>'.date("d.m.Y, G:i:s", $namelock['date']).'</TD>'; 
        } 
    $main_content .= '<center><hr/><b>Namelock on '.$config['server']['serverName'].'.</b><hr/><br><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white WIDTH=1%><b>#</b></TD><TD CLASS=white WIDTH=32%><b>Old name</b></TD><TD CLASS=white WIDTH=32%><b>New name</b></TD><TD CLASS=white WIDTH=32%><b>Date</b></TD></TR>'.$content.'</TABLE>'; 
$main_content .= '<div align="right"><small><b>Author of script: <a href="http://otland.net/members/aleh/">Aleh</a></b></small></div><br />'; 

?>

I want to make it works on modern, can someone fix it?

I rep++ :)
 
PHP:
<?PHP
require("config.php");
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$SQL = $ots->getDBHandle();
 
$zap = $SQL->query('SELECT  `player_namelocks`.`player_id` ,  `player_namelocks`.`name` ,  `player_namelocks`.`new_name` ,  `player_namelocks`.`date` ,  `players`.`id`  
FROM  `player_namelocks` ,  `players`  
WHERE  `player_namelocks`.`player_id` =  `players`.`id`  
ORDER BY  `player_namelocks`.`date` DESC  
LIMIT 0 , 1000 ');  
    foreach($zap as $namelock) {  
        $players++;  
        $number++;  
             if(is_int($players / 2))  
                $bgcolor = $config['site']['lightborder'];  
            else  
                $bgcolor = $config['site']['darkborder'];  
        $content .= '<TR BGCOLOR='.$bgcolor.'><TD>'.$number.'.</TD><TD>'.$namelock['name'].'</TD><TD><a href="?subtopic=characters&name='.urlencode($namelock['new_name']).'">'.$namelock['new_name'].'</a></TD><TD>'.date("d.m.Y, G:i:s", $namelock['date']).'</TD>';  
        }  
    echo '<center><hr/><b>Namelock on '.$config['server']['serverName'].'.</b><hr/><br><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white WIDTH=1%><b>#</b></TD><TD CLASS=white WIDTH=32%><b>Old name</b></TD><TD CLASS=white WIDTH=32%><b>New name</b></TD><TD CLASS=white WIDTH=32%><b>Date</b></TD></TR>'.$content.'</TABLE>';  
echo '<div align="right"><small><b>Author of script: <a href="http://otland.net/members/aleh/">Aleh</a></b></small></div><br />';  

?>
 
Ah, can't rep you!

Anyways, you only add a

require("config.php");
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$SQL = $ots->getDBHandle();

???
 
I think so :P coz u need to connect to the database to get information about namelocks :D
 
Uhm... Tried to do it with this .php but doesn't work:

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

//Please respect the copyrights!//
$ban_reason = 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 Enforcer", "False Report to Gamemaster", "Destructive Behaviour", "Excessive Unjustified Player Killing", "Invalid Payment", "Spoiling Auction");

$players_banned = $SQL->query('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')->fetchAll();
if(!$players_banned) $main_content .= "There are currently no players banned.";
else{
    $number_of_players = 0;        
    foreach($players_banned as $player) {
        $nick = $SQL->query("SELECT name, id, level, account_id FROM `players` WHERE account_id =".$player['value']." ORDER BY level DESC LIMIT 1")->fetch(); 
        $gmnick = $SQL->query("SELECT name, id FROM `players` WHERE id =".$player['admin_id']."")->fetch(); 
        
        if($player['admin_id'] > "1")
            $banby = "<a href=?subtopic=characters&name=$gmnick[0]><font color ='green'>$gmnick[0]</font></a>";
        else
            $banby = "Auto Ban";
            
        $number_of_players++;
        
        if(is_int($number_of_players / 2))
            $bgcolor = $config['site']['darkborder'];
        else
            $bgcolor = $config['site']['lightborder'];
        
        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 WIDTH=15%><A HREF="?subtopic=characters&name='.$nick['name'].'">'.$nick['name'].'</A></TD><TD WIDTH=5%><font color ="red">'.$ban_reason[$player['reason']].'</font></TD><TD WIDTH=20%>'.$player['comment'].'</TD><TD>'.$banby.'</TD><TD>'.date("d/m/Y, G:i:s", $player['added']).'</TD><TD>'.$expires.'</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>Added</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><br>Improved by <B>Mindez</B></p>';
?>
 
I testet here and worked:
PHP:
 <?PHP 
require("config.php");
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$SQL = $ots->getDBHandle();

//////////////////
/// CREATED BY ///
///   SAMME    ///
/// AND EDITED ///
//// BY MINDEZ ///
/////  FROM  /////
/// OTLAND.NET ///
//////////////////

//Please respect the copyrights!//
$ban_reason = 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 Enforcer", "False Report to Gamemaster", "Destructive Behaviour", "Excessive Unjustified Player Killing", "Invalid Payment", "Spoiling Auction");

$players_banned = $SQL->query('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')->fetchAll();
if(!$players_banned) $main_content .= "There are currently no players banned.";
else{
    $number_of_players = 0;        
    foreach($players_banned as $player) {
        $nick = $SQL->query("SELECT name, id, level, account_id FROM `players` WHERE account_id =".$player['value']." ORDER BY level DESC LIMIT 1")->fetch(); 
        $gmnick = $SQL->query("SELECT name, id FROM `players` WHERE id =".$player['admin_id']."")->fetch(); 
        
        if($player['admin_id'] > "1")
            $banby = "<a href=?subtopic=characters&name=$gmnick[0]><font color ='green'>$gmnick[0]</font></a>";
        else
            $banby = "Auto Ban";
            
        $number_of_players++;
        
        if(is_int($number_of_players / 2))
            $bgcolor = $config['site']['darkborder'];
        else
            $bgcolor = $config['site']['lightborder'];
        
        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 WIDTH=15%><A HREF="?subtopic=characters&name='.$nick['name'].'">'.$nick['name'].'</A></TD><TD WIDTH=5%><font color ="red">'.$ban_reason[$player['reason']].'</font></TD><TD WIDTH=20%>'.$player['comment'].'</TD><TD>'.$banby.'</TD><TD>'.date("d/m/Y, G:i:s", $player['added']).'</TD><TD>'.$expires.'</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>Added</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><br>Improved by <B>Mindez</B></p>';
	
echo $main_content;
?>
 
Back
Top