Browse Source

2022-12-16 / ct_chen

Actions:
1. Webservice add firewall parameters

Files:
1. EVSE/Modularization/WebService.c
   EVSE/rootfs/var/www/set_network.php
   EVSE/rootfs/var/www/set_network_action.php
ct_chen 2 years ago
parent
commit
1aabb27bd2

+ 81 - 0
EVSE/Modularization/WebService.c

@@ -978,6 +978,17 @@ int main(int argc, char *argv[]) {
 			char TelcomNetworkType=0;
 			char Wcnt=0;
 			char Tcnt=0;
+			char isEnalbleFirewall=0;
+			char *FirewallAcceptAddr0=NULL;
+			char *FirewallAcceptAddr1=NULL;
+			char *FirewallAcceptAddr2=NULL;
+			char *FirewallAcceptAddr3=NULL;
+			char *FirewallAcceptAddr4=NULL;
+			char *FirewallAcceptAddr5=NULL;
+			char *FirewallAcceptAddr6=NULL;
+			char *FirewallAcceptAddr7=NULL;
+			char *FirewallAcceptAddr8=NULL;
+			char *FirewallAcceptAddr9=NULL;
 			if( json_object_object_get_ex(jobj, "Eth0DhcpClient", &val_obj) ) {
 				Eth0DhcpClient = json_object_get_int(val_obj);
 				ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient=Eth0DhcpClient;
@@ -1074,6 +1085,50 @@ int main(int argc, char *argv[]) {
 				if(TelcomNetworkType!=ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkType) Tcnt++;
 				ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkType=TelcomNetworkType;
 			}
+			if( json_object_object_get_ex(jobj, "isEnalbleFirewall", &val_obj) ) {
+				isEnalbleFirewall = json_object_get_int(val_obj);
+				ShmSysConfigAndInfo->SysConfig.isEnalbleFirewall=isEnalbleFirewall;
+			}
+			if( json_object_object_get_ex(jobj, "FirewallAcceptAddr0", &val_obj) ) {
+				FirewallAcceptAddr0 = (char*)json_object_get_string(val_obj);
+				strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[0],FirewallAcceptAddr0);
+			}
+			if( json_object_object_get_ex(jobj, "FirewallAcceptAddr1", &val_obj) ) {
+				FirewallAcceptAddr1 = (char*)json_object_get_string(val_obj);
+				strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[1],FirewallAcceptAddr1);
+			}
+			if( json_object_object_get_ex(jobj, "FirewallAcceptAddr2", &val_obj) ) {
+				FirewallAcceptAddr2 = (char*)json_object_get_string(val_obj);
+				strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[2],FirewallAcceptAddr2);
+			}
+			if( json_object_object_get_ex(jobj, "FirewallAcceptAddr3", &val_obj) ) {
+				FirewallAcceptAddr3 = (char*)json_object_get_string(val_obj);
+				strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[3],FirewallAcceptAddr3);
+			}
+			if( json_object_object_get_ex(jobj, "FirewallAcceptAddr4", &val_obj) ) {
+				FirewallAcceptAddr4 = (char*)json_object_get_string(val_obj);
+				strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[4],FirewallAcceptAddr4);
+			}
+			if( json_object_object_get_ex(jobj, "FirewallAcceptAddr5", &val_obj) ) {
+				FirewallAcceptAddr5 = (char*)json_object_get_string(val_obj);
+				strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[5],FirewallAcceptAddr5);
+			}
+			if( json_object_object_get_ex(jobj, "FirewallAcceptAddr6", &val_obj) ) {
+				FirewallAcceptAddr6 = (char*)json_object_get_string(val_obj);
+				strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[6],FirewallAcceptAddr6);
+			}
+			if( json_object_object_get_ex(jobj, "FirewallAcceptAddr7", &val_obj) ) {
+				FirewallAcceptAddr7 = (char*)json_object_get_string(val_obj);
+				strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[7],FirewallAcceptAddr7);
+			}
+			if( json_object_object_get_ex(jobj, "FirewallAcceptAddr8", &val_obj) ) {
+				FirewallAcceptAddr8 = (char*)json_object_get_string(val_obj);
+				strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[8],FirewallAcceptAddr8);
+			}
+			if( json_object_object_get_ex(jobj, "FirewallAcceptAddr9", &val_obj) ) {
+				FirewallAcceptAddr9 = (char*)json_object_get_string(val_obj);
+				strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[9],FirewallAcceptAddr9);
+			}
 			if(Wcnt>0){
 				system ("pkill Module_Wifi");
 			}
@@ -1964,6 +2019,9 @@ int main(int argc, char *argv[]) {
 		struct json_object *TelcomNetworkConn;
 		struct json_object *TelcomEnabled;
 		struct json_object *TelcomNetworkType;
+		struct json_object *isEnalbleFirewall;
+		struct json_object *FirewallAcceptAddr[10];
+		struct json_object *FirewallAcceptAddrArr= json_object_new_array();
 		//backend
 		struct json_object *BackendConnTimeout;
 		struct json_object *OfflinePolicy;
@@ -2678,6 +2736,17 @@ int main(int argc, char *argv[]) {
 		TelcomNetworkConn = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkConn);
 		TelcomEnabled = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled);
 		TelcomNetworkType = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkType);
+		isEnalbleFirewall = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isEnalbleFirewall);
+		FirewallAcceptAddr[0] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[0]);
+		FirewallAcceptAddr[1] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[1]);
+		FirewallAcceptAddr[2] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[2]);
+		FirewallAcceptAddr[3] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[3]);
+		FirewallAcceptAddr[4] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[4]);
+		FirewallAcceptAddr[5] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[5]);
+		FirewallAcceptAddr[6] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[6]);
+		FirewallAcceptAddr[7] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[7]);
+		FirewallAcceptAddr[8] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[8]);
+		FirewallAcceptAddr[9] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[9]);
 		//backend
 		BackendConnTimeout = json_object_new_int(ShmSysConfigAndInfo->SysConfig.BackendConnTimeout);
 		OfflinePolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflinePolicy);
@@ -3229,6 +3298,18 @@ int main(int argc, char *argv[]) {
 		json_object_object_add(jobj3,"TelcomNetworkConn",TelcomNetworkConn);
 		json_object_object_add(jobj3,"TelcomEnabled",TelcomEnabled);
 		json_object_object_add(jobj3,"TelcomNetworkType",TelcomNetworkType);
+		json_object_object_add(jobj3,"isEnalbleFirewall",isEnalbleFirewall);
+		json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[0]);
+		json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[1]);
+		json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[2]);
+		json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[3]);
+		json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[4]);
+		json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[5]);
+		json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[6]);
+		json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[7]);
+		json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[8]);
+		json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[9]);
+		json_object_object_add(jobj3,"FirewallAcceptAddr",FirewallAcceptAddrArr);
 		printf("%s\n", json_object_to_json_string(jobj3));
 		json_object_put(jobj3);
 

+ 688 - 610
EVSE/rootfs/var/www/set_network.php

@@ -1,610 +1,688 @@
-<?php
-	ini_set('error_reporting', E_ALL | E_STRICT);
-	$tag_header = 'set';
-	include 'head.php';
-	$obj = json_decode(trim($output[2]));//var_dump($obj);
-	$system = json_decode(trim($output[0]),true);//var_dump($obj);
-	$ModelName = $system['ModelName'];
-	$SerialNumber = $system['SerialNumber'];
-	$InternetConn='';
-	switch ($obj->{'InternetConn'}){
-		case 0:
-			$InternetConn=$lang->showWord('disconnected');
-			break;
-		case 1:
-			$InternetConn=$lang->showWord('connected');
-			break;
-	}
-	$WifiNetworkConn='';
-	switch ($obj->{'WifiNetworkConn'}){
-		case 0:
-			$WifiNetworkConn=$lang->showWord('disconnected');
-			break;
-		case 1:
-			$WifiNetworkConn=$lang->showWord('connected');
-			break;
-	}
-	$TelcomNetworkConn='';
-	switch ($obj->{'TelcomNetworkConn'}){
-		case 0:
-			$TelcomNetworkConn=$lang->showWord('disconnected');
-			break;
-		case 1:
-			$TelcomNetworkConn=$lang->showWord('connected');
-			break;
-	}
-	$TelcomSimStatus='';
-	switch ($obj->{'TelcomSimStatus'}){
-		case 0:
-			$TelcomSimStatus='no SIM card is found';
-			break;
-		case 1:
-			$TelcomSimStatus='valid SIM card';
-			break;
-		case 2:
-			$TelcomSimStatus='invalid SIM card';
-			break;
-	}
-	$TelcomModemMode='';
-	switch ($obj->{'TelcomModemMode'}){
-		case 0:
-			$TelcomModemMode='No services';
-			break;
-		case 1:
-			$TelcomModemMode='CDMA';
-			break;
-		case 2:
-			$TelcomModemMode='GSM/GPRS';
-			break;
-		case 3:
-			$TelcomModemMode='WCDMA';
-			break;
-		case 4:
-			$TelcomModemMode='GSM/WCDMA';
-			break;
-		case 5:
-			$TelcomModemMode='TD_SCDMA mode';
-			break;
-		case 6:
-                        $TelcomModemMode='HSPA';
-                        break;
-		case 7:
-                        $TelcomModemMode='LTE';
-                        break;
-		case 9:
-			$TelcomModemMode='Unknown';
-			break;
-	}
-?>
-<style>
-img {
-  display: block;
-  margin-left: auto;
-  margin-right: auto;
-}
-</style>
-	<div class="envor-content">
-		<!--
-		Page Title start
-		//-->
-		<section class="envor-page-title-1" data-stellar-background-ratio="0.5">
-			<div class="container">
-				<div class="row">
-					<div class="col-lg-9 col-md-9 col-sm-9">
-						<h1><?php echo $lang->showWord("network"); ?></h1>
-					</div>
-				</div>
-			</div>
-		<!--
-		Page Title end
-		//-->
-		</section>
-		<!--
-		Main Content start
-		//-->
-		<a id="loadinghref"><div id="loading" style="display:none;"><img src="img/giphy.gif"/></div></a>
-		<section class="envor-section">
-			<div class="container">
-				<div class="row">
-					<div class="col-lg-12">
-						<div class="envor-sorting" id="faq-sorting">
-							<div class="envor-toggle">
-								<!--Network Status-->
-								<article class="envor-sorting-item css">
-									<header><?php echo $lang->showWord("network_status"); ?><i class="fa fa-plus"></i></header>
-									<section>
-										<div class="form-group" style="display:<?php echo $am101;?>">
-											<label><?php echo $lang->showWord("internet_connection_status"); ?></label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $InternetConn;?>">
-											<input type="hidden" name="InternetConn" id="InternetConn" value="<?php echo $obj->{'InternetConn'};?>">
-										</div>
-<?php /*										<div class="form-group" style="display:<?php echo $am101;?>">
-											<label>FtpServer</label>
-											<input type="text" name="FtpServer" id="FtpServer" class="form-control" value="<?php echo $obj->{'FtpServer'};?>">
-										</div>*/?>
-									</section>
-								</article>
-								<!--Ethernet Interface0-->
-								<article class="envor-sorting-item css" style="display:<?php echo $am101;?>">
-									<header><?php echo $lang->showWord("ethernet_interface"); ?><i class="fa fa-plus"></i></header>
-									<section>
-										<div class="form-group">
-											<label>DHCP Client</label>
-											<select class="form-control" id="Eth0DhcpClient" name="Eth0DhcpClient" onchange="EthDhcp_changed();">
-												<option value="0" <?php echo $obj->{'Eth0DhcpClient'}=="0"?"selected":""?>>enable</option>
-												<option value="1" <?php echo $obj->{'Eth0DhcpClient'}=="1"?"selected":""?>>disable</option>
-											</select>
-										</div>
-										<div class="form-group">
-											<label><?php echo $lang->showWord("mac_address"); ?></label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'Eth0MacAddress'};?>">
-											<input type="hidden" name="Eth0MacAddress" id="Eth0MacAddress" value="<?php echo $obj->{'Eth0MacAddress'};?>">
-										</div>
-										<div class="form-group">
-											<label><?php echo $lang->showWord("ip_address"); ?></label>
-											<input type="text" name="Eth0IpAddress" id="Eth0IpAddress" class="form-control" value="<?php echo $obj->{'Eth0IpAddress'};?>">
-										</div>
-										<div class="form-group">
-											<label><?php echo $lang->showWord("submask_address"); ?></label>
-											<input type="text" name="Eth0SubmaskAddress" id="Eth0SubmaskAddress" class="form-control" value="<?php echo $obj->{'Eth0SubmaskAddress'};?>">
-										</div>
-										<div class="form-group">
-											<label><?php echo $lang->showWord("gateway_address"); ?></label>
-											<input type="text" name="Eth0GatewayAddress" id="Eth0GatewayAddress" class="form-control" value="<?php echo $obj->{'Eth0GatewayAddress'};?>">
-										</div>
-									</section>
-								</article>
-<?php /*								<!--Ethernet Interface1-->
-								<article class="envor-sorting-item css" style="display:<?php echo $am101;?>">
-									<header><?php echo $lang->showWord("ethernet_interface"); ?><i class="fa fa-plus"></i></header>
-									<section>
-										<div class="form-group">
-											<label>Eth1DhcpClient</label>
-											<select class="form-control" id="Eth1DhcpClient" name="Eth1DhcpClient">
-												<option value="0" <?php echo $obj->{'Eth1DhcpClient'}=="0"?"selected":""?>>enable</option>
-												<option value="1" <?php echo $obj->{'Eth1DhcpClient'}=="1"?"selected":""?>>disable</option>
-											</select>
-										</div>
-										<div class="form-group">
-											<label>Eth1MacAddress</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'Eth1MacAddress'};?>">
-											<input type="hidden" name="Eth1MacAddress" id="Eth1MacAddress" value="<?php echo $obj->{'Eth1MacAddress'};?>">
-										</div>
-										<div class="form-group">
-											<label>Eth1IpAddress</label>
-											<input type="text" name="Eth1IpAddress" id="Eth1IpAddress" class="form-control" value="<?php echo $obj->{'Eth1IpAddress'};?>">
-										</div>
-										<div class="form-group">
-											<label>Eth1SubmaskAddress</label>
-											<input type="text" name="Eth1SubmaskAddress" id="Eth1SubmaskAddress" class="form-control" value="<?php echo $obj->{'Eth1SubmaskAddress'};?>">
-										</div>
-										<div class="form-group">
-											<label>Eth1GatewayAddress</label>
-											<input type="text" name="Eth1GatewayAddress" id="Eth1GatewayAddress" class="form-control" value="<?php echo $obj->{'Eth1GatewayAddress'};?>">
-										</div>
-									</section>
-								</article>*/?>
-								<!--WiFi Module-->
-								<article class="envor-sorting-item css" style="display:<?php echo $showWifi;?>">
-									<header><?php echo $lang->showWord("WiFi_module"); ?><i class="fa fa-plus"></i></header>
-									<section>
-										<div class="form-group">
-											<label><?php echo $lang->showWord("mode"); ?></label>
-											<select class="form-control" id="WifiMode" name="WifiMode" onchange="WifiMode_changed();">
-												<option value="0" <?php echo $obj->{'WifiMode'}=="0"?"selected":""?>>disable</option>
-												<option value="1" <?php echo $obj->{'WifiMode'}=="1"?"selected":""?>>station</option>
-												<option value="2" <?php echo $obj->{'WifiMode'}=="2"?"selected":""?>>Access Point</option>
-<?php /*												<option value="3" <?php echo $obj->{'WifiMode'}=="3"?"selected":""?>>Ad-Hoc</option>*/?>
-											</select>
-										</div>
-										<div class="form-group" id="WifiSsidDiv">
-											<label>SSID</label>
-											<input type="text" name="WifiSsid" id="WifiSsid" class="form-control" value="<?php echo $obj->{'WifiSsid'};?>">
-											<a id="scan" href="scan_wifi.php"><input type="button" value="Scan" class="form-control"></a>
-										</div>
-										<div class="form-group" id="WifiPasswordDiv">
-											<label>Password</label>
-											<input type="text" name="WifiPassword" id="WifiPassword" class="form-control" value="<?php echo $obj->{'WifiPassword'};?>">
-										</div>
-										<div class="form-group" id="WifiBroadcastSsidDiv">
-											<label>Wifi Broadcast SSID</label>
-											<select class="form-control" id="WifiBroadcastSsid" name="WifiBroadcastSsid">
-												<option value="0" <?php echo $obj->{'WifiBroadcastSsid'}=="0"?"selected":""?>>hidden</option>
-												<option value="1" <?php echo $obj->{'WifiBroadcastSsid'}=="1"?"selected":""?>>broadcast</option>
-											</select>
-										</div>
-										<div class="form-group" id="WifiTargetBssidMacDiv">
-											<label>Wifi Target Bssid Mac</label>
-											<input type="text" name="WifiTargetBssidMac" id="WifiTargetBssidMac" class="form-control" value="<?php echo $obj->{'WifiTargetBssidMac'};?>">
-										</div>
-										<div class="form-group" id="WifiRssiDiv">
-											<label>RSSI</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'WifiRssi'};?> dBm">
-											<input type="hidden" name="WifiRssi" id="WifiRssi" value="<?php echo $obj->{'WifiRssi'};?>">
-										</div>
-										<div class="form-group" id="WifiDhcpServerDiv">
-											<label>DHCP Server</label>
-											<select class="form-control" id="WifiDhcpServer" name="WifiDhcpServer">
-												<option value="0" <?php echo $obj->{'WifiDhcpServer'}=="0"?"selected":""?>>enable</option>
-												<option value="1" <?php echo $obj->{'WifiDhcpServer'}=="1"?"selected":""?>>disable</option>
-											</select>
-										</div>
-										<div class="form-group" id="WifiDhcpClientDiv">
-											<label>DHCP Client</label>
-											<select class="form-control" id="WifiDhcpClient" name="WifiDhcpClient" onchange="WifiDhcp_changed();">
-												<option value="0" <?php echo $obj->{'WifiDhcpClient'}=="0"?"selected":""?>>enable</option>
-												<option value="1" <?php echo $obj->{'WifiDhcpClient'}=="1"?"selected":""?>>disable</option>
-											</select>
-										</div>
-										<div class="form-group" id="WifiMacAddressDiv">
-											<label><?php echo $lang->showWord("mac_address"); ?></label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'WifiMacAddress'};?>">
-											<input type="hidden" name="WifiMacAddress" id="WifiMacAddress" value="<?php echo $obj->{'WifiMacAddress'};?>">
-										</div>
-										<div class="form-group" id="WifiIpAddressDiv">
-											<label><?php echo $lang->showWord("ip_address"); ?></label>
-											<input type="text" name="WifiIpAddress" id="WifiIpAddress" class="form-control" value="<?php echo $obj->{'WifiIpAddress'};?>">
-										</div>
-										<div class="form-group" id="WifiSubmaskAddressDiv">
-											<label><?php echo $lang->showWord("submask_address"); ?></label>
-											<input type="text" name="WifiSubmaskAddress" id="WifiSubmaskAddress" class="form-control" value="<?php echo $obj->{'WifiSubmaskAddress'};?>">
-										</div>
-										<div class="form-group" id="WifiGatewayAddressDiv">
-											<label><?php echo $lang->showWord("gateway_address"); ?></label>
-											<input type="text" name="WifiGatewayAddress" id="WifiGatewayAddress" class="form-control" value="<?php echo $obj->{'WifiGatewayAddress'};?>">
-										</div>
-										<div class="form-group" id="WifiNetworkConnDiv">
-											<label><?php echo $lang->showWord("network_connection_status"); ?></label>
-											<input type="text" readonly class="form-control" value="<?php echo $WifiNetworkConn;?>">
-											<input type="hidden" name="WifiNetworkConn" id="WifiNetworkConn" value="<?php echo $obj->{'WifiNetworkConn'};?>">
-										</div>
-									</section>
-								</article>
-								<!--3G/4G Module-->
-								<article class="envor-sorting-item css" style="display:<?php echo $showTelcom;?>">
-									<header><?php echo $lang->showWord("3G/4G_module"); ?><i class="fa fa-plus"></i></header>
-									<section>
-										<div class="form-group">
-											<label><?php echo $lang->showWord("mode"); ?></label>
-											<select class="form-control" id="TelcomEnabled" name="TelcomEnabled">
-												<option value="0" <?php echo $obj->{'TelcomEnabled'}=="0"?"selected":""?>>Disable</option>
-												<option value="1" <?php echo $obj->{'TelcomEnabled'}=="1"?"selected":""?>>Enable</option>
-											</select>
-										</div>
-										<div class="form-group">
-											<label>APN</label>
-											<input type="text" name="TelcomApn" id="TelcomApn" class="form-control" value="<?php echo $obj->{'TelcomApn'};?>">
-										</div>
-										<div class="form-group">
-											<label>Network Type</label>
-											<select class="form-control" id="TelcomNetworkType" name="TelcomEnabled">
-												<option value="0" <?php echo $obj->{'TelcomNetworkType'}=="0"?"selected":""?>>Auto</option>
-												<option value="1" <?php echo $obj->{'TelcomNetworkType'}=="1"?"selected":""?>>2G</option>
-												<option value="5" <?php echo $obj->{'TelcomNetworkType'}=="5"?"selected":""?>>3G</option>
-												<option value="3" <?php echo $obj->{'TelcomNetworkType'}=="3"?"selected":""?>>4G</option>
-											</select>
-										</div>	
-										<div class="form-group">
-											<label>RSSI</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomRssi'};?> dBm">
-											<input type="hidden" name="TelcomRssi" id="TelcomRssi" value="<?php echo $obj->{'TelcomRssi'};?>">
-										</div>
-										<div class="form-group">
-											<label>Chap Pap Id</label>
-											<input type="text" name="TelcomChapPapId" id="TelcomChapPapId" class="form-control" value="<?php echo $obj->{'TelcomChapPapId'};?>">
-										</div>
-										<div class="form-group">
-											<label><?php echo $lang->showWord("chap_pap_pwd"); ?></label>
-											<input type="text" name="TelcomChapPapPwd" id="TelcomChapPapPwd" class="form-control" value="<?php echo $obj->{'TelcomChapPapPwd'};?>">
-										</div>
-										<div class="form-group">
-											<label><?php echo $lang->showWord("modem_imei"); ?></label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomModemImei'};?>">
-											<input type="hidden" name="TelcomModemImei" id="TelcomModemImei" value="<?php echo $obj->{'TelcomModemImei'};?>">
-										</div>
-										<div class="form-group">
-											<label>SIM IMSI</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomSimImsi'};?>">
-											<input type="hidden" name="TelcomSimImsi" id="TelcomSimImsi" value="<?php echo $obj->{'TelcomSimImsi'};?>">
-										</div>
-										<div class="form-group">
-											<label>SIM ICCID</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomSimIccid'};?>">
-											<input type="hidden" name="TelcomSimIccid" id="TelcomSimIccid" value="<?php echo $obj->{'TelcomSimIccid'};?>">
-										</div>
-										<div class="form-group">
-											<label><?php echo $lang->showWord("sim_status"); ?></label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $TelcomSimStatus;?>">
-											<input type="hidden" name="TelcomSimStatus" id="TelcomSimStatus" value="<?php echo $obj->{'TelcomSimStatus'};?>">
-										</div>
-										<div class="form-group">
-											<label><?php echo $lang->showWord("modem_mode"); ?></label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $TelcomModemMode;?>">
-											<input type="hidden" name="TelcomModemMode" id="TelcomModemMode" value="<?php echo $obj->{'TelcomModemMode'};?>">
-										</div>
-										<div class="form-group">
-											<label><?php echo $lang->showWord("ip_address"); ?></label>
-											<input type="text" name="TelcomIpAddress" id="TelcomIpAddress" class="form-control" value="<?php echo $obj->{'TelcomIpAddress'};?>" disabled>
-										</div>
-										<div class="form-group">
-											<label><?php echo $lang->showWord("network_connection_status"); ?></label>
-											<input type="text" readonly class="form-control" value="<?php echo $TelcomNetworkConn;?>">
-											<input type="hidden" name="TelcomNetworkConn" id="TelcomNetworkConn" value="<?php echo $obj->{'TelcomNetworkConn'};?>">
-										</div>
-									</section>
-								</article>
-								<!--Bluetooth Module-->
-<?php /*								<article class="envor-sorting-item css">
-									<header><?php echo $lang->showWord("bluetooth_module"); ?><i class="fa fa-plus"></i></header>
-									<section>
-										<div class="form-group" style="display:<?php echo $am101;?>">
-											<label>LoginCentralID</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'LoginCentralID'};?>">
-											<input type="hidden" name="LoginCentralID" id="LoginCentralID" value="<?php echo $obj->{'LoginCentralID'};?>">
-										</div>
-										<div class="form-group" style="display:<?php echo $am101;?>">
-											<label>isLogin</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'isLogin'};?>">
-											<input type="hidden" name="isLogin" id="isLogin" value="<?php echo $obj->{'isLogin'};?>">
-										</div>
-										<div class="form-group" style="display:<?php echo $am101;?>">
-											<label>isRequestStart</label>
-											<input type="text" readonly class="form-control" value="<?php echo $isRequestStart;?>">
-											<input type="hidden" name="isRequestStart" id="isRequestStart" value="<?php echo $obj->{'isRequestStart'};?>">
-										</div>
-										<div class="form-group" style="display:<?php echo $am101;?>">
-											<label>isRequestStop</label>
-											<input type="text" readonly class="form-control" value="<?php echo $isRequestStop;?>">
-											<input type="hidden" name="isRequestStop" id="isRequestStop" value="<?php echo $obj->{'isRequestStop'};?>">
-										</div>
-									</section>
-								</article>  */?>
-								<article class="envor-sorting-item css">
-									<div align="center"><button id="save"><?php echo $lang->showWord("set")?></button></div>
-								</article>
-							</div>
-						</div>
-					</div>
-				</div>
-			</div>
-		</section>
-	</div>
-
-<?php
-	include 'foot.php';
-?>
-
-<script type="text/JavaScript">
-	$(document).ready(function(){
-		WifiMode_changed();
-		EthDhcp_changed();
-		WifiDhcp_changed();
-	});
-
-	document.getElementById("save").onclick = function() {
-		if(formCheck())
-		{
-			window.location="#loadinghref";
-			document.getElementById("loading").style.display="block";
-			// 發送 Ajax 查詢請求並處理
-			var request = new XMLHttpRequest();
-			request.open("POST", "set_network_action.php");
-
-			// POST 參數須使用 send() 發送
-			var data =  "Eth0DhcpClient=" + document.getElementById("Eth0DhcpClient").value+
-						"&Eth0IpAddress=" + document.getElementById("Eth0IpAddress").value+
-						"&Eth0SubmaskAddress=" + document.getElementById("Eth0SubmaskAddress").value+
-						"&Eth0GatewayAddress=" + document.getElementById("Eth0GatewayAddress").value+
-						"&WifiMode=" + document.getElementById("WifiMode").value+
-						"&WifiSsid=" + escape(document.getElementById("WifiSsid").value)+
-						"&WifiPassword=" + escape(document.getElementById("WifiPassword").value)+
-						"&WifiBroadcastSsid=" + document.getElementById("WifiBroadcastSsid").value+
-						"&WifiTargetBssidMac=" + escape(document.getElementById("WifiTargetBssidMac").value)+
-						"&WifiDhcpServer=" + document.getElementById("WifiDhcpServer").value+
-						"&WifiDhcpClient=" + document.getElementById("WifiDhcpClient").value+
-						"&WifiIpAddress=" + document.getElementById("WifiIpAddress").value+
-						"&WifiSubmaskAddress=" + document.getElementById("WifiSubmaskAddress").value+
-						"&WifiGatewayAddress=" + document.getElementById("WifiGatewayAddress").value+
-						"&TelcomApn=" + escape(document.getElementById("TelcomApn").value)+
-						"&TelcomNetworkType=" + escape(document.getElementById("TelcomNetworkType").value)+
-						"&TelcomChapPapId=" + escape(document.getElementById("TelcomChapPapId").value)+
-						"&TelcomChapPapPwd=" + escape(document.getElementById("TelcomChapPapPwd").value)+
-						"&TelcomIpAddress=" + document.getElementById("TelcomIpAddress").value+
-						"&TelcomEnabled=" + document.getElementById("TelcomEnabled").value;
-			// POST 請求必須設置表頭在 open() 下面,send() 上面
-			request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
-			request.send(data);
-
-			request.onreadystatechange = function() {
-				// 伺服器請求完成
-				if (request.readyState == 4) {
-					 document.getElementById("loading").style.display="none";
-					// 伺服器回應成功
-					if (request.status == 200 && JSON.parse(request.responseText).result=="Success") {
-						alert("<?php echo $lang->showWord("done")?>");
-						location.href="set_network.php";
-					} else {
-						alert(JSON.parse(request.responseText).message);
-					}
-					request = null;
-				}
-			}
-		}
-	}
-
-	function formCheck()
-	{
-		if(document.getElementById("Eth0IpAddress").value != ""){
-			if(!ValidateIPaddress("Eth0IpAddress")) return false;
-		}
-		if(document.getElementById("Eth0SubmaskAddress").value != ""){
-			if(!ValidateIPaddress("Eth0SubmaskAddress")) return false;
-		}
-		if(document.getElementById("Eth0GatewayAddress").value != ""){
-			if(!ValidateIPaddress("Eth0GatewayAddress")) return false;
-		}
-		// if(document.getElementById("Eth1IpAddress").value != ""){
-			// if(!ValidateIPaddress("Eth1IpAddress")) return false;
-		// }
-		// if(document.getElementById("Eth1SubmaskAddress").value != ""){
-			// if(!ValidateIPaddress("Eth1SubmaskAddress")) return false;
-		// }
-		// if(document.getElementById("Eth1GatewayAddress").value != ""){
-			// if(!ValidateIPaddress("Eth1GatewayAddress")) return false;
-		// }
-		if(document.getElementById("WifiIpAddress").value != ""){
-			if(!ValidateIPaddress("WifiIpAddress")) return false;
-		}
-		if(document.getElementById("WifiSubmaskAddress").value != ""){
-			if(!ValidateIPaddress("WifiSubmaskAddress")) return false;
-		}
-		if(document.getElementById("WifiGatewayAddress").value != ""){
-			if(!ValidateIPaddress("WifiGatewayAddress")) return false;
-		}
-		if(document.getElementById("TelcomIpAddress").value != ""){
-			if(!ValidateIPaddress("TelcomIpAddress")) return false;
-		}
-
-		return true;
-	}
-
-	function WifiMode_changed(){
-		if(document.getElementById("WifiMode").value=="0"){
-			document.getElementById("WifiDhcpServer").disabled=true;
-			document.getElementById("WifiDhcpClient").disabled=true;
-			document.getElementById("WifiSsid").disabled=true;
-			document.getElementById("WifiPassword").disabled=true;
-			document.getElementById("WifiIpAddress").disabled=true;
-			document.getElementById("WifiSubmaskAddress").disabled=true;
-			document.getElementById("WifiGatewayAddress").disabled=true;
-			document.getElementById("WifiDhcpServerDiv").style.display="none";
-			document.getElementById("WifiDhcpClientDiv").style.display="none";
-			document.getElementById("WifiSsidDiv").style.display="none";
-			document.getElementById("WifiPasswordDiv").style.display="none";
-			document.getElementById("WifiBroadcastSsidDiv").style.display="none";
-			document.getElementById("WifiTargetBssidMacDiv").style.display="none";
-			document.getElementById("WifiRssiDiv").style.display="none";
-			document.getElementById("WifiMacAddressDiv").style.display="none";
-			document.getElementById("WifiIpAddressDiv").style.display="none";
-			document.getElementById("WifiSubmaskAddressDiv").style.display="none";
-			document.getElementById("WifiGatewayAddressDiv").style.display="none";
-			document.getElementById("WifiNetworkConnDiv").style.display="none";
-		}
-		if(document.getElementById("WifiMode").value=="1"){
-			document.getElementById("WifiDhcpServer").disabled=true;
-			document.getElementById("WifiDhcpClient").disabled=false;
-			document.getElementById("WifiSsid").disabled=false;
-			document.getElementById("WifiPassword").disabled=false;
-			document.getElementById("WifiSsid").value="<?php echo $obj->{'WifiSsid'};?>";
-			document.getElementById("WifiPassword").value="<?php echo $obj->{'WifiPassword'};?>";
-			document.getElementById("WifiIpAddress").disabled=false;
-			document.getElementById("WifiSubmaskAddress").disabled=false;
-			document.getElementById("WifiGatewayAddress").disabled=false;
-			document.getElementById("WifiIpAddress").value="<?php echo $obj->{'WifiIpAddress'};?>";
-			document.getElementById("WifiSubmaskAddress").value="<?php echo $obj->{'WifiSubmaskAddress'};?>";
-			document.getElementById("WifiGatewayAddress").value="<?php echo $obj->{'WifiGatewayAddress'};?>";
-			document.getElementById("WifiDhcpServerDiv").style.display="none";
-			document.getElementById("WifiDhcpClientDiv").style.display="block";
-			document.getElementById("WifiSsidDiv").style.display="block";
-			document.getElementById("WifiPasswordDiv").style.display="block";
-			document.getElementById("WifiBroadcastSsidDiv").style.display="none";
-			document.getElementById("WifiTargetBssidMacDiv").style.display="block";
-			document.getElementById("WifiRssiDiv").style.display="block";
-			document.getElementById("WifiMacAddressDiv").style.display="block";
-			document.getElementById("WifiIpAddressDiv").style.display="block";
-			document.getElementById("WifiSubmaskAddressDiv").style.display="block";
-			document.getElementById("WifiGatewayAddressDiv").style.display="block";
-			document.getElementById("WifiNetworkConnDiv").style.display="block";
-		}
-		if(document.getElementById("WifiMode").value=="2"){
-			document.getElementById("WifiDhcpServer").disabled=false;
-			document.getElementById("WifiDhcpClient").disabled=true;
-			document.getElementById("WifiSsid").disabled=true;
-			document.getElementById("WifiPassword").disabled=true;
-			document.getElementById("WifiSsid").value="<?php echo $ModelName.$SerialNumber?>";
-			document.getElementById("WifiPassword").value="";
-			document.getElementById("WifiIpAddress").disabled=true;
-			document.getElementById("WifiSubmaskAddress").disabled=true;
-			document.getElementById("WifiGatewayAddress").disabled=true;
-			document.getElementById("WifiDhcpServerDiv").style.display="block";
-			document.getElementById("WifiDhcpClientDiv").style.display="none";
-			document.getElementById("WifiSsidDiv").style.display="block";
-			document.getElementById("WifiPasswordDiv").style.display="block";
-			document.getElementById("WifiBroadcastSsidDiv").style.display="block";
-			document.getElementById("WifiTargetBssidMacDiv").style.display="none";
-			document.getElementById("WifiRssiDiv").style.display="block";
-			document.getElementById("WifiMacAddressDiv").style.display="block";
-			document.getElementById("WifiIpAddressDiv").style.display="none";
-			document.getElementById("WifiSubmaskAddressDiv").style.display="none";
-			document.getElementById("WifiGatewayAddressDiv").style.display="none";
-			document.getElementById("WifiNetworkConnDiv").style.display="block";
-		}
-		WifiDhcp_changed();
-	}
-	function EthDhcp_changed(){
-		if(document.getElementById("Eth0DhcpClient").value=="0"){
-			document.getElementById("Eth0IpAddress").disabled=true;
-			document.getElementById("Eth0SubmaskAddress").disabled=true;
-			document.getElementById("Eth0GatewayAddress").disabled=true;
-		}
-		if(document.getElementById("Eth0DhcpClient").value=="1"){
-			document.getElementById("Eth0IpAddress").disabled=false;
-			document.getElementById("Eth0SubmaskAddress").disabled=false;
-			document.getElementById("Eth0GatewayAddress").disabled=false;
-			document.getElementById("Eth0IpAddress").value="<?php echo $obj->{'Eth0IpAddress'};?>";
-			document.getElementById("Eth0SubmaskAddress").value="<?php echo $obj->{'Eth0SubmaskAddress'};?>";
-			document.getElementById("Eth0GatewayAddress").value="<?php echo $obj->{'Eth0GatewayAddress'};?>";
-		}
-	}
-	function WifiDhcp_changed(){
-		if(document.getElementById("WifiDhcpClient").disabled===false && document.getElementById("WifiDhcpClient").value=="0"){
-			document.getElementById("WifiIpAddress").disabled=true;
-			document.getElementById("WifiSubmaskAddress").disabled=true;
-			document.getElementById("WifiGatewayAddress").disabled=true;
-		}
-		if(document.getElementById("WifiDhcpClient").disabled===false && document.getElementById("WifiDhcpClient").value=="1"){
-			document.getElementById("WifiIpAddress").disabled=false;
-			document.getElementById("WifiSubmaskAddress").disabled=false;
-			document.getElementById("WifiGatewayAddress").disabled=false;
-			document.getElementById("WifiIpAddress").value="<?php echo $obj->{'WifiIpAddress'};?>";
-			document.getElementById("WifiSubmaskAddress").value="<?php echo $obj->{'WifiSubmaskAddress'};?>";
-			document.getElementById("WifiGatewayAddress").value="<?php echo $obj->{'WifiGatewayAddress'};?>";
-		}
-	}
-
-	function isNumberKey(evt)
-	{
-		var charCode = (evt.which) ? evt.which : event.keyCode
-
-		if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode != 46))
-			return false;
-
-		return true;
-	}
-
-	function ValidateIPaddress(id) {
-		var ipaddress = document.getElementById(id).value;
-		if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipaddress)) {
-			return true;
-		}
-		alert("You have entered an invalid IP address on " + id + "!")
-		document.getElementById(id).focus();
-		return false;
-	}
-
-	function scan_wifi()
-        {
-          window.open("scan_wifi.php","_blank","height=200,width=400, status=yes,toolbar=no,menubar=no,location=no");
-        }
-	$("#scan").fancybox({
-		'type'				: 'iframe',
-		'iframe' : {
-			'css' : {
-				'width' : '600px',
-				'height': '200px'
-			}
-		}
-	});
-</script>
-
-</html>
+<?php
+	ini_set('error_reporting', E_ALL | E_STRICT);
+	$tag_header = 'set';
+	include 'head.php';
+	$obj = json_decode(trim($output[2]));//var_dump($obj);
+	$system = json_decode(trim($output[0]),true);//var_dump($obj);
+	$ModelName = $system['ModelName'];
+	$SerialNumber = $system['SerialNumber'];
+	$InternetConn='';
+	switch ($obj->{'InternetConn'}){
+		case 0:
+			$InternetConn=$lang->showWord('disconnected');
+			break;
+		case 1:
+			$InternetConn=$lang->showWord('connected');
+			break;
+	}
+	$WifiNetworkConn='';
+	switch ($obj->{'WifiNetworkConn'}){
+		case 0:
+			$WifiNetworkConn=$lang->showWord('disconnected');
+			break;
+		case 1:
+			$WifiNetworkConn=$lang->showWord('connected');
+			break;
+	}
+	$TelcomNetworkConn='';
+	switch ($obj->{'TelcomNetworkConn'}){
+		case 0:
+			$TelcomNetworkConn=$lang->showWord('disconnected');
+			break;
+		case 1:
+			$TelcomNetworkConn=$lang->showWord('connected');
+			break;
+	}
+	$TelcomSimStatus='';
+	switch ($obj->{'TelcomSimStatus'}){
+		case 0:
+			$TelcomSimStatus='no SIM card is found';
+			break;
+		case 1:
+			$TelcomSimStatus='valid SIM card';
+			break;
+		case 2:
+			$TelcomSimStatus='invalid SIM card';
+			break;
+	}
+	$TelcomModemMode='';
+	switch ($obj->{'TelcomModemMode'}){
+		case 0:
+			$TelcomModemMode='No services';
+			break;
+		case 1:
+			$TelcomModemMode='CDMA';
+			break;
+		case 2:
+			$TelcomModemMode='GSM/GPRS';
+			break;
+		case 3:
+			$TelcomModemMode='WCDMA';
+			break;
+		case 4:
+			$TelcomModemMode='GSM/WCDMA';
+			break;
+		case 5:
+			$TelcomModemMode='TD_SCDMA mode';
+			break;
+		case 6:
+                        $TelcomModemMode='HSPA';
+                        break;
+		case 7:
+                        $TelcomModemMode='LTE';
+                        break;
+		case 9:
+			$TelcomModemMode='Unknown';
+			break;
+	}
+?>
+<style>
+img {
+  display: block;
+  margin-left: auto;
+  margin-right: auto;
+}
+</style>
+	<div class="envor-content">
+		<!--
+		Page Title start
+		//-->
+		<section class="envor-page-title-1" data-stellar-background-ratio="0.5">
+			<div class="container">
+				<div class="row">
+					<div class="col-lg-9 col-md-9 col-sm-9">
+						<h1><?php echo $lang->showWord("network"); ?></h1>
+					</div>
+				</div>
+			</div>
+		<!--
+		Page Title end
+		//-->
+		</section>
+		<!--
+		Main Content start
+		//-->
+		<a id="loadinghref"><div id="loading" style="display:none;"><img src="img/giphy.gif"/></div></a>
+		<section class="envor-section">
+			<div class="container">
+				<div class="row">
+					<div class="col-lg-12">
+						<div class="envor-sorting" id="faq-sorting">
+							<div class="envor-toggle">
+								<!--Network Status-->
+								<article class="envor-sorting-item css">
+									<header><?php echo $lang->showWord("network_status"); ?><i class="fa fa-plus"></i></header>
+									<section>
+										<div class="form-group" style="display:<?php echo $am101;?>">
+											<label><?php echo $lang->showWord("internet_connection_status"); ?></label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $InternetConn;?>">
+											<input type="hidden" name="InternetConn" id="InternetConn" value="<?php echo $obj->{'InternetConn'};?>">
+										</div>
+<?php /*										<div class="form-group" style="display:<?php echo $am101;?>">
+											<label>FtpServer</label>
+											<input type="text" name="FtpServer" id="FtpServer" class="form-control" value="<?php echo $obj->{'FtpServer'};?>">
+										</div>*/?>
+									</section>
+								</article>
+								<!--Ethernet Interface0-->
+								<article class="envor-sorting-item css" style="display:<?php echo $am101;?>">
+									<header><?php echo $lang->showWord("ethernet_interface"); ?><i class="fa fa-plus"></i></header>
+									<section>
+										<div class="form-group">
+											<label>DHCP Client</label>
+											<select class="form-control" id="Eth0DhcpClient" name="Eth0DhcpClient" onchange="EthDhcp_changed();">
+												<option value="0" <?php echo $obj->{'Eth0DhcpClient'}=="0"?"selected":""?>>enable</option>
+												<option value="1" <?php echo $obj->{'Eth0DhcpClient'}=="1"?"selected":""?>>disable</option>
+											</select>
+										</div>
+										<div class="form-group">
+											<label><?php echo $lang->showWord("mac_address"); ?></label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'Eth0MacAddress'};?>">
+											<input type="hidden" name="Eth0MacAddress" id="Eth0MacAddress" value="<?php echo $obj->{'Eth0MacAddress'};?>">
+										</div>
+										<div class="form-group">
+											<label><?php echo $lang->showWord("ip_address"); ?></label>
+											<input type="text" name="Eth0IpAddress" id="Eth0IpAddress" class="form-control" value="<?php echo $obj->{'Eth0IpAddress'};?>">
+										</div>
+										<div class="form-group">
+											<label><?php echo $lang->showWord("submask_address"); ?></label>
+											<input type="text" name="Eth0SubmaskAddress" id="Eth0SubmaskAddress" class="form-control" value="<?php echo $obj->{'Eth0SubmaskAddress'};?>">
+										</div>
+										<div class="form-group">
+											<label><?php echo $lang->showWord("gateway_address"); ?></label>
+											<input type="text" name="Eth0GatewayAddress" id="Eth0GatewayAddress" class="form-control" value="<?php echo $obj->{'Eth0GatewayAddress'};?>">
+										</div>
+									</section>
+								</article>
+<?php /*								<!--Ethernet Interface1-->
+								<article class="envor-sorting-item css" style="display:<?php echo $am101;?>">
+									<header><?php echo $lang->showWord("ethernet_interface"); ?><i class="fa fa-plus"></i></header>
+									<section>
+										<div class="form-group">
+											<label>Eth1DhcpClient</label>
+											<select class="form-control" id="Eth1DhcpClient" name="Eth1DhcpClient">
+												<option value="0" <?php echo $obj->{'Eth1DhcpClient'}=="0"?"selected":""?>>enable</option>
+												<option value="1" <?php echo $obj->{'Eth1DhcpClient'}=="1"?"selected":""?>>disable</option>
+											</select>
+										</div>
+										<div class="form-group">
+											<label>Eth1MacAddress</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'Eth1MacAddress'};?>">
+											<input type="hidden" name="Eth1MacAddress" id="Eth1MacAddress" value="<?php echo $obj->{'Eth1MacAddress'};?>">
+										</div>
+										<div class="form-group">
+											<label>Eth1IpAddress</label>
+											<input type="text" name="Eth1IpAddress" id="Eth1IpAddress" class="form-control" value="<?php echo $obj->{'Eth1IpAddress'};?>">
+										</div>
+										<div class="form-group">
+											<label>Eth1SubmaskAddress</label>
+											<input type="text" name="Eth1SubmaskAddress" id="Eth1SubmaskAddress" class="form-control" value="<?php echo $obj->{'Eth1SubmaskAddress'};?>">
+										</div>
+										<div class="form-group">
+											<label>Eth1GatewayAddress</label>
+											<input type="text" name="Eth1GatewayAddress" id="Eth1GatewayAddress" class="form-control" value="<?php echo $obj->{'Eth1GatewayAddress'};?>">
+										</div>
+									</section>
+								</article>*/?>
+								<!--WiFi Module-->
+								<article class="envor-sorting-item css" style="display:<?php echo $showWifi;?>">
+									<header><?php echo $lang->showWord("WiFi_module"); ?><i class="fa fa-plus"></i></header>
+									<section>
+										<div class="form-group">
+											<label><?php echo $lang->showWord("mode"); ?></label>
+											<select class="form-control" id="WifiMode" name="WifiMode" onchange="WifiMode_changed();">
+												<option value="0" <?php echo $obj->{'WifiMode'}=="0"?"selected":""?>>disable</option>
+												<option value="1" <?php echo $obj->{'WifiMode'}=="1"?"selected":""?>>station</option>
+												<option value="2" <?php echo $obj->{'WifiMode'}=="2"?"selected":""?>>Access Point</option>
+<?php /*												<option value="3" <?php echo $obj->{'WifiMode'}=="3"?"selected":""?>>Ad-Hoc</option>*/?>
+											</select>
+										</div>
+										<div class="form-group" id="WifiSsidDiv">
+											<label>SSID</label>
+											<input type="text" name="WifiSsid" id="WifiSsid" class="form-control" value="<?php echo $obj->{'WifiSsid'};?>">
+											<a id="scan" href="scan_wifi.php"><input type="button" value="Scan" class="form-control"></a>
+										</div>
+										<div class="form-group" id="WifiPasswordDiv">
+											<label>Password</label>
+											<input type="text" name="WifiPassword" id="WifiPassword" class="form-control" value="<?php echo $obj->{'WifiPassword'};?>">
+										</div>
+										<div class="form-group" id="WifiBroadcastSsidDiv">
+											<label>Wifi Broadcast SSID</label>
+											<select class="form-control" id="WifiBroadcastSsid" name="WifiBroadcastSsid">
+												<option value="0" <?php echo $obj->{'WifiBroadcastSsid'}=="0"?"selected":""?>>hidden</option>
+												<option value="1" <?php echo $obj->{'WifiBroadcastSsid'}=="1"?"selected":""?>>broadcast</option>
+											</select>
+										</div>
+										<div class="form-group" id="WifiTargetBssidMacDiv">
+											<label>Wifi Target Bssid Mac</label>
+											<input type="text" name="WifiTargetBssidMac" id="WifiTargetBssidMac" class="form-control" value="<?php echo $obj->{'WifiTargetBssidMac'};?>">
+										</div>
+										<div class="form-group" id="WifiRssiDiv">
+											<label>RSSI</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'WifiRssi'};?> dBm">
+											<input type="hidden" name="WifiRssi" id="WifiRssi" value="<?php echo $obj->{'WifiRssi'};?>">
+										</div>
+										<div class="form-group" id="WifiDhcpServerDiv">
+											<label>DHCP Server</label>
+											<select class="form-control" id="WifiDhcpServer" name="WifiDhcpServer">
+												<option value="0" <?php echo $obj->{'WifiDhcpServer'}=="0"?"selected":""?>>enable</option>
+												<option value="1" <?php echo $obj->{'WifiDhcpServer'}=="1"?"selected":""?>>disable</option>
+											</select>
+										</div>
+										<div class="form-group" id="WifiDhcpClientDiv">
+											<label>DHCP Client</label>
+											<select class="form-control" id="WifiDhcpClient" name="WifiDhcpClient" onchange="WifiDhcp_changed();">
+												<option value="0" <?php echo $obj->{'WifiDhcpClient'}=="0"?"selected":""?>>enable</option>
+												<option value="1" <?php echo $obj->{'WifiDhcpClient'}=="1"?"selected":""?>>disable</option>
+											</select>
+										</div>
+										<div class="form-group" id="WifiMacAddressDiv">
+											<label><?php echo $lang->showWord("mac_address"); ?></label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'WifiMacAddress'};?>">
+											<input type="hidden" name="WifiMacAddress" id="WifiMacAddress" value="<?php echo $obj->{'WifiMacAddress'};?>">
+										</div>
+										<div class="form-group" id="WifiIpAddressDiv">
+											<label><?php echo $lang->showWord("ip_address"); ?></label>
+											<input type="text" name="WifiIpAddress" id="WifiIpAddress" class="form-control" value="<?php echo $obj->{'WifiIpAddress'};?>">
+										</div>
+										<div class="form-group" id="WifiSubmaskAddressDiv">
+											<label><?php echo $lang->showWord("submask_address"); ?></label>
+											<input type="text" name="WifiSubmaskAddress" id="WifiSubmaskAddress" class="form-control" value="<?php echo $obj->{'WifiSubmaskAddress'};?>">
+										</div>
+										<div class="form-group" id="WifiGatewayAddressDiv">
+											<label><?php echo $lang->showWord("gateway_address"); ?></label>
+											<input type="text" name="WifiGatewayAddress" id="WifiGatewayAddress" class="form-control" value="<?php echo $obj->{'WifiGatewayAddress'};?>">
+										</div>
+										<div class="form-group" id="WifiNetworkConnDiv">
+											<label><?php echo $lang->showWord("network_connection_status"); ?></label>
+											<input type="text" readonly class="form-control" value="<?php echo $WifiNetworkConn;?>">
+											<input type="hidden" name="WifiNetworkConn" id="WifiNetworkConn" value="<?php echo $obj->{'WifiNetworkConn'};?>">
+										</div>
+									</section>
+								</article>
+								<!--3G/4G Module-->
+								<article class="envor-sorting-item css" style="display:<?php echo $showTelcom;?>">
+									<header><?php echo $lang->showWord("3G/4G_module"); ?><i class="fa fa-plus"></i></header>
+									<section>
+										<div class="form-group">
+											<label><?php echo $lang->showWord("mode"); ?></label>
+											<select class="form-control" id="TelcomEnabled" name="TelcomEnabled">
+												<option value="0" <?php echo $obj->{'TelcomEnabled'}=="0"?"selected":""?>>Disable</option>
+												<option value="1" <?php echo $obj->{'TelcomEnabled'}=="1"?"selected":""?>>Enable</option>
+											</select>
+										</div>
+										<div class="form-group">
+											<label>APN</label>
+											<input type="text" name="TelcomApn" id="TelcomApn" class="form-control" value="<?php echo $obj->{'TelcomApn'};?>">
+										</div>
+										<div class="form-group">
+											<label>Network Type</label>
+											<select class="form-control" id="TelcomNetworkType" name="TelcomEnabled">
+												<option value="0" <?php echo $obj->{'TelcomNetworkType'}=="0"?"selected":""?>>Auto</option>
+												<option value="1" <?php echo $obj->{'TelcomNetworkType'}=="1"?"selected":""?>>2G</option>
+												<option value="5" <?php echo $obj->{'TelcomNetworkType'}=="5"?"selected":""?>>3G</option>
+												<option value="3" <?php echo $obj->{'TelcomNetworkType'}=="3"?"selected":""?>>4G</option>
+											</select>
+										</div>	
+										<div class="form-group">
+											<label>RSSI</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomRssi'};?> dBm">
+											<input type="hidden" name="TelcomRssi" id="TelcomRssi" value="<?php echo $obj->{'TelcomRssi'};?>">
+										</div>
+										<div class="form-group">
+											<label>Chap Pap Id</label>
+											<input type="text" name="TelcomChapPapId" id="TelcomChapPapId" class="form-control" value="<?php echo $obj->{'TelcomChapPapId'};?>">
+										</div>
+										<div class="form-group">
+											<label><?php echo $lang->showWord("chap_pap_pwd"); ?></label>
+											<input type="text" name="TelcomChapPapPwd" id="TelcomChapPapPwd" class="form-control" value="<?php echo $obj->{'TelcomChapPapPwd'};?>">
+										</div>
+										<div class="form-group">
+											<label><?php echo $lang->showWord("modem_imei"); ?></label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomModemImei'};?>">
+											<input type="hidden" name="TelcomModemImei" id="TelcomModemImei" value="<?php echo $obj->{'TelcomModemImei'};?>">
+										</div>
+										<div class="form-group">
+											<label>SIM IMSI</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomSimImsi'};?>">
+											<input type="hidden" name="TelcomSimImsi" id="TelcomSimImsi" value="<?php echo $obj->{'TelcomSimImsi'};?>">
+										</div>
+										<div class="form-group">
+											<label>SIM ICCID</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomSimIccid'};?>">
+											<input type="hidden" name="TelcomSimIccid" id="TelcomSimIccid" value="<?php echo $obj->{'TelcomSimIccid'};?>">
+										</div>
+										<div class="form-group">
+											<label><?php echo $lang->showWord("sim_status"); ?></label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $TelcomSimStatus;?>">
+											<input type="hidden" name="TelcomSimStatus" id="TelcomSimStatus" value="<?php echo $obj->{'TelcomSimStatus'};?>">
+										</div>
+										<div class="form-group">
+											<label><?php echo $lang->showWord("modem_mode"); ?></label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $TelcomModemMode;?>">
+											<input type="hidden" name="TelcomModemMode" id="TelcomModemMode" value="<?php echo $obj->{'TelcomModemMode'};?>">
+										</div>
+										<div class="form-group">
+											<label><?php echo $lang->showWord("ip_address"); ?></label>
+											<input type="text" name="TelcomIpAddress" id="TelcomIpAddress" class="form-control" value="<?php echo $obj->{'TelcomIpAddress'};?>" disabled>
+										</div>
+										<div class="form-group">
+											<label><?php echo $lang->showWord("network_connection_status"); ?></label>
+											<input type="text" readonly class="form-control" value="<?php echo $TelcomNetworkConn;?>">
+											<input type="hidden" name="TelcomNetworkConn" id="TelcomNetworkConn" value="<?php echo $obj->{'TelcomNetworkConn'};?>">
+										</div>
+									</section>
+								</article>
+								<!--firewall-->
+								<article class="envor-sorting-item css">
+									<header><?php echo $lang->showWord("Firewall"); ?><i class="fa fa-plus"></i></header>
+									<section>
+										<div class="form-group">
+											<label><?php echo $lang->showWord("mode"); ?></label>
+											<select class="form-control" id="isEnalbleFirewall" name="isEnalbleFirewall" onchange="Firewall_changed();">
+												<option value="0" <?php echo $obj->{'isEnalbleFirewall'}=="0"?"selected":""?>>Disable</option>
+												<option value="1" <?php echo $obj->{'isEnalbleFirewall'}=="1"?"selected":""?>>Enable</option>
+											</select>
+										</div>
+										<div class="form-group" id="FirewallAcceptAddrDiv">
+											<div class="form-group">
+												<label><?php echo 'Firewall Accept Addr0' ?></label>
+												<input type="text" name="FirewallAcceptAddr0" id="FirewallAcceptAddr0" class="form-control" value="<?php echo $obj->{'FirewallAcceptAddr'}[0];?>">
+											</div>
+											<div class="form-group">
+												<label><?php echo 'Firewall Accept Addr1' ?></label>
+												<input type="text" name="FirewallAcceptAddr1" id="FirewallAcceptAddr1" class="form-control" value="<?php echo $obj->{'FirewallAcceptAddr'}[1];?>">
+											</div>
+											<div class="form-group">
+												<label><?php echo 'Firewall Accept Addr2' ?></label>
+												<input type="text" name="FirewallAcceptAddr2" id="FirewallAcceptAddr2" class="form-control" value="<?php echo $obj->{'FirewallAcceptAddr'}[2];?>">
+											</div>
+											<div class="form-group">
+												<label><?php echo 'Firewall Accept Addr3' ?></label>
+												<input type="text" name="FirewallAcceptAddr3" id="FirewallAcceptAddr3" class="form-control" value="<?php echo $obj->{'FirewallAcceptAddr'}[3];?>">
+											</div>
+											<div class="form-group">
+												<label><?php echo 'Firewall Accept Addr4' ?></label>
+												<input type="text" name="FirewallAcceptAddr4" id="FirewallAcceptAddr4" class="form-control" value="<?php echo $obj->{'FirewallAcceptAddr'}[4];?>">
+											</div>
+											<div class="form-group">
+												<label><?php echo 'Firewall Accept Addr5' ?></label>
+												<input type="text" name="FirewallAcceptAddr5" id="FirewallAcceptAddr5" class="form-control" value="<?php echo $obj->{'FirewallAcceptAddr'}[5];?>">
+											</div>
+											<div class="form-group">
+												<label><?php echo 'Firewall Accept Addr6' ?></label>
+												<input type="text" name="FirewallAcceptAddr6" id="FirewallAcceptAddr6" class="form-control" value="<?php echo $obj->{'FirewallAcceptAddr'}[6];?>">
+											</div>
+											<div class="form-group">
+												<label><?php echo 'Firewall Accept Addr7' ?></label>
+												<input type="text" name="FirewallAcceptAddr7" id="FirewallAcceptAddr7" class="form-control" value="<?php echo $obj->{'FirewallAcceptAddr'}[7];?>">
+											</div>
+											<div class="form-group">
+												<label><?php echo 'Firewall Accept Addr8' ?></label>
+												<input type="text" name="FirewallAcceptAddr8" id="FirewallAcceptAddr8" class="form-control" value="<?php echo $obj->{'FirewallAcceptAddr'}[8];?>">
+											</div>
+											<div class="form-group">
+												<label><?php echo 'Firewall Accept Addr9' ?></label>
+												<input type="text" name="FirewallAcceptAddr9" id="FirewallAcceptAddr9" class="form-control" value="<?php echo $obj->{'FirewallAcceptAddr'}[9];?>">
+											</div>
+
+										</div>
+
+									</section>
+								</article>
+								<!--Bluetooth Module-->
+<?php /*								<article class="envor-sorting-item css">
+									<header><?php echo $lang->showWord("bluetooth_module"); ?><i class="fa fa-plus"></i></header>
+									<section>
+										<div class="form-group" style="display:<?php echo $am101;?>">
+											<label>LoginCentralID</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'LoginCentralID'};?>">
+											<input type="hidden" name="LoginCentralID" id="LoginCentralID" value="<?php echo $obj->{'LoginCentralID'};?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am101;?>">
+											<label>isLogin</label>
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'isLogin'};?>">
+											<input type="hidden" name="isLogin" id="isLogin" value="<?php echo $obj->{'isLogin'};?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am101;?>">
+											<label>isRequestStart</label>
+											<input type="text" readonly class="form-control" value="<?php echo $isRequestStart;?>">
+											<input type="hidden" name="isRequestStart" id="isRequestStart" value="<?php echo $obj->{'isRequestStart'};?>">
+										</div>
+										<div class="form-group" style="display:<?php echo $am101;?>">
+											<label>isRequestStop</label>
+											<input type="text" readonly class="form-control" value="<?php echo $isRequestStop;?>">
+											<input type="hidden" name="isRequestStop" id="isRequestStop" value="<?php echo $obj->{'isRequestStop'};?>">
+										</div>
+									</section>
+								</article>  */?>
+								<article class="envor-sorting-item css">
+									<div align="center"><button id="save"><?php echo $lang->showWord("set")?></button></div>
+								</article>
+							</div>
+						</div>
+					</div>
+				</div>
+			</div>
+		</section>
+	</div>
+
+<?php
+	include 'foot.php';
+?>
+
+<script type="text/JavaScript">
+	$(document).ready(function(){
+		WifiMode_changed();
+		EthDhcp_changed();
+		WifiDhcp_changed();
+		Firewall_changed();
+	});
+
+	document.getElementById("save").onclick = function() {
+		if(formCheck())
+		{
+			window.location="#loadinghref";
+			document.getElementById("loading").style.display="block";
+			// 發送 Ajax 查詢請求並處理
+			var request = new XMLHttpRequest();
+			request.open("POST", "set_network_action.php");
+
+			// POST 參數須使用 send() 發送
+			var data =  "Eth0DhcpClient=" + document.getElementById("Eth0DhcpClient").value+
+						"&Eth0IpAddress=" + document.getElementById("Eth0IpAddress").value+
+						"&Eth0SubmaskAddress=" + document.getElementById("Eth0SubmaskAddress").value+
+						"&Eth0GatewayAddress=" + document.getElementById("Eth0GatewayAddress").value+
+						"&WifiMode=" + document.getElementById("WifiMode").value+
+						"&WifiSsid=" + escape(document.getElementById("WifiSsid").value)+
+						"&WifiPassword=" + escape(document.getElementById("WifiPassword").value)+
+						"&WifiBroadcastSsid=" + document.getElementById("WifiBroadcastSsid").value+
+						"&WifiTargetBssidMac=" + escape(document.getElementById("WifiTargetBssidMac").value)+
+						"&WifiDhcpServer=" + document.getElementById("WifiDhcpServer").value+
+						"&WifiDhcpClient=" + document.getElementById("WifiDhcpClient").value+
+						"&WifiIpAddress=" + document.getElementById("WifiIpAddress").value+
+						"&WifiSubmaskAddress=" + document.getElementById("WifiSubmaskAddress").value+
+						"&WifiGatewayAddress=" + document.getElementById("WifiGatewayAddress").value+
+						"&TelcomApn=" + escape(document.getElementById("TelcomApn").value)+
+						"&TelcomNetworkType=" + escape(document.getElementById("TelcomNetworkType").value)+
+						"&TelcomChapPapId=" + escape(document.getElementById("TelcomChapPapId").value)+
+						"&TelcomChapPapPwd=" + escape(document.getElementById("TelcomChapPapPwd").value)+
+						"&TelcomIpAddress=" + document.getElementById("TelcomIpAddress").value+
+						"&TelcomEnabled=" + document.getElementById("TelcomEnabled").value+
+						"&isEnalbleFirewall=" + document.getElementById("isEnalbleFirewall").value+
+						"&FirewallAcceptAddr0=" + document.getElementById("FirewallAcceptAddr0").value+
+						"&FirewallAcceptAddr1=" + document.getElementById("FirewallAcceptAddr1").value+
+						"&FirewallAcceptAddr2=" + document.getElementById("FirewallAcceptAddr2").value+
+						"&FirewallAcceptAddr3=" + document.getElementById("FirewallAcceptAddr3").value+
+						"&FirewallAcceptAddr4=" + document.getElementById("FirewallAcceptAddr4").value+
+						"&FirewallAcceptAddr5=" + document.getElementById("FirewallAcceptAddr5").value+
+						"&FirewallAcceptAddr6=" + document.getElementById("FirewallAcceptAddr6").value+
+						"&FirewallAcceptAddr7=" + document.getElementById("FirewallAcceptAddr7").value+
+						"&FirewallAcceptAddr8=" + document.getElementById("FirewallAcceptAddr8").value+
+						"&FirewallAcceptAddr9=" + document.getElementById("FirewallAcceptAddr9").value;
+			// POST 請求必須設置表頭在 open() 下面,send() 上面
+			request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+			request.send(data);
+
+			request.onreadystatechange = function() {
+				// 伺服器請求完成
+				if (request.readyState == 4) {
+					 document.getElementById("loading").style.display="none";
+					// 伺服器回應成功
+					if (request.status == 200 && JSON.parse(request.responseText).result=="Success") {
+						alert("<?php echo $lang->showWord("done")?>");
+						location.href="set_network.php";
+					} else {
+						alert(JSON.parse(request.responseText).message);
+					}
+					request = null;
+				}
+			}
+		}
+	}
+
+	function formCheck()
+	{
+		if(document.getElementById("Eth0IpAddress").value != ""){
+			if(!ValidateIPaddress("Eth0IpAddress")) return false;
+		}
+		if(document.getElementById("Eth0SubmaskAddress").value != ""){
+			if(!ValidateIPaddress("Eth0SubmaskAddress")) return false;
+		}
+		if(document.getElementById("Eth0GatewayAddress").value != ""){
+			if(!ValidateIPaddress("Eth0GatewayAddress")) return false;
+		}
+		// if(document.getElementById("Eth1IpAddress").value != ""){
+			// if(!ValidateIPaddress("Eth1IpAddress")) return false;
+		// }
+		// if(document.getElementById("Eth1SubmaskAddress").value != ""){
+			// if(!ValidateIPaddress("Eth1SubmaskAddress")) return false;
+		// }
+		// if(document.getElementById("Eth1GatewayAddress").value != ""){
+			// if(!ValidateIPaddress("Eth1GatewayAddress")) return false;
+		// }
+		if(document.getElementById("WifiIpAddress").value != ""){
+			if(!ValidateIPaddress("WifiIpAddress")) return false;
+		}
+		if(document.getElementById("WifiSubmaskAddress").value != ""){
+			if(!ValidateIPaddress("WifiSubmaskAddress")) return false;
+		}
+		if(document.getElementById("WifiGatewayAddress").value != ""){
+			if(!ValidateIPaddress("WifiGatewayAddress")) return false;
+		}
+		if(document.getElementById("TelcomIpAddress").value != ""){
+			if(!ValidateIPaddress("TelcomIpAddress")) return false;
+		}
+
+		return true;
+	}
+
+	function WifiMode_changed(){
+		if(document.getElementById("WifiMode").value=="0"){
+			document.getElementById("WifiDhcpServer").disabled=true;
+			document.getElementById("WifiDhcpClient").disabled=true;
+			document.getElementById("WifiSsid").disabled=true;
+			document.getElementById("WifiPassword").disabled=true;
+			document.getElementById("WifiIpAddress").disabled=true;
+			document.getElementById("WifiSubmaskAddress").disabled=true;
+			document.getElementById("WifiGatewayAddress").disabled=true;
+			document.getElementById("WifiDhcpServerDiv").style.display="none";
+			document.getElementById("WifiDhcpClientDiv").style.display="none";
+			document.getElementById("WifiSsidDiv").style.display="none";
+			document.getElementById("WifiPasswordDiv").style.display="none";
+			document.getElementById("WifiBroadcastSsidDiv").style.display="none";
+			document.getElementById("WifiTargetBssidMacDiv").style.display="none";
+			document.getElementById("WifiRssiDiv").style.display="none";
+			document.getElementById("WifiMacAddressDiv").style.display="none";
+			document.getElementById("WifiIpAddressDiv").style.display="none";
+			document.getElementById("WifiSubmaskAddressDiv").style.display="none";
+			document.getElementById("WifiGatewayAddressDiv").style.display="none";
+			document.getElementById("WifiNetworkConnDiv").style.display="none";
+		}
+		if(document.getElementById("WifiMode").value=="1"){
+			document.getElementById("WifiDhcpServer").disabled=true;
+			document.getElementById("WifiDhcpClient").disabled=false;
+			document.getElementById("WifiSsid").disabled=false;
+			document.getElementById("WifiPassword").disabled=false;
+			document.getElementById("WifiSsid").value="<?php echo $obj->{'WifiSsid'};?>";
+			document.getElementById("WifiPassword").value="<?php echo $obj->{'WifiPassword'};?>";
+			document.getElementById("WifiIpAddress").disabled=false;
+			document.getElementById("WifiSubmaskAddress").disabled=false;
+			document.getElementById("WifiGatewayAddress").disabled=false;
+			document.getElementById("WifiIpAddress").value="<?php echo $obj->{'WifiIpAddress'};?>";
+			document.getElementById("WifiSubmaskAddress").value="<?php echo $obj->{'WifiSubmaskAddress'};?>";
+			document.getElementById("WifiGatewayAddress").value="<?php echo $obj->{'WifiGatewayAddress'};?>";
+			document.getElementById("WifiDhcpServerDiv").style.display="none";
+			document.getElementById("WifiDhcpClientDiv").style.display="block";
+			document.getElementById("WifiSsidDiv").style.display="block";
+			document.getElementById("WifiPasswordDiv").style.display="block";
+			document.getElementById("WifiBroadcastSsidDiv").style.display="none";
+			document.getElementById("WifiTargetBssidMacDiv").style.display="block";
+			document.getElementById("WifiRssiDiv").style.display="block";
+			document.getElementById("WifiMacAddressDiv").style.display="block";
+			document.getElementById("WifiIpAddressDiv").style.display="block";
+			document.getElementById("WifiSubmaskAddressDiv").style.display="block";
+			document.getElementById("WifiGatewayAddressDiv").style.display="block";
+			document.getElementById("WifiNetworkConnDiv").style.display="block";
+		}
+		if(document.getElementById("WifiMode").value=="2"){
+			document.getElementById("WifiDhcpServer").disabled=false;
+			document.getElementById("WifiDhcpClient").disabled=true;
+			document.getElementById("WifiSsid").disabled=true;
+			document.getElementById("WifiPassword").disabled=true;
+			document.getElementById("WifiSsid").value="<?php echo $ModelName.$SerialNumber?>";
+			document.getElementById("WifiPassword").value="";
+			document.getElementById("WifiIpAddress").disabled=true;
+			document.getElementById("WifiSubmaskAddress").disabled=true;
+			document.getElementById("WifiGatewayAddress").disabled=true;
+			document.getElementById("WifiDhcpServerDiv").style.display="block";
+			document.getElementById("WifiDhcpClientDiv").style.display="none";
+			document.getElementById("WifiSsidDiv").style.display="block";
+			document.getElementById("WifiPasswordDiv").style.display="block";
+			document.getElementById("WifiBroadcastSsidDiv").style.display="block";
+			document.getElementById("WifiTargetBssidMacDiv").style.display="none";
+			document.getElementById("WifiRssiDiv").style.display="block";
+			document.getElementById("WifiMacAddressDiv").style.display="block";
+			document.getElementById("WifiIpAddressDiv").style.display="none";
+			document.getElementById("WifiSubmaskAddressDiv").style.display="none";
+			document.getElementById("WifiGatewayAddressDiv").style.display="none";
+			document.getElementById("WifiNetworkConnDiv").style.display="block";
+		}
+		WifiDhcp_changed();
+	}
+	function EthDhcp_changed(){
+		if(document.getElementById("Eth0DhcpClient").value=="0"){
+			document.getElementById("Eth0IpAddress").disabled=true;
+			document.getElementById("Eth0SubmaskAddress").disabled=true;
+			document.getElementById("Eth0GatewayAddress").disabled=true;
+		}
+		if(document.getElementById("Eth0DhcpClient").value=="1"){
+			document.getElementById("Eth0IpAddress").disabled=false;
+			document.getElementById("Eth0SubmaskAddress").disabled=false;
+			document.getElementById("Eth0GatewayAddress").disabled=false;
+			document.getElementById("Eth0IpAddress").value="<?php echo $obj->{'Eth0IpAddress'};?>";
+			document.getElementById("Eth0SubmaskAddress").value="<?php echo $obj->{'Eth0SubmaskAddress'};?>";
+			document.getElementById("Eth0GatewayAddress").value="<?php echo $obj->{'Eth0GatewayAddress'};?>";
+		}
+	}
+	function WifiDhcp_changed(){
+		if(document.getElementById("WifiDhcpClient").disabled===false && document.getElementById("WifiDhcpClient").value=="0"){
+			document.getElementById("WifiIpAddress").disabled=true;
+			document.getElementById("WifiSubmaskAddress").disabled=true;
+			document.getElementById("WifiGatewayAddress").disabled=true;
+		}
+		if(document.getElementById("WifiDhcpClient").disabled===false && document.getElementById("WifiDhcpClient").value=="1"){
+			document.getElementById("WifiIpAddress").disabled=false;
+			document.getElementById("WifiSubmaskAddress").disabled=false;
+			document.getElementById("WifiGatewayAddress").disabled=false;
+			document.getElementById("WifiIpAddress").value="<?php echo $obj->{'WifiIpAddress'};?>";
+			document.getElementById("WifiSubmaskAddress").value="<?php echo $obj->{'WifiSubmaskAddress'};?>";
+			document.getElementById("WifiGatewayAddress").value="<?php echo $obj->{'WifiGatewayAddress'};?>";
+		}
+	}
+	
+	function Firewall_changed(){
+		if(document.getElementById("isEnalbleFirewall").value=="1"){
+			document.getElementById("FirewallAcceptAddrDiv").style.display="block";
+		}
+		else{
+			document.getElementById("FirewallAcceptAddrDiv").style.display="none";
+		}
+	}
+
+	function isNumberKey(evt)
+	{
+		var charCode = (evt.which) ? evt.which : event.keyCode
+
+		if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode != 46))
+			return false;
+
+		return true;
+	}
+
+	function ValidateIPaddress(id) {
+		var ipaddress = document.getElementById(id).value;
+		if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipaddress)) {
+			return true;
+		}
+		alert("You have entered an invalid IP address on " + id + "!")
+		document.getElementById(id).focus();
+		return false;
+	}
+
+	function scan_wifi()
+        {
+          window.open("scan_wifi.php","_blank","height=200,width=400, status=yes,toolbar=no,menubar=no,location=no");
+        }
+	$("#scan").fancybox({
+		'type'				: 'iframe',
+		'iframe' : {
+			'css' : {
+				'width' : '600px',
+				'height': '200px'
+			}
+		}
+	});
+</script>
+
+</html>

+ 225 - 164
EVSE/rootfs/var/www/set_network_action.php

@@ -1,164 +1,225 @@
-<?php
-	// 設置資料類型 json,編碼格式 utf-8
-	header('Content-Type: application/json; charset=UTF-8');
-	
-	// 判斷如果是 GET 請求,則進行搜尋;如果是 POST 請求,則進行新建
-	// $_SERVER['REQUEST_METHOD'] 返回訪問頁面使用的請求方法
-	if ($_SERVER['REQUEST_METHOD'] == "GET") {
-		create();
-	} else if ($_SERVER['REQUEST_METHOD'] == "POST") {
-		create();
-	}
-
-	// 新建員工
-	function create() {
-		checkip("Eth0IpAddress");
-		checkip("Eth0SubmaskAddress");
-		checkip("Eth0GatewayAddress");
-		checkip("WifiIpAddress");
-		checkip("WifiSubmaskAddress");
-		checkip("WifiGatewayAddress");
-		checkip("TelcomIpAddress");
-		checkValue("Eth0DhcpClient");
-		checkValue("WifiMode");
-		checkValue("WifiBroadcastSsid");
-		checkValue("WifiDhcpServer");
-		checkValue("WifiDhcpClient");
-		checkValue("TelcomEnabled");
-		WifiMode_changed();
-		if(isset($_REQUEST['Eth0DhcpClient'])){
-			$json['Eth0DhcpClient']			= $_REQUEST['Eth0DhcpClient'];
-		}
-		if(isset($_REQUEST['Eth0IpAddress'])){
-			$json['Eth0IpAddress']			= $_REQUEST['Eth0IpAddress'];
-		}
-		if(isset($_REQUEST['Eth0SubmaskAddress'])){
-			$json['Eth0SubmaskAddress']		= $_REQUEST['Eth0SubmaskAddress'];
-		}
-		if(isset($_REQUEST['Eth0GatewayAddress'])){
-			$json['Eth0GatewayAddress']		= $_REQUEST['Eth0GatewayAddress'];
-		}
-		if(isset($_REQUEST['WifiMode'])){
-			$json['WifiMode']				= $_REQUEST['WifiMode'];
-		}
-		if(isset($_REQUEST['WifiBroadcastSsid'])){
-			$json['WifiBroadcastSsid']				= $_REQUEST['WifiBroadcastSsid'];
-		}
-		if(isset($_REQUEST['WifiTargetBssidMac'])){
-			$json['WifiTargetBssidMac']				= str_replace("&amp;","&",str_replace("&quot;",'"',str_replace("&#039;","'",str_replace("&lt;","<",str_replace("&gt;",">",$_REQUEST['WifiTargetBssidMac'])))));
-		}
-		if(isset($_REQUEST['WifiSsid'])){
-			$json['WifiSsid']				= str_replace("&amp;","&",str_replace("&quot;",'"',str_replace("&#039;","'",str_replace("&lt;","<",str_replace("&gt;",">",$_REQUEST['WifiSsid'])))));
-		}
-		if(isset($_REQUEST['WifiPassword'])){
-			$json['WifiPassword']			= str_replace("&amp;","&",str_replace("&quot;",'"',str_replace("&#039;","'",str_replace("&lt;","<",str_replace("&gt;",">",$_REQUEST['WifiPassword'])))));
-		}
-		if(isset($_REQUEST['WifiDhcpServer'])){
-			$json['WifiDhcpServer']			= $_REQUEST['WifiDhcpServer'];
-		}
-		if(isset($_REQUEST['WifiDhcpClient'])){
-			$json['WifiDhcpClient']			= $_REQUEST['WifiDhcpClient'];
-		}
-		if(isset($_REQUEST['WifiIpAddress'])){
-			$json['WifiIpAddress']			= $_REQUEST['WifiIpAddress'];
-		}
-		if(isset($_REQUEST['WifiSubmaskAddress'])){
-			$json['WifiSubmaskAddress']		= $_REQUEST['WifiSubmaskAddress'];
-		}
-		if(isset($_REQUEST['WifiGatewayAddress'])){
-			$json['WifiGatewayAddress']		= $_REQUEST['WifiGatewayAddress'];
-		}
-		if(isset($_REQUEST['TelcomApn'])){
-			$json['TelcomApn']				= str_replace("&amp;","&",str_replace("&quot;",'"',str_replace("&#039;","'",str_replace("&lt;","<",str_replace("&gt;",">",$_REQUEST['TelcomApn'])))));
-		}
-		if(isset($_REQUEST['TelcomChapPapId'])){
-			$json['TelcomChapPapId']		= str_replace("&amp;","&",str_replace("&quot;",'"',str_replace("&#039;","'",str_replace("&lt;","<",str_replace("&gt;",">",$_REQUEST['TelcomChapPapId'])))));
-		}
-		if(isset($_REQUEST['TelcomChapPapPwd'])){
-			$json['TelcomChapPapPwd']		= str_replace("&amp;","&",str_replace("&quot;",'"',str_replace("&#039;","'",str_replace("&lt;","<",str_replace("&gt;",">",$_REQUEST['TelcomChapPapPwd'])))));
-		}
-		if(isset($_REQUEST['TelcomIpAddress'])){
-			$json['TelcomIpAddress']		= $_REQUEST['TelcomIpAddress'];
-		}
-		if(isset($_REQUEST['TelcomEnabled'])){
-			$json['TelcomEnabled']			= $_REQUEST['TelcomEnabled'];
-		}
-		if(isset($_REQUEST['TelcomNetworkType'])){
-			$json['TelcomNetworkType']			= $_REQUEST['TelcomNetworkType'];
-		}
-
-//		ob_start();
-		
-		shell_exec('sync;sync;sync');
-		chdir("/root");
-		$str_json=json_encode($json);
-		exec("'./WebService' '3' '".$str_json."'",$output,$return_var);
-		 if(count($output)!=0){
-			 $jsone['result'] = "Success";
-			 $jsone['message'] = $json;
-			 echo json_encode($jsone);
-			 exit;
-		 }
-		 else{
-//			 $jsone['result'] = "Error";
-			 $jsone['result'] = $str_json;
-			 $jsone['message'] = "Something went wrong on machine";
-			 echo json_encode($jsone);
-			 return false;
-			 exit;
-		 }
-//		ob_end_clean();	
-	}
-
-	function checkip($id){
-		$ip=$_REQUEST[$id];
-		if($_REQUEST[$id] != ""){
-			if(ip2long($ip)){
-				
-			}
-			else{
-				$jsone['result'] = "Fail";
-				$jsone['message'] = "You have entered an invalid IP address on " . $id;
-				echo json_encode($jsone);
-				exit;
-			}
-		}
-	}
-
-	function checkValue($id){
-		if($_REQUEST[$id] != ""){
-			if(strlen($_REQUEST[$id])!=1){
-					$jsone['result'] = "Fail";
-					$jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric";
-					echo json_encode($jsone);
-					exit;
-			}
-			if(!is_numeric($_REQUEST[$id])){
-					$jsone['result'] = "Fail";
-					$jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric";
-					echo json_encode($jsone);
-					exit;
-			}
-		}
-	}
-
-	function WifiMode_changed(){
-		if($_REQUEST['WifiMode']=="0"){
-//			$_REQUEST['WifiDhcpServer']=1;
-//			$_REQUEST['WifiDhcpClient']=1;
-			$_REQUEST['WifiSsid']="";
-			$_REQUEST['WifiPassword']="";
-		}
-		if($_REQUEST['WifiMode']=="1"){
-//			$_REQUEST['WifiDhcpServer']=1;
-//			$_REQUEST['WifiDhcpClient']=0;
-		}
-		if($_REQUEST['WifiMode']=="2"){
-//			$_REQUEST['WifiDhcpServer']=0;
-//			$_REQUEST['WifiDhcpClient']=1;
-			$_REQUEST['WifiSsid']="";
-			$_REQUEST['WifiPassword']="";
-		}
-	}
-
-?>
+<?php
+	// 設置資料類型 json,編碼格式 utf-8
+	header('Content-Type: application/json; charset=UTF-8');
+	
+	// 判斷如果是 GET 請求,則進行搜尋;如果是 POST 請求,則進行新建
+	// $_SERVER['REQUEST_METHOD'] 返回訪問頁面使用的請求方法
+	if ($_SERVER['REQUEST_METHOD'] == "GET") {
+		create();
+	} else if ($_SERVER['REQUEST_METHOD'] == "POST") {
+		create();
+	}
+
+	// 新建員工
+	function create() {
+		checkip("Eth0IpAddress");
+		checkip("Eth0SubmaskAddress");
+		checkip("Eth0GatewayAddress");
+		checkip("WifiIpAddress");
+		checkip("WifiSubmaskAddress");
+		checkip("WifiGatewayAddress");
+		checkip("TelcomIpAddress");
+		checkValue("Eth0DhcpClient");
+		checkValue("WifiMode");
+		checkValue("WifiBroadcastSsid");
+		checkValue("WifiDhcpServer");
+		checkValue("WifiDhcpClient");
+		checkValue("TelcomEnabled");
+		WifiMode_changed();
+		if(isset($_REQUEST['Eth0DhcpClient'])){
+			$json['Eth0DhcpClient']			= $_REQUEST['Eth0DhcpClient'];
+		}
+		if(isset($_REQUEST['Eth0IpAddress'])){
+			$json['Eth0IpAddress']			= $_REQUEST['Eth0IpAddress'];
+		}
+		if(isset($_REQUEST['Eth0SubmaskAddress'])){
+			$json['Eth0SubmaskAddress']		= $_REQUEST['Eth0SubmaskAddress'];
+		}
+		if(isset($_REQUEST['Eth0GatewayAddress'])){
+			$json['Eth0GatewayAddress']		= $_REQUEST['Eth0GatewayAddress'];
+		}
+		if(isset($_REQUEST['WifiMode'])){
+			$json['WifiMode']				= $_REQUEST['WifiMode'];
+		}
+		if(isset($_REQUEST['WifiBroadcastSsid'])){
+			$json['WifiBroadcastSsid']		= $_REQUEST['WifiBroadcastSsid'];
+		}
+		if(isset($_REQUEST['WifiTargetBssidMac'])){
+			$json['WifiTargetBssidMac']		= str_replace("&amp;","&",str_replace("&quot;",'"',str_replace("&#039;","'",str_replace("&lt;","<",str_replace("&gt;",">",$_REQUEST['WifiTargetBssidMac'])))));
+		}
+		if(isset($_REQUEST['WifiSsid'])){
+			$json['WifiSsid']				= str_replace("&amp;","&",str_replace("&quot;",'"',str_replace("&#039;","'",str_replace("&lt;","<",str_replace("&gt;",">",$_REQUEST['WifiSsid'])))));
+		}
+		if(isset($_REQUEST['WifiPassword'])){
+			$json['WifiPassword']			= str_replace("&amp;","&",str_replace("&quot;",'"',str_replace("&#039;","'",str_replace("&lt;","<",str_replace("&gt;",">",$_REQUEST['WifiPassword'])))));
+		}
+		if(isset($_REQUEST['WifiDhcpServer'])){
+			$json['WifiDhcpServer']			= $_REQUEST['WifiDhcpServer'];
+		}
+		if(isset($_REQUEST['WifiDhcpClient'])){
+			$json['WifiDhcpClient']			= $_REQUEST['WifiDhcpClient'];
+		}
+		if(isset($_REQUEST['WifiIpAddress'])){
+			$json['WifiIpAddress']			= $_REQUEST['WifiIpAddress'];
+		}
+		if(isset($_REQUEST['WifiSubmaskAddress'])){
+			$json['WifiSubmaskAddress']		= $_REQUEST['WifiSubmaskAddress'];
+		}
+		if(isset($_REQUEST['WifiGatewayAddress'])){
+			$json['WifiGatewayAddress']		= $_REQUEST['WifiGatewayAddress'];
+		}
+		if(isset($_REQUEST['TelcomApn'])){
+			$json['TelcomApn']				= str_replace("&amp;","&",str_replace("&quot;",'"',str_replace("&#039;","'",str_replace("&lt;","<",str_replace("&gt;",">",$_REQUEST['TelcomApn'])))));
+		}
+		if(isset($_REQUEST['TelcomChapPapId'])){
+			$json['TelcomChapPapId']		= str_replace("&amp;","&",str_replace("&quot;",'"',str_replace("&#039;","'",str_replace("&lt;","<",str_replace("&gt;",">",$_REQUEST['TelcomChapPapId'])))));
+		}
+		if(isset($_REQUEST['TelcomChapPapPwd'])){
+			$json['TelcomChapPapPwd']		= str_replace("&amp;","&",str_replace("&quot;",'"',str_replace("&#039;","'",str_replace("&lt;","<",str_replace("&gt;",">",$_REQUEST['TelcomChapPapPwd'])))));
+		}
+		if(isset($_REQUEST['TelcomIpAddress'])){
+			$json['TelcomIpAddress']		= $_REQUEST['TelcomIpAddress'];
+		}
+		if(isset($_REQUEST['TelcomEnabled'])){
+			$json['TelcomEnabled']			= $_REQUEST['TelcomEnabled'];
+		}
+		if(isset($_REQUEST['TelcomNetworkType'])){
+			$json['TelcomNetworkType']		= $_REQUEST['TelcomNetworkType'];
+		}
+		if(isset($_REQUEST['isEnalbleFirewall'])){
+			$json['isEnalbleFirewall']		= $_REQUEST['isEnalbleFirewall'];
+		}
+		if(isset($_REQUEST['FirewallAcceptAddr0'])){
+			checkip2("FirewallAcceptAddr0");
+			$json['FirewallAcceptAddr0']	= $_REQUEST['FirewallAcceptAddr0'];
+		}
+		if(isset($_REQUEST['FirewallAcceptAddr1'])){
+			checkip2("FirewallAcceptAddr1");
+			$json['FirewallAcceptAddr1']	= $_REQUEST['FirewallAcceptAddr1'];
+		}
+		if(isset($_REQUEST['FirewallAcceptAddr2'])){
+			checkip2("FirewallAcceptAddr2");
+			$json['FirewallAcceptAddr2']	= $_REQUEST['FirewallAcceptAddr2'];
+		}
+		if(isset($_REQUEST['FirewallAcceptAddr3'])){
+			checkip2("FirewallAcceptAddr3");
+			$json['FirewallAcceptAddr3']	= $_REQUEST['FirewallAcceptAddr3'];
+		}
+		if(isset($_REQUEST['FirewallAcceptAddr4'])){
+			checkip2("FirewallAcceptAddr4");
+			$json['FirewallAcceptAddr4']	= $_REQUEST['FirewallAcceptAddr4'];
+		}
+		if(isset($_REQUEST['FirewallAcceptAddr5'])){
+			checkip2("FirewallAcceptAddr5");
+			$json['FirewallAcceptAddr5']	= $_REQUEST['FirewallAcceptAddr5'];
+		}
+		if(isset($_REQUEST['FirewallAcceptAddr6'])){
+			checkip2("FirewallAcceptAddr6");
+			$json['FirewallAcceptAddr6']	= $_REQUEST['FirewallAcceptAddr6'];
+		}
+		if(isset($_REQUEST['FirewallAcceptAddr7'])){
+			checkip2("FirewallAcceptAddr7");
+			$json['FirewallAcceptAddr7']	= $_REQUEST['FirewallAcceptAddr7'];
+		}
+		if(isset($_REQUEST['FirewallAcceptAddr8'])){
+			checkip2("FirewallAcceptAddr8");
+			$json['FirewallAcceptAddr8']	= $_REQUEST['FirewallAcceptAddr8'];
+		}
+		if(isset($_REQUEST['FirewallAcceptAddr9'])){
+			checkip2("FirewallAcceptAddr9");
+			$json['FirewallAcceptAddr9']	= $_REQUEST['FirewallAcceptAddr9'];
+		}
+
+//		ob_start();
+		
+		shell_exec('sync;sync;sync');
+		chdir("/root");
+		$str_json=json_encode($json);
+		exec("'./WebService' '3' '".$str_json."'",$output,$return_var);
+		 if(count($output)!=0){
+			 $jsone['result'] = "Success";
+			 $jsone['message'] = $json;
+			 echo json_encode($jsone);
+			 exit;
+		 }
+		 else{
+//			 $jsone['result'] = "Error";
+			 $jsone['result'] = $str_json;
+			 $jsone['message'] = "Something went wrong on machine";
+			 echo json_encode($jsone);
+			 return false;
+			 exit;
+		 }
+//		ob_end_clean();	
+	}
+
+	function checkip($id){
+		$ip=$_REQUEST[$id];
+		if($_REQUEST[$id] != ""){
+			if(ip2long($ip)){
+				
+			}
+			else{
+				$jsone['result'] = "Fail";
+				$jsone['message'] = "You have entered an invalid IP address on " . $id;
+				echo json_encode($jsone);
+				exit;
+			}
+		}
+	}
+
+	function checkip2($id){
+		$ip=$_REQUEST[$id];
+		if($_REQUEST[$id] != ""){
+			if(ip2long($ip)){
+
+			}
+			else if(preg_match('/^(?:[-A-Za-z0-9]+\.)+[A-Za-z]{2,6}$/', $ip)){
+
+			}
+			else{
+				$jsone['result'] = "Fail";
+				$jsone['message'] = "You have entered an invalid IP address or domain name on " . $id;
+				echo json_encode($jsone);
+				exit;
+			}
+		}
+	}
+
+	function checkValue($id){
+		if($_REQUEST[$id] != ""){
+			if(strlen($_REQUEST[$id])!=1){
+					$jsone['result'] = "Fail";
+					$jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric";
+					echo json_encode($jsone);
+					exit;
+			}
+			if(!is_numeric($_REQUEST[$id])){
+					$jsone['result'] = "Fail";
+					$jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric";
+					echo json_encode($jsone);
+					exit;
+			}
+		}
+	}
+
+	function WifiMode_changed(){
+		if($_REQUEST['WifiMode']=="0"){
+//			$_REQUEST['WifiDhcpServer']=1;
+//			$_REQUEST['WifiDhcpClient']=1;
+			$_REQUEST['WifiSsid']="";
+			$_REQUEST['WifiPassword']="";
+		}
+		if($_REQUEST['WifiMode']=="1"){
+//			$_REQUEST['WifiDhcpServer']=1;
+//			$_REQUEST['WifiDhcpClient']=0;
+		}
+		if($_REQUEST['WifiMode']=="2"){
+//			$_REQUEST['WifiDhcpServer']=0;
+//			$_REQUEST['WifiDhcpClient']=1;
+			$_REQUEST['WifiSsid']="";
+			$_REQUEST['WifiPassword']="";
+		}
+	}
+
+?>