function remove() { $unix = new unix(); $newf = array(); $add = 0; $f = explode("\n", @file_get_contents("/etc/hosts")); while (list($index, $line) = each($f)) { if (preg_match("#google\\.#", $line)) { $add++; continue; } $newf[] = $line; } if ($add > 0) { $q = new mysql(); $q->QUERY_SQL("DELETE FROM net_hosts WHERE `hostname` LIKE '%google%'", "artica_backup"); @file_put_contents("/etc/hosts", @implode("\n", $newf)); echo "Starting......: " . date("H:i:s") . " Squid : removing {$add} google servers from /etc/hosts\n"; shell_exec("/etc/init.d/dnsmasq restart"); reload_pdns(); } $q = new mysql(); $q->QUERY_SQL("DELETE FROM net_hosts WHERE `hostname` LIKE '%google%'", "artica_backup"); }
function remove() { $unix = new unix(); $entry = $unix->get_EtcHostsByName("www.google.com"); if ($entry == null) { return; } $array = GetWebsitesList(); while (list($table, $fff) = each($array)) { $unix->del_EtcHostsByName($fff); $c++; } if ($c > 0) { echo "Starting......: " . date("H:i:s") . " Squid : removing {$c} google servers from /etc/hosts\n"; reload_pdns(); } }