Script to delete 30 days old account and inactive accounts Season IV

Status
Not open for further replies.
Here is a simple php script...

PHP:
mssql_connect("host","user","pass");

// if your account tables (MEMB_STAT, MEMB_INFO) is in muonline
mssql_select_db("muonline");
 
$q = mssql_query("select memb___id,DisConnectTM from MEMB_STAT where ConnecStat=0");

for($i=0; $i < mssql_num_rows($q); $i++)
{
$d = mssql_fetch_row($q);

// get total seconds of 30 days
$days30 = 60*60*24*30;

// get last disconnect time in seconds
$lastdc = strtotime($d[1]);

   // check if current time is 30 days greater than last dc
   if((time()-$lastdc) > $days30)
   {
   // delete account
   mssql_query("delete from MEMB_INFO where memb___id='".$d[0]."'");
   // delete characters
   mssql_query("delete from characters where AccountId='".$d[0]."'");
   // delete list in AccountCharacter table
   mssql_query("delete from AccountCharacter where ID='".$d[0]."'");
   // delete from MEMB_STAT
   mssql_query("delete from MEMB_STAT where memb___id='".$d[0]."'");
   }
}
echo "Done";
 
Upvote 0
If you need SQL Script look here http://forum.ragezone.com/f196/guide-many-useful-query-for-admin-353278/

or use this

delete account with nomore connect from 2007-06-01


Code:
delete from memb_info
where memb___id in (
select memb___id from memb_stat where disconnecttm<'2007-06-01')

delete from accountcharacter
where id in (
select memb___id from memb_stat where disconnecttm<'2007-06-01')

delete from character
where accountid in (
select memb___id from memb_stat where disconnecttm<'2007-06-01')

delete from warehouse
where accountid in (
select memb___id from memb_stat where disconnecttm<'2007-06-01')

GL :P:
 
Last edited:
Upvote 0
Status
Not open for further replies.
Back