function page()
{
    $cf = new dnsmasq();
    $page = CurrentPageName();
    $sys = new systeminfos();
    $sys->array_interfaces[null] = '{select}';
    $sys->array_tcp_addr[null] = '{select}';
    $interfaces = Field_array_Hash($sys->array_interfaces, 'interfaces', null);
    $tcpaddr = Field_array_Hash($sys->array_tcp_addr, 'listen_addresses', null);
    $html = "\n<p>{dnsmasq_intro_settings}</p>\n<form name='ffm1'>\n<table style='width:100%'>\n<input type='hidden' name='SaveConf1' value='yes'>\n<tr>\n<td align='right' valign='top' class=bottom style='font-weight:bold' class=bottom>{domain-needed}:</td>\n<td align='left' valign='top' class=bottom class=bottom >" . Field_key_checkbox_img('domain-needed', $cf->main_array["domain-needed"], '{enable_disable}') . "</td>\n<td align='left' valign='top' class=bottom style='font-size:9px'>{domain-needed_text}</td>\n</tr>\n<tr>\n<td align='right' valign='top' class=bottom style='font-weight:bold' class=bottom>{expand-hosts}:</td>\n<td align='left' valign='top' class=bottom class=bottom >" . Field_key_checkbox_img('expand-hosts', $cf->main_array["expand-hosts"], '{enable_disable}') . "</td>\n<td align='left' valign='top' class=bottom style='font-size:9px'>{expand-hosts_text}</td>\n</tr>\n\n\n<tr>\n<td align='right' valign='top' class=bottom style='font-weight:bold'>{bogus-priv}:</td>\n<td align='left' valign='top' class=bottom>" . Field_key_checkbox_img('bogus-priv', $cf->main_array["bogus-priv"], '{enable_disable}') . "</td>\n<td align='left' valign='top' class=bottom style='font-size:9px'>{bogus-priv_text}</td>\n</tr>\n<tr>\n<td align='right' valign='top' class=bottom valign='top' class=bottom style='font-weight:bold'>{filterwin2k}:</td>\n<td align='left' valign='top' class=bottom>" . Field_key_checkbox_img('filterwin2k', $cf->main_array["filterwin2k"], '{enable_disable}') . "</td>\n<td align='left' valign='top' class=bottom style='font-size:9px'>{filterwin2k_text}</td>\n</tr>\n<tr>\n<td align='right' valign='top' class=bottom valign='top' class=bottom style='font-weight:bold'>{strict-order}:</td>\n<td align='left' valign='top' class=bottom>" . Field_key_checkbox_img('strict-order', $cf->main_array["strict-order"], '{enable_disable}') . "</td>\n<td align='left' valign='top' class=bottom style='font-size:9px'>{strict-order_text}</td>\n</tr>\n\n<tr>\n<td align='right' valign='top' class=bottom valign='top' class=bottom style='font-weight:bold'>{no-resolv}:</td>\n<td align='left' valign='top' class=bottom>" . Field_key_checkbox_img('no-resolv', $cf->main_array["no-resolv"], '{enable_disable}') . "</td>\n<td align='left' valign='top' class=bottom style='font-size:9px'>{no-resolv_text}</td>\n</tr>\n<tr>\n<td align='right' valign='top' class=bottom valign='top' class=bottom style='font-weight:bold'>{no-negcache}:</td>\n<td align='left' valign='top' class=bottom>" . Field_key_checkbox_img('no-negcache', $cf->main_array["no-negcache"], '{enable_disable}') . "</td>\n<td align='left' valign='top' class=bottom style='font-size:9px'>{no-negcache_text}</td>\n</tr>\n\n\n\n<tr>\n<td align='right' valign='top' class=bottom valign='top' class=bottom style='font-weight:bold'>{no-poll}:</td>\n<td align='left' valign='top' class=bottom>" . Field_key_checkbox_img('no-poll', $cf->main_array["no-poll"], '{enable_disable}') . "</td>\n<td align='left' valign='top' class=bottom style='font-size:9px'>{no-poll_text}</td>\n</tr>\n\n<tr>\n<td align='right' valign='top' class=bottom valign='top' class=bottom style='font-weight:bold'>{log-queries}:</td>\n<td align='left' valign='top' class=bottom>" . Field_key_checkbox_img('log-queries', $cf->main_array["log-queries"], '{enable_disable}') . "</td>\n<td align='left' valign='top' class=bottom style='font-size:9px'>{log-queries_text}</td>\n</tr>\n\n\n\n</table>\n\n<table style='width:100%'>\n</tr>\n<td align='right' valign='top' class=bottom valign='top' class=bottom style='font-weight:bold' nowrap>{resolv-file}:</td>\n<td align='left' valign='top' class=bottom>" . Field_text('resolv-file', $cf->main_array["resolv-file"]) . "</td>\n<td align='left' valign='top' class=bottom style='font-size:9px'>{resolv-file_text}</td>\n</tr>\n</tr>\n<td align='right' valign='top' class=bottom valign='top' class=bottom style='font-weight:bold' nowrap>{cache-size}:</td>\n<td align='left' valign='top' class=bottom>" . Field_text('cache-size', $cf->main_array["cache-size"]) . "</td>\n<td align='left' valign='top' class=bottom style='font-size:9px'>{cache-size_text}</td>\n</tr>\n\n</tr>\n<td align='right' valign='top' class=bottom valign='top' class=bottom style='font-weight:bold' nowrap>{dnsmasq_domain}:</td>\n<td align='left' valign='top' class=bottom>" . Field_text('domain', $cf->main_array["domain"]) . "</td>\n<td align='left' valign='top' class=bottom style='font-size:9px'>{dnsmasq_domain_text}</td>\n</tr>\n\n</tr>\n<td colspan=3 align='right'><input type='button' value='{edit}&nbsp;&raquo;' OnClick=\"javascript:ParseForm('ffm1','{$page}',true);\"></td>\n</tr>\n</table>\n</form>\n\n<H4>{dnmasq_interface}</H4>\n<p>{dnmasq_interface_text}</p>\n<form name='ffm2'>\n<table style='width:130px'><tr><td>{$interfaces}&nbsp;</td><td><input type='button' value='{add}&nbsp;&raquo;' OnClick=\"javascript:ParseForm('ffm2','{$page}',true);InterfacesReload()\" style='margin:0px;'></td></tr></table>\n</form>\n<div id='dnmasq_interface'>" . LoadInterfaces() . "</div>\n\n\n<H4>{dnsmasq_listen_address}</H4>\n<p>{dnsmasq_listen_address_text}</p>\n<form name='ffm21'>\n<table style='width:170px'><tr><td>{$tcpaddr}&nbsp;</td><td><input type='button' value='{add}&nbsp;&raquo;' OnClick=\"javascript:ParseForm('ffm21','{$page}',true);ListentAddressesReload()\" style='margin:0px;'></td></tr></table>\n</form>\n<div id='dnsmasq_listen_address'>" . LoadListenAddress() . "</div>\n\n\n\n<H4>{dnsmasq_address}</h4>\n<p>{dnsmasq_address_text}</p>\n<center>\n<form name='ffm3'>\n<table style='width:100%'>\n<tr>\n\t<td nowrap><strong>{domain_or_server}</strong></td>\n\t<td>" . Field_text('address_server') . "</td>\n\t<td nowrap><strong>{ip}</strong>\n\t<td>" . Field_text('address_ip') . "</td>\n\t<td><input type='button' value='{add}&nbsp;&raquo;' OnClick=\"javascript:ParseForm('ffm3','{$page}',true);addressesReload();\"></td>\n\t</tr>\n\t</table>\n\t</center>\n</form>\n<div id='array_addresses'>" . Loadaddresses() . "</div>\n";
    $JS["JS"][] = 'js/dnsmasq.js';
    $tpl = new template_users('{dnsmasq_settings}', $html, 0, 0, 0, 0, $JS);
    echo $tpl->web_page;
}
    exit;
}
if (isset($_POST["restart-dnsmasq"])) {
    restart_service();
    exit;
}
if (isset($_GET["interfaces"])) {
    interfaces();
    exit;
}
if (isset($_GET["ffm1"])) {
    main_form();
    exit;
}
if (isset($_GET["addressesReload"])) {
    echo Loadaddresses();
    exit;
}
if (isset($_GET["DnsmasqDeleteInterface"])) {
    DnsmasqDeleteInterface();
    exit;
}
if (isset($_GET["listen_addresses"])) {
    SaveListenAddress();
    exit;
}
if (isset($_GET["DnsmasqDeleteListenAddress"])) {
    DnsmasqDeleteListenAddress();
    exit;
}
if (isset($_GET["EnableDNSMASQ"])) {
include_once 'ressources/class.system.network.inc';
if (posix_getuid() != 0) {
    $user = new usersMenus();
    if ($user->AsDnsAdministrator == false) {
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body("alert('{ERROR_NO_PRIVS}');");
        die;
        exit;
    }
}
if (isset($_GET["list"])) {
    interfaces_list();
    exit;
}
if (isset($_GET["hosts"])) {
    Loadaddresses();
    exit;
}
if (isset($_POST["SuricataEnableInterface"])) {
    SuricataEnableInterface();
    exit;
}
if (isset($_POST["SuricataDeleteInterface"])) {
    SuricataDeleteInterface();
    exit;
}
if (isset($_GET["add-interface-js"])) {
    add_interface_js();
    exit;
}
if (isset($_GET["add-interface-popup"])) {
	
	if(posix_getuid()<>0){
		$user=new usersMenus();
		if($user->AsDnsAdministrator==false){
			$tpl=new templates();
			echo $tpl->_ENGINE_parse_body("alert('{ERROR_NO_PRIVS}');");
			die();exit();
		}
	}	
	
	
if(isset($_GET["SaveConf1"])){SaveConf1();exit;}
if(isset($_GET["interfaces"])){interfaces();exit;}
if(isset($_GET["InterfacesReload"])){echo LoadInterfaces();exit;}
if(isset($_GET["addressesReload"])){echo Loadaddresses();exit;}
if(isset($_GET["ListentAddressesReload"])){echo LoadListenAddress();exit;}
if(isset($_GET["DnsmasqDeleteInterface"])){DnsmasqDeleteInterface();exit;}

if(isset($_GET["listen_addresses"])){SaveListenAddress();exit;}
if(isset($_GET["DnsmasqDeleteListenAddress"])){DnsmasqDeleteListenAddress();exit;}
if(isset($_GET["EnableDNSMASQ"])){EnableDNSMASQSave();exit;}
if(isset($_GET["get-status"])){status();exit;}




page();

function status(){
	$tpl=new templates();