$r=q("select * from user where account_expired = 1 and account_expires_on < UTC_TIMESTAMP() - INTERVAL 5 DAY and account_expires_on > '0000-00-00 00:00:00'");
if(count($r)){
require_once('include/Contact.php');
foreach($ras$rr)
user_remove($rr['uid']);
}
$nologin=get_config('public_server','nologin');
if($nologin){
$r=q("select uid from user where account_expired = 0 and login_date = '0000-00-00 00:00:00' and register_date < UTC_TIMESTAMP() - INTERVAL %d DAY and account_expires_on = '0000-00-00 00:00:00'",intval($nologin));
$r=q("select uid from user where account_expired = 0 and login_date < UTC_TIMESTAMP() - INTERVAL %d DAY and account_expires_on = '0000-00-00 00:00:00' and `page-flags` = 0",intval($flagusers));
$r=q("select uid from user where account_expired = 0 and login_date < UTC_TIMESTAMP() - INTERVAL %d DAY and account_expires_on = '0000-00-00 00:00:00' and expire = 0 and `page-flags` = 0",intval($flagposts));
$b['epreamble']=$b['preamble']=sprintf(t('Your account on %s will expire in a few days.'),get_config('system','sitename'));
$b['subject']=t('Your Friendica account is about to expire.');
$b['body']=sprintf(t("Hi %1\$s,\n\nYour account on %2\$s will expire in less than five days. You may keep your account by logging in at least once every 30 days"),$b['params']['to_name'],"[url=".$app->config["system"]["url"]."]".$app->config["sitename"]."[/url]");
'$infotext'=>t('Set any of these options to 0 to deactivate it.'),
'$expiredays'=>Array("expiredays","Expire Days",intval(get_config('public_server','expiredays')),"When an account is created on the site, it is given a hard "),
'$expireposts'=>Array("expireposts","Expire Posts",intval(get_config('public_server','expireposts')),"Set the default days for posts to expire here"),
'$nologin'=>Array("nologin","No Login",intval(get_config('public_server','nologin')),"Remove users who have never logged in after nologin days "),
'$flagusers'=>Array("flagusers","Flag users",intval(get_config('public_server','flagusers')),"Remove users who last logged in over flagusers days ago"),
'$flagposts'=>Array("flagposts","Flag posts",intval(get_config('public_server','flagposts')),"For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire "),