<?php
include '../wap/config.php';
if (!($conn=pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass"))) {
echo ("пЫЙВЛБ РПДЛМАЮЕОЙС Л вд!\n");
};
$timex=time()-10368000;
print $timex;
$res=pg_query($conn,"select id from users where lastact < '$timex' and moder=0");
$rows=pg_numrows($res);
print "Select complete, ".$rows." users found\n";
for ($i=0; $i<$rows; $i++) {
$id=pg_result($res,$i,0);
print "Deleting ".$id."\n";
pg_query($conn,"delete from wapgbk where uid='$id';");
pg_query($conn,"delete from chat where fr_u='$id' or to_u='$id';");
pg_query($conn,"delete from downloads where uid='$id';");
pg_query($conn,"delete from users_ignore where uid='$id' or who='$id';");
pg_query($conn,"delete from users where id='$id';");
}
pg_close($conn);
?>