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

[question] Remove old characters

Mummrik

Hey!
Joined
Oct 22, 2007
Messages
707
Solutions
28
Reaction score
126
Location
Sweden
Is there any possible way to remove old players that has not been online for 1 month or more?

I need a script that will check when the player where online last time and if the player has been inactive for 1 month+ (should be edit able) then it will be removed from the database.
This will make the database smaller if players have quit your ot. Remember the script will only run once every month

I hope someone understand what i mean whit this, and i do use TFS 0.3.2 and windows XP as OS on the host computer. i know this is possible cus i have seen some kind of script like this in some old ot server i did have years ago
 
Lol not sure :D i'm a noob scripter, but try it on a test database first. That might be useful anyway :p
PHP:
<?PHP
session_start();
include('config-and-functions.php');
// days * hours * minutes* seconds = unix
$timeold = 30*24*60*60;
$count = 0;
$dead_data = $SQL->query('SELECT * FROM players WHERE lastlogin+'.$timeold.' < '.lastlogin().'');
$SQL->query("DELETE FROM players WHERE lastlogin+'".$timeold."' < '".lastlogin()."';");
foreach($dead_data as $dead) {
$count++;
}
echo 'Removed '.$count.' players';
?>
 
Back
Top