I have the unban shop system,all I want to do instead of making it unban people I want to make it namelock people can any one help me with it?
Here is the script
Here is the script
PHP:
case "unban";
$topic = "Unban";
$subtopic = "unban";
include("unban.php");
break;
PHP:
<?php
$points_for_unban = 30;
if($logged)
{
$pp = $account_logged->getPremiumPoints();
if($pp >= $points_for_unban)
{
if($action == 'unban')
{
if(isset($_POST['char_name']))
{
$player = new OTS_Player();
$player->find($_POST['char_name']);
if($player->isLoaded())
{
$account = $player->getAccount();
if($account->isLoaded())
{
$account_bans = $SQL->query('SELECT `id` FROM `bans` WHERE `value` = ' . $account->getId() . ' AND `active` = 1 AND (`type` = 3 OR `type` = 5)')->fetchAll();
$remove = false;
$account_players = $account->getPlayersList();
if(empty($account_bans))
{
if($account_players->count() > 0)
{
foreach($account_players as $player)
{
$player_bans = $SQL->query('SELECT `id` FROM `bans` WHERE `value` = ' . $player->getId() . ' AND `active` = 1 AND (`type` = 2 OR `type` = 3 OR `type` = 5)')->fetchAll();
if(!empty($player_bans))
$remove = true;
}
}
}
else
$remove = true;
if($remove)
{
if($account_players->count() > 0)
foreach($account_players as $player)
$SQL->query('UPDATE `bans` SET `active` = 0 WHERE `value` = ' . $player->getId() . ' AND (`type` = 2 OR `type` = 5)');
$SQL->query('UPDATE `bans` SET `active` = 0 WHERE `value` = ' . $account->getId() . ' AND (`type` = 3 OR `type` = 5)');
$account_logged->setPremiumPoints($pp - $points_for_unban);
$account_logged->save();
$main_content .= 'Account has been unbanned.';
}
else
$main_content .= 'This account is not banned.';
}
else
$main_content .= 'Account of this player doesn\'t exist.';
}
else
$main_content .= 'Player ' . htmlspecialchars($_POST['char_name']) . ' doesn\'t exist.';
}
else
$main_content .= 'No character selected.';
$main_content .= '<br /><a rel="nofollow" href="?subtopic=unban">GO BACK</a>';
}
else
{
$main_content .= '<h2>Unban System</h2><br /><h4>Unban cost ' . $points_for_unban . ' premium points!</h4><br />';
$main_content .= 'Write nick of banned player [his account and all characters will be unbanned] that you want unban:<br /><form action="" method="post"><input type="hidden" name="action" value="unban" /><input type="hidden" name="subtopic" value="unban" />';
$main_content .= '<input type="text" name="char_name" value="" /><input type="submit" value="Unban" /></form>';
}
}
else
$main_content .= 'You need ' . $points_for_unban . ' premium points or more to unban.';
}
else
$main_content .= '<b>Please login first.</b>';
?>