Пример #1
0
function popup()
{
    $tpl = new templates();
    $sock = new sockets();
    $page = CurrentPageName();
    $users = new usersMenus();
    $squid = new squidbee();
    $EnableArticaHotSpot = $sock->GET_INFO("EnableArticaHotSpot");
    $SquidHotSpotPort = intval($sock->GET_INFO("SquidHotSpotPort"));
    $ArticaHotSpotPort = intval($sock->GET_INFO("ArticaHotSpotPort"));
    $ArticaSSLHotSpotPort = $sock->GET_INFO("ArticaSSLHotSpotPort");
    $ArticaSplashHotSpotPort = $sock->GET_INFO("ArticaSplashHotSpotPort");
    $ArticaSplashHotSpotPortSSL = $sock->GET_INFO("ArticaSplashHotSpotPortSSL");
    $ArticaSplashHotSpotCertificate = $sock->GET_INFO("ArticaSplashHotSpotCertificate");
    $SquidHotSpotSSLPort = intval($sock->GET_INFO("SquidHotSpotSSLPort"));
    $WifiDogDebugLevel = intval($sock->GET_INFO("WifiDogDebugLevel"));
    $ArticaHotSpotInterface2 = $sock->GET_INFO("ArticaHotSpotInterface2");
    $WifidogClientTimeout = intval($sock->GET_INFO("WifidogClientTimeout"));
    if ($WifidogClientTimeout < 5) {
        $WifidogClientTimeout = 30;
    }
    $HospotHTTPServerName = trim($sock->GET_INFO("HospotHTTPServerName"));
    $HotSpotDenySSL = intval($sock->GET_INFO("HotSpotDenySSL"));
    $ArticaHotSpotInterface = $sock->GET_INFO("ArticaHotSpotInterface");
    if (!$users->CONNTRACK_INSTALLED) {
        echo FATAL_ERROR_SHOW_128("{conntrackd_not_installed}");
    }
    $WifiDogDebugLevelZ[null] = "{none}";
    for ($i = 0; $i < 11; $i++) {
        $WifiDogDebugLevelZ[$i] = $i;
    }
    $Timez[30] = "30 {minutes}";
    $Timez[60] = "1 {hour}";
    $Timez[120] = "2 {hours}";
    $Timez[180] = "3 {hours}";
    $Timez[360] = "6 {hours}";
    $Timez[720] = "12 {hours}";
    $Timez[1440] = "1 {day}";
    $Timez[2880] = "2 {days}";
    $Timez[10080] = "1 {week}";
    $Timez[20160] = "2 {weeks}";
    $Timez[40320] = "1 {month}";
    $ArticaHotSpotEnableMIT = $sock->GET_INFO("ArticaHotSpotEnableMIT");
    $ArticaHotSpotEnableProxy = $sock->GET_INFO("ArticaHotSpotEnableProxy");
    if (!is_numeric($ArticaHotSpotEnableMIT)) {
        $ArticaHotSpotEnableMIT = 1;
    }
    if (!is_numeric($ArticaHotSpotEnableProxy)) {
        $ArticaHotSpotEnableProxy = 1;
    }
    if (!is_numeric($ArticaHotSpotPort)) {
        $ArticaHotSpotPort = 0;
    }
    if (!is_numeric($ArticaSplashHotSpotPort)) {
        $ArticaSplashHotSpotPort = 16080;
    }
    if (!is_numeric($ArticaSplashHotSpotPortSSL)) {
        $ArticaSplashHotSpotPortSSL = 16443;
    }
    $Params = unserialize($sock->GET_INFO("HotSpotEvasive"));
    $ApacheEvasiveInstalled = intval($sock->GET_INFO("ApacheEvasiveInstalled"));
    if (!is_numeric($Params["DOSEnable"])) {
        $Params["DOSEnable"] = 1;
    }
    if (!is_numeric($Params["DOSHashTableSize"])) {
        $Params["DOSHashTableSize"] = 1024;
    }
    if (!is_numeric($Params["DOSPageCount"])) {
        $Params["DOSPageCount"] = 3;
    }
    if (!is_numeric($Params["DOSSiteCount"])) {
        $Params["DOSSiteCount"] = 20;
    }
    if (!is_numeric($Params["DOSPageInterval"])) {
        $Params["DOSPageInterval"] = 1;
    }
    if (!is_numeric($Params["DOSSiteInterval"])) {
        $Params["DOSSiteInterval"] = 10;
    }
    if (!is_numeric($Params["DOSBlockingPeriod"])) {
        $Params["DOSBlockingPeriod"] = 5;
    }
    $HotSpotErrorRedirect = $sock->GET_INFO("HotSpotErrorRedirect");
    $ArticaSplashHotSpotTitle = $sock->GET_INFO("ArticaSplashHotSpotTitle");
    if ($ArticaSplashHotSpotTitle == null) {
        $ArticaSplashHotSpotTitle = "HotSpot system";
    }
    if ($ArticaHotSpotPort == 0) {
        $ArticaHotSpotPort = rand(38000, 64000);
        $sock->SET_INFO("ArticaHotSpotPort", $ArticaHotSpotPort);
    }
    if ($ArticaSSLHotSpotPort == 0) {
        $ArticaSSLHotSpotPort = rand(38500, 64000);
        $sock->SET_INFO("ArticaSSLHotSpotPort", $ArticaSSLHotSpotPort);
    }
    if ($SquidHotSpotPort == 0) {
        $SquidHotSpotPort = rand(40000, 64000);
        $sock->SET_INFO("SquidHotSpotPort", $SquidHotSpotPort);
    }
    if ($SquidHotSpotSSLPort == 0) {
        $SquidHotSpotSSLPort = rand(40500, 64000);
        $sock->SET_INFO("SquidHotSpotSSLPort", $SquidHotSpotSSLPort);
    }
    $tcp = new networking();
    $interfacesZ = $tcp->Local_interfaces();
    while (list($interface, $line) = each($interfacesZ)) {
        $p = new system_nic($interface);
        if ($p->IsBridged($interface)) {
            continue;
        }
        $interfaces[$interface] = $p->NICNAME;
    }
    $HotSpotUseSSL = 1;
    $HospotNoSSL = intval($sock->GET_INFO("HospotNoSSL"));
    if ($HospotNoSSL == 1) {
        $HotSpotUseSSL = 0;
    }
    if ($HotSpotDenySSL == 1) {
        $HotSpotUseSSL = 0;
    }
    $interfaces[null] = "{none}";
    include_once dirname(__FILE__) . "/ressources/class.squid.reverse.inc";
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    if ($HotSpotErrorRedirect == null) {
        $HotSpotErrorRedirect = "http://www.bing.com";
    }
    $t = time();
    $html = "\n\t\n\t\n\t<div id='{$t}' class=explain style='font-size:20px'>{HotSpot_text}<br>{HotSpot_infra_text}</div>\n\t<div style='width:98%' class=form>\n\t<table style='width:99%'>\n\t\n\t<tr>\n\t\t<td  style='font-size:42px' colspan=2>{sessions}:</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{session_time}", "{wifidog_disconnect_time}") . ":</td>\n\t\t<td>" . Field_array_Hash($Timez, "WifidogClientTimeout", $WifidogClientTimeout, "style:font-size:22px") . "</td>\n\t</tr>\t\t\n\t\n\t<tr>\n\t\t<td  style='font-size:42px' colspan>{service2}:</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{listen_port}:</td>\n\t\t<td>" . Field_text("ArticaHotSpotPort", $ArticaHotSpotPort, "font-size:22px;width:110px") . "</td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{interface} (IN):</td>\n\t\t<td>" . Field_array_Hash($interfaces, "ArticaHotSpotInterface", $ArticaHotSpotInterface, "style:font-size:22px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{interface} (OUT):</td>\n\t\t<td>" . Field_array_Hash($interfaces, "ArticaHotSpotInterface2", $ArticaHotSpotInterface2, "style:font-size:22px") . "</td>\n\t</tr>\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{log_level}:</td>\n\t\t<td>" . Field_array_Hash($WifiDogDebugLevelZ, "WifiDogDebugLevel", $WifiDogDebugLevel, "style:font-size:22px") . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td  style='font-size:42px' colspan=2>{webserver}:</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{HospotHTTPServerName}", "{HospotHTTPServerName_explain}") . ":</td>\n\t\t<td>" . Field_text("HospotHTTPServerName", $HospotHTTPServerName, "font-size:22px;width:300px") . "</td>\n\t</tr>\n\n\t<tr><td  style='font-size:42px' colspan=2>&nbsp;</td></tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{FreeWebsEnableModEvasive}", "{mod_evasive_explain}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_checkbox_design("DOSEnable", 1, $Params["DOSEnable"], "EvasiveDisabled()") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{DOSHashTableSize}", "{DOSHashTableSize_explain}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_text("DOSHashTableSize", $Params["DOSHashTableSize"], "font-size:22px;width:110px") . "&nbsp;MB</td>\n\t</tr>\t\n\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{threshold}", "{DOSPageCount_explain}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_text("DOSPageCount", $Params["DOSPageCount"], "font-size:22px;width:110px") . "</td>\n\t</tr>\n\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{total_threshold}", "{DOSSiteCount_explain}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_text("DOSSiteCount", $Params["DOSSiteCount"], "font-size:22px;width:110px") . "</td>\n\t</tr>\n\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{page_interval}", "{DOSPageInterval_explain}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_text("DOSPageInterval", $Params["DOSPageInterval"], "font-size:22px;width:110px") . "&nbsp;{seconds}</td>\n\t</tr>\t\n\t\n\n\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{site_interval}", "{DOSSiteInterval_explain}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_text("DOSSiteInterval", $Params["DOSSiteInterval"], "font-size:22px;width:110px") . "&nbsp;{seconds}</td>\n\t</tr>\n\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{Blocking_period}", "{DOSBlockingPeriod_explain}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_text("DOSBlockingPeriod", $Params["DOSBlockingPeriod"], "font-size:22px;width:110px") . "&nbsp;{seconds}</td>\n\t\t\n\t</tr>\n\t<tr><td  style='font-size:42px' colspan=2>&nbsp;</td></tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{listen_authentication_http_port}:</td>\n\t\t<td>" . Field_text("ArticaSplashHotSpotPort", $ArticaSplashHotSpotPort, "font-size:22px;width:110px") . "</td>\n\t</tr>\t\t\t\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{listen_authentication_https_port}:</td>\n\t\t<td>" . Field_text("ArticaSplashHotSpotPortSSL", $ArticaSplashHotSpotPortSSL, "font-size:22px;width:110px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{http_error_redirect}", "{wifidog_http_error_redirect_explain}") . ":</td>\n\t\t<td>" . Field_text("HotSpotErrorRedirect", $HotSpotErrorRedirect, "font-size:22px;width:400px") . "</td>\n\t</tr>\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{ssl_redirection}", "{wifidog_use_ssl_explain}") . ":</td>\n\t\t<td>" . Field_checkbox_design("HotSpotUseSSL", 1, $HotSpotUseSSL) . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{deny_ssl}", "{wifidog_deny_ssl_explain}") . ":</td>\n\t\t<td>" . Field_checkbox_design("HotSpotDenySSL", 1, $HotSpotDenySSL) . "</td>\n\t</tr>\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:22px;'>{certificate}:</td>\n\t\t<td >" . Field_array_Hash($sslcertificates, "ArticaSplashHotSpotCertificate", $ArticaSplashHotSpotCertificate, null, null, 0, "font-size:22px") . "</td>\n\t</tr>\n<tr><td style='font-size:16px;text-align:right' colspan=2> " . texttooltip("{see} {certificates_center}", "position:right:{certificate_center_explain}", "GotoCertificatesCenter()") . "</td>\n</tr>\n\t\t\t\t\t\t\n\t<tr>\n\t\t<td  style='font-size:42px' colspan=2>Proxy:</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{transparent_ssl}", "{wifidog_transparent_ssl_explain}") . ":</td>\n\t\t<td>" . Field_checkbox_design("ArticaHotSpotEnableMIT", 1, $ArticaHotSpotEnableMIT) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>." . texttooltip("{transparent_http}", "{wifidog_transparent_http_explain}") . ":</td>\n\t\t<td>" . Field_checkbox_design("ArticaHotSpotEnableProxy", 1, $ArticaHotSpotEnableProxy) . "</td>\n\t</tr>\t\t\t\t\t\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{listen_proxy_http_port}:</td>\n\t\t<td>" . Field_text("SquidHotSpotPort", $SquidHotSpotPort, "font-size:22px;width:110px") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{listen_proxy_https_port}:</td>\n\t\t<td>" . Field_text("SquidHotSpotSSLPort", $SquidHotSpotSSLPort, "font-size:22px;width:110px") . "</td>\n\t</tr>\t\t\t\t\t\n\n\t\t\t\t\t\t\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . button("{apply}", "SaveHotSpot()", "42px") . "</td>\n\t</tr>\n\t</table>\n\t</div>\n\t<script>\n\tvar x_SaveHotSpot= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);return;}\n\t\tLoadjs('squid.webauth.restart.php');\n\n\t}\n\n\nfunction SaveHotSpot(){\n\t\tvar XHR = new XHRConnection();\n\t\t\n\t\tXHR.appendData('ArticaHotSpotPort',document.getElementById('ArticaHotSpotPort').value);\n\t\tXHR.appendData('SquidHotSpotPort',document.getElementById('SquidHotSpotPort').value);\n\t\t\n\t\tXHR.appendData('ArticaSplashHotSpotPort',document.getElementById('ArticaSplashHotSpotPort').value);\n\t\tXHR.appendData('ArticaSplashHotSpotPortSSL',document.getElementById('ArticaSplashHotSpotPortSSL').value);\n\t\tXHR.appendData('ArticaHotSpotInterface',document.getElementById('ArticaHotSpotInterface').value);\n\t\tXHR.appendData('ArticaHotSpotInterface2',document.getElementById('ArticaHotSpotInterface2').value);\n\t\tXHR.appendData('HospotHTTPServerName',document.getElementById('HospotHTTPServerName').value);\n\t\t\n\t\tXHR.appendData('ArticaSplashHotSpotCertificate',document.getElementById('ArticaSplashHotSpotCertificate').value);\n\t\t\n\t\tXHR.appendData('WifiDogDebugLevel',document.getElementById('WifiDogDebugLevel').value);\n\t\tXHR.appendData('WifidogClientTimeout',document.getElementById('WifidogClientTimeout').value);\n\t\t\n\t\t\n\t\tif(document.getElementById('DOSEnable').checked){XHR.appendData('DOSEnable',1);}else{XHR.appendData('DOSEnable',0);}\n\t\tXHR.appendData('DOSHashTableSize',document.getElementById('DOSHashTableSize').value);\n\t\tXHR.appendData('DOSPageCount',document.getElementById('DOSPageCount').value);\n\t\tXHR.appendData('DOSSiteCount',document.getElementById('DOSSiteCount').value);\n\t\tXHR.appendData('DOSPageInterval',document.getElementById('DOSPageInterval').value);\n\t\tXHR.appendData('DOSSiteInterval',document.getElementById('DOSSiteInterval').value);\n\t\tXHR.appendData('DOSBlockingPeriod',document.getElementById('DOSBlockingPeriod').value);\n\t\t\n\t\t\n\t\tif(document.getElementById('ArticaHotSpotEnableMIT').checked){\n\t\t\tXHR.appendData('ArticaHotSpotEnableMIT',1);\n\t\t}else{\n\t\t\tXHR.appendData('ArticaHotSpotEnableMIT',0);\n\t\t}\n\t\tif(document.getElementById('HotSpotUseSSL').checked){\n\t\t\tXHR.appendData('HospotNoSSL',0);\n\t\t}else{\n\t\t\tXHR.appendData('HospotNoSSL',1);\n\t\t}\n\t\tif(document.getElementById('HotSpotDenySSL').checked){\n\t\t\tXHR.appendData('HotSpotDenySSL',1);\n\t\t}else{\n\t\t\tXHR.appendData('HotSpotDenySSL',0);\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t\tif(document.getElementById('ArticaHotSpotEnableProxy').checked){\n\t\t\tXHR.appendData('ArticaHotSpotEnableProxy',1);\n\t\t}else{\n\t\t\tXHR.appendData('ArticaHotSpotEnableProxy',0);\n\t\t}\t\n\t\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveHotSpot);\n\t}\t\n\n\t\n\t\n\tfunction EvasiveDisabled(){\n\t\tdocument.getElementById('DOSHashTableSize').disabled=true;\n\t\tdocument.getElementById('DOSPageCount').disabled=true;\n\t\tdocument.getElementById('DOSSiteCount').disabled=true;\n\t\tdocument.getElementById('DOSPageInterval').disabled=true;\n\t\tdocument.getElementById('DOSSiteInterval').disabled=true;\n\t\tdocument.getElementById('DOSBlockingPeriod').disabled=true;\n\t\t\n\t\tvar ApacheEvasiveInstalled={$ApacheEvasiveInstalled};\n\t\tif(ApacheEvasiveInstalled==0){\n\t\t\tdocument.getElementById('DOSEnable').checked=false;\n\t\t\tdocument.getElementById('DOSEnable').disabled=true;\n\t\t\treturn;\n\t\t}\n\t\n\t\tif(document.getElementById('DOSEnable').checked){\t\n\t\t\tdocument.getElementById('DOSHashTableSize').disabled=false;\n\t\t\tdocument.getElementById('DOSPageCount').disabled=false;\n\t\t\tdocument.getElementById('DOSSiteCount').disabled=false;\n\t\t\tdocument.getElementById('DOSPageInterval').disabled=false;\n\t\t\tdocument.getElementById('DOSSiteInterval').disabled=false;\n\t\t\tdocument.getElementById('DOSBlockingPeriod').disabled=false;\t\n\t\t\t}\t\t\n\t}\t\n\t\nEvasiveDisabled();\t\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #2
0
function routes_del($md5)
{
    $unix = new unix();
    $route = $unix->find_program("route");
    $q = new mysql();
    $sql = "SELECT * FROM nic_routes WHERE `zmd5`='{$md5}'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    $type = $ligne["type"];
    $ttype = "-net";
    if ($type == 1) {
        $ttype = "-net";
    }
    if ($type == 2) {
        $ttype = "-host";
    }
    $NetBuilder = new system_nic();
    if ($NetBuilder->IsBridged($ligne["nic"])) {
        $ligne["nic"] = $ligne["BridgedTo"];
    }
    if ($ligne["nic"] != null) {
        $dev = " dev {$ligne["nic"]}";
    }
    $cmd = "{$route} del {$ttype} {$ligne["pattern"]} gw {$ligne["gateway"]}{$dev}";
    if ($GLOBALS["VERBOSE"]) {
        echo $cmd . "\n";
    }
    shell_exec("{$cmd} >/dev/null 2>&1");
    $sql = "DELETE FROM nic_routes WHERE `zmd5`='{$md5}'";
    $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo $q->mysql_error;
        return;
    }
}
Пример #3
0
function popup(){
	$tpl=new templates();
	$sock=new sockets();
	$page=CurrentPageName();
	$users=new usersMenus();
	$squid=new squidbee();
	$EnableArticaHotSpot=$sock->GET_INFO("EnableArticaHotSpot");
	$SquidHotSpotPort=intval($sock->GET_INFO("SquidHotSpotPort"));
	$ArticaHotSpotPort=intval($sock->GET_INFO("ArticaHotSpotPort"));
	$ArticaSSLHotSpotPort=$sock->GET_INFO("ArticaSSLHotSpotPort");
	$ArticaSplashHotSpotPort=$sock->GET_INFO("ArticaSplashHotSpotPort");
	$ArticaSplashHotSpotPortSSL=$sock->GET_INFO("ArticaSplashHotSpotPortSSL");
	$ArticaSplashHotSpotCacheAuth=$sock->GET_INFO("ArticaSplashHotSpotCacheAuth");
	$ArticaSplashHotSpotCertificate=$sock->GET_INFO("ArticaSplashHotSpotCertificate");
	$ArticaSplashHotSpotEndTime=$sock->GET_INFO("ArticaSplashHotSpotEndTime");
	$SquidHotSpotSSLPort=intval($sock->GET_INFO("SquidHotSpotSSLPort"));
	$WifiDogDebugLevel=intval($sock->GET_INFO("WifiDogDebugLevel"));
	$ArticaHotSpotInterface2=$sock->GET_INFO("ArticaHotSpotInterface2");
	
	
	if(!is_numeric($ArticaSplashHotSpotCacheAuth)){$ArticaSplashHotSpotCacheAuth=60;}
	if(!is_numeric($ArticaSplashHotSpotEndTime)){$ArticaSplashHotSpotEndTime=0;}
	
	$ArticaHotSpotInterface=$sock->GET_INFO("ArticaHotSpotInterface");
	
	if(!$users->CONNTRACK_INSTALLED){
		echo FATAL_WARNING_SHOW_128("{conntrackd_not_installed}");
	}
	
	for($i=0;$i<11;$i++){
		$WifiDogDebugLevelZ[$i]=$i;
	}
	
	$Timez[60]="1 {hour}";
	$Timez[120]="2 {hours}";
	$Timez[180]="3 {hours}";
	$Timez[360]="6 {hours}";
	$Timez[720]="12 {hours}";
	$Timez[1440]="1 {day}";
	$Timez[2880]="2 {days}";
	$Timez[10080]="1 {week}";
	
	
	$Timez[0]="{unlimited}";
	$Timez[30]="30 {minutes}";
	$Timez[60]="1 {hour}";
	$Timez[120]="2 {hours}";
	$Timez[180]="3 {hours}";
	$Timez[360]="6 {hours}";
	$Timez[720]="12 {hours}";
	$Timez[1440]="1 {day}";
	$Timez[2880]="2 {days}";
	$Timez[10080]="1 {week}";
	$Timez[20160]="2 {weeks}";
	$Timez[40320]="1 {month}";
	
	$ArticaHotSpotEnableMIT=$sock->GET_INFO("ArticaHotSpotEnableMIT");
	$ArticaHotSpotEnableProxy=$sock->GET_INFO("ArticaHotSpotEnableProxy");
	
	if(!is_numeric($ArticaHotSpotEnableMIT)){$ArticaHotSpotEnableMIT=1;}
	if(!is_numeric($ArticaHotSpotEnableProxy)){$ArticaHotSpotEnableProxy=1;}
	
	if(!is_numeric($ArticaHotSpotPort)){$ArticaHotSpotPort=0;}
	if(!is_numeric($ArticaSplashHotSpotPort)){$ArticaSplashHotSpotPort=16080;}
	if(!is_numeric($ArticaSplashHotSpotPortSSL)){$ArticaSplashHotSpotPortSSL=16443;}
	
	
	$ArticaSplashHotSpotTitle=$sock->GET_INFO("ArticaSplashHotSpotTitle");
	if($ArticaSplashHotSpotTitle==null){$ArticaSplashHotSpotTitle="HotSpot system";}
	
	if($ArticaHotSpotPort==0){
		$ArticaHotSpotPort=rand(38000, 64000);
		$sock->SET_INFO("ArticaHotSpotPort", $ArticaHotSpotPort);
	}
	
	if($ArticaSSLHotSpotPort==0){
		$ArticaSSLHotSpotPort=rand(38500, 64000);
		$sock->SET_INFO("ArticaSSLHotSpotPort", $ArticaSSLHotSpotPort);
	}
	
	if($SquidHotSpotPort==0){
		$SquidHotSpotPort=rand(40000, 64000);
		$sock->SET_INFO("SquidHotSpotPort", $SquidHotSpotPort);
	}
	
	if($SquidHotSpotSSLPort==0){
		$SquidHotSpotSSLPort=rand(40500, 64000);
		$sock->SET_INFO("SquidHotSpotSSLPort", $SquidHotSpotSSLPort);
	}
	
	
	$tcp=new networking();
	$interfacesZ=$tcp->Local_interfaces();
	while (list ($interface, $line) = each ($interfacesZ) ){
		$p=new system_nic($interface);
		if($p->IsBridged($interface)){continue;}
		$interfaces[$interface]=$p->NICNAME;
		
	}
	
	
	
	
	
	$interfaces[null]="{none}";
	include_once(dirname(__FILE__)."/ressources/class.squid.reverse.inc");
	$squid_reverse=new squid_reverse();
	$sslcertificates=$squid_reverse->ssl_certificates_list();
	
	
	$t=time();
	$html="
	
	
	<div id='$t' class=text-info style='font-size:18px'>{HotSpot_text}</div>
	<div style='width:98%' class=form>
	<table style='width:99%'>
	<tr>
		<td colspan=2>
		<center><img src='img/hotspot-howto.png' align=center></center>
		</td>
	</tr>
	<tr>
		<td  style='font-size:42px' colspan>{service2}:</td>
	</tr>		
	<tr>
		<td class=legend style='font-size:22px'>{listen_port} (HotSpot):</td>
		<td>". Field_text("ArticaHotSpotPort",$ArticaHotSpotPort,"font-size:22px;width:110px")."</td>
	</tr>		
	<tr>
		<td class=legend style='font-size:22px'>{interface} (IN):</td>
		<td>". Field_array_Hash($interfaces,"ArticaHotSpotInterface", $ArticaHotSpotInterface,"style:font-size:22px")."</td>
	</tr>
	<tr>
		<td class=legend style='font-size:22px'>{interface} (OUT):</td>
		<td>". Field_array_Hash($interfaces,"ArticaHotSpotInterface2", $ArticaHotSpotInterface2,"style:font-size:22px")."</td>
	</tr>
				
	<tr>
		<td class=legend style='font-size:22px'>{log_level}:</td>
		<td>". Field_array_Hash($WifiDogDebugLevelZ,"WifiDogDebugLevel", $WifiDogDebugLevel,"style:font-size:22px")."</td>
	</tr>				
	<tr>
		<td  style='font-size:42px' colspan>{webserver}:</td>
	</tr>	
	<tr>
		<td class=legend style='font-size:22px'>{listen_port} (splash):</td>
		<td>". Field_text("ArticaSplashHotSpotPort",$ArticaSplashHotSpotPort,"font-size:22px;width:110px")."</td>
	</tr>							
	<tr>
		<td class=legend style='font-size:22px'>{listen_port} (splash/SSL):</td>
		<td>". Field_text("ArticaSplashHotSpotPortSSL",$ArticaSplashHotSpotPortSSL,"font-size:22px;width:110px")."</td>
	</tr>
	<tr>
		<td  style='font-size:42px' colspan>Proxy:</td>
	</tr>
	<tr>
		<td class=legend style='font-size:22px'>{transparent_ssl}:</td>
		<td>". Field_checkbox("ArticaHotSpotEnableMIT",1,$ArticaHotSpotEnableMIT)."</td>
	</tr>
	<tr>
		<td class=legend style='font-size:22px'>{transparent_http}:</td>
		<td>". Field_checkbox("ArticaHotSpotEnableProxy",1,$ArticaHotSpotEnableProxy)."</td>
	</tr>									
	<tr>
		<td class=legend style='font-size:22px'>{listen_port} (Proxy HTTP):</td>
		<td>". Field_text("SquidHotSpotPort",$SquidHotSpotPort,"font-size:22px;width:110px")."</td>
	</tr>	
	<tr>
		<td class=legend style='font-size:22px'>{listen_port} (Proxy SSL):</td>
		<td>". Field_text("SquidHotSpotSSLPort",$SquidHotSpotSSLPort,"font-size:22px;width:110px")."</td>
	</tr>					
	
	<tr>
		<td  style='font-size:42px' colspan>{defaults}:</td>
	</tr>	
	<tr>
		<td class=legend style='font-size:22px;text-transform:capitalize'>{re_authenticate_each} ({default}):</td>
		<td style='font-size:18px'>". Field_array_Hash($Timez,"ArticaSplashHotSpotCacheAuth",
					$ArticaSplashHotSpotCacheAuth,null,null,0,"font-size:22px")."</td>
	</tr>
	<tr>
		<td class=legend style='font-size:22px;text-transform:capitalize'>{endtime} ({default}):</td>
		<td style='font-size:18px'>". Field_array_Hash($Timez,"ArticaSplashHotSpotEndTime",
				$ArticaSplashHotSpotEndTime,null,null,0,"font-size:22px")."</td>
	</tr>
				
	<tr>
		<td  style='font-size:42px' colspan>{web_page}:</td>
	</tr>
	<tr>
		<td class=legend style='font-size:22px'>{title2}:</td>
		<td>". Field_text("ArticaSplashHotSpotTitle",$ArticaSplashHotSpotTitle,"font-size:22px;width:390px")."</td>
	</tr>	
	<tr>
		<td class=legend nowrap style='font-size:22px;'>{certificate}:</td>
		<td >". Field_array_Hash($sslcertificates, "ArticaSplashHotSpotCertificate",
				$ArticaSplashHotSpotCertificate,null,null,0,"font-size:22px")."</td>
	</tr>
	<tr>
		<td colspan=2 align='right'><hr>". button("{apply}","SaveHotSpot()","42px")."</td>
	</tr>
	</table>
	</div>
	<script>
	var x_SaveHotSpot= function (obj) {
		var results=obj.responseText;
		if(results.length>3){alert(results);return;}
		Loadjs('squid.webauth.restart.php');

	}


function SaveHotSpot(){
		var XHR = new XHRConnection();
		
		XHR.appendData('ArticaHotSpotPort',document.getElementById('ArticaHotSpotPort').value);
		XHR.appendData('SquidHotSpotPort',document.getElementById('SquidHotSpotPort').value);
		
		XHR.appendData('ArticaSplashHotSpotPort',document.getElementById('ArticaSplashHotSpotPort').value);
		XHR.appendData('ArticaSplashHotSpotPortSSL',document.getElementById('ArticaSplashHotSpotPortSSL').value);
		XHR.appendData('ArticaHotSpotInterface',document.getElementById('ArticaHotSpotInterface').value);
		XHR.appendData('ArticaHotSpotInterface2',document.getElementById('ArticaHotSpotInterface2').value);
		
		XHR.appendData('ArticaSplashHotSpotCacheAuth',document.getElementById('ArticaSplashHotSpotCacheAuth').value);
		XHR.appendData('ArticaSplashHotSpotCertificate',document.getElementById('ArticaSplashHotSpotCertificate').value);
		XHR.appendData('ArticaSplashHotSpotEndTime',document.getElementById('ArticaSplashHotSpotEndTime').value);
		XHR.appendData('WifiDogDebugLevel',document.getElementById('WifiDogDebugLevel').value);
		
		
		if(document.getElementById('ArticaHotSpotEnableMIT').checked){
			XHR.appendData('ArticaHotSpotEnableMIT',1);
		}else{
			XHR.appendData('ArticaHotSpotEnableMIT',0);
		}
		if(document.getElementById('ArticaHotSpotEnableProxy').checked){
			XHR.appendData('ArticaHotSpotEnableProxy',1);
		}else{
			XHR.appendData('ArticaHotSpotEnableProxy',0);
		}		
		
		
		var ArticaSplashHotSpotTitle=encodeURIComponent(document.getElementById('ArticaSplashHotSpotTitle').value);
		XHR.appendData('ArticaSplashHotSpotTitle',document.getElementById('ArticaSplashHotSpotTitle').value);
		XHR.sendAndLoad('$page', 'POST',x_SaveHotSpot);
	}		
	</script>
	";
	
	echo $tpl->_ENGINE_parse_body($html);
	
	
}