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

Delete house if player is inactive!

Hello Otlanders.

Today I would like to present you my next script that delete houses of players that doesnt not login with x days (config) their levels is lower than value in config and doesnt have pacc!

I wont explain how to install that, its script for admins who know anything about PHP, so kids that make OTS only for $$ and doesnt have brain, please dont touch this code.

So, here is the code:

PHP:
<?PHP
if($logged)
{
    if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
    {
//config//
$level = 1000; //Player with highter than this value wont be touched.
$days_ago = 15; //Clean house if player doesnt not login with days ago value+
//config-end//

$players_clean = $SQL->query('SELECT `players`.`account_id`,`players`.`id`,`players`.`name`,`players`.`level`,`houses`.`owner`,`houses`.`id`,`accounts`.`premdays`,`accounts`.`id` FROM `players`,`houses`,`accounts` WHERE `accounts`.`premdays` = 0 AND `accounts`.`id` = `players`.`account_id` AND `houses`.`owner` = `players`.`id` AND `players`.`level` < '.(int) $level.' AND `players`.`lastlogin` < UNIX_TIMESTAMP() - '.(int) $days_ago.'*24*60*60;');
$number_of_players_clean = 0;
foreach($players_clean as $player) {
$do_clean = $SQL->query('UPDATE houses SET owner=0, lastwarning=0 WHERE owner='.(int) $player['owner'].'');
$number_of_players_clean++;

    if(is_int($number_of_players_clean / 2))
        $bgcolor = $config['site']['darkborder'];
    else
        $bgcolor = $config['site']['lightborder'];

    $players_rows .= '<TR BGCOLOR='.$bgcolor.'><TD WIDTH=57%><A HREF="?subtopic=characters&name='.urlencode($player['name']).'">'.$player['name'].'</A></TD><TD WIDTH=10%>'.$player['level'].'</TD></TR>';
}

if(empty($player))
$main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white><B>Status</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1><TR><TD>There is nothing to delete!</b></TD></TR></TABLE></TD></TR></TABLE>';
else
$main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white><B>Status</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1><TR><TD>Deletion Succesfull!</b></TD></TR></TABLE></TD></TR></TABLE><BR><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white><B>Houses of those players has been deleted!</B></TD></TR></TABLE><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD><A HREF="?subtopic=whoisonline&order=name" CLASS=white>Name</A></TD><TD><A HREF="?subtopic=whoisonline&order=level" CLASS=white>Level</A></TD></TR>'.$players_rows.'</TABLE>';
    }
else
{
    $main_content .= '<center><i>You dont have access to browse this page!</i></center>';
}
}
else
{
    $main_content .= 'Please enter your account number and your password.<br/><a href="?subtopic=createaccount" >Create an account</a> if you do not have one yet.<br/><br/><form action="?subtopic=clean" method="post" ><div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Account Login</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td class="LabelV" ><span >Account Number:</span></td><td style="width:100%;" ><input type="password" name="account_login" SIZE="10" maxlength="10" ></td></tr><tr><td class="LabelV" ><span >Password:</span></td><td><input type="password" name="password_login" size="30" maxlength="29" ></td></tr>          </table>        </div>  </table></div></td></tr><br/><table width="100%" ><tr align="center" ><td><table border="0" cellspacing="0" cellpadding="0" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></td><tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=lostaccount" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Account lost?" alt="Account lost?" src="'.$layout_name.'/images/buttons/_sbutton_accountlost.gif" ></div></div></td></tr></form></table></td></tr></table>';
}  
?>
Hope that you like it, also I would mind a reputation point from you. ^_^

"Would mind?" HAHAH
 
hmm i have problem :eek: when i wanna check this script everytime i Have this Message:
"There is nothing to delete!"

plz help me
 
Back
Top