File size: 2.09Kb
<?php
set_time_limit(300);
header('Content-Type: text/plain; Charset=windows-1251');
print "---===:::{START}::===---\n";
$sitespath="/home/kmx/www/sites";
$rootpath="/home/kmx/includes/";
include($rootpath."function.inc");
define("DBName","kmx");
define("HostName","localhost");
define("UserName","kmx");
define("Password","kmx-hosting");
$connectserv=@mysql_connect(HostName, UserName, Password);
$selectDB=@mysql_select_db(DBName);
$connect_bd=(($connectserv!=0)&&($selectDB!=0));
if (!$connect_bd) die("Do not connect BD...\n---===:::{STOP}:::===---");
$q=@mysql(DBName,"SELECT `domain` , `login` , `email` FROM `users` WHERE `pass` != '' AND `lasttime` < ".(time()-2678400)." AND `status` = 0");
$s=@mysql_num_rows($q);
$mails='';
$cntsite=$cntdir=$cntfile=0;
for ($i=0;$i<$s;$i++)
{
$data=mysql_fetch_array($q);
$cntsite++;
$site=$data['login'];
$domain=$data['domain'];
unset($files);
array($files);
if (!is_dir($sitespath.'/'.$domain.'/'.$site))
{
print $site.'.'.$domain."(DIR NOT FOUND!)\n";
continue;
}
else
{
$dir_delete_cnt_files=$dir_delete_cnt_directories=0;
$rez=dir_delete($sitespath.'/'.$domain.'/'.$site);
}
@mysql(DBName,"DELETE FROM `users` WHERE `domain` = '".$domain."' AND `login` = '".$site."' LIMIT 1");
@mysql(DBName,"DELETE FROM `sites` WHERE `domain` = '".$domain."' AND `login` = '".$site."' LIMIT 1");
@mysql(DBName,"DELETE FROM `support_card` WHERE `autor` = '".$site."'");
@mysql(DBName,"DELETE FROM `support_msg` WHERE `login` = '".$site."'");
@mysql(DBName,"DELETE FROM `counter` WHERE `domain` = '".$domain."' AND `login` = '".$site."' LIMIT 1");
print $site."(".$dir_delete_cnt_directories."/".$dir_delete_cnt_files.") - ";
if ($rez) print "OK\n"; else print "ERROR!\n";
$mails.=$site.'.'.$domain.'.ru <'.$data['email'].'>, ';
$cntfile+=$dir_delete_cnt_files;
$cntdir+=$dir_delete_cnt_directories;
}
$fp = @fopen ("./mails_purge_files.txt", "w+");
@fwrite ($fp, $mails);
@fclose ($fp);
print "Sites=$cntsite / Directories=$cntdir / Files=$cntfile\n---===:::{STOP}::===---";
exit;
?>