<?php $domain = "userhost.ffbin"; include "inc/functions.inc"; $hostdb = new HostDB(); $zone = new DDnsZone($domain); $countquery = "SELECT COUNT(*) FROM hosts WHERE last_seen < DATETIME('now','localtime','-1 day')"; $countresult = $hostdb->query($countquery); $count = $countresult->fetchArray(SQLITE3_NUM); if ($count[0] > 0) { $query = "SELECT * FROM hosts WHERE last_seen < DATETIME('now','-1 day')"; $result = $hostdb->query($query); while ($row = $result->fetchArray(SQLITE3_ASSOC)) { $zone->remove_host($row['hostname']); $hostdb->remove_host($row['hostname']); syslog(LOG_INFO, "Removed expired host " . $row['hostname'] . " from domain {$domain}"); } } else { syslog(LOG_INFO, "There are no expired hosts to remove from domain {$domain}"); }