set_network.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. <?php
  2. ini_set('error_reporting', E_ALL | E_STRICT);
  3. $tag_header = 'set';
  4. include 'head.php';
  5. $obj = json_decode(trim($output[2]));//var_dump($obj);
  6. $system = json_decode(trim($output[0]),true);//var_dump($obj);
  7. $ModelName = $system['ModelName'];
  8. $SerialNumber = $system['SerialNumber'];
  9. $InternetConn='';
  10. switch ($obj->{'InternetConn'}){
  11. case 0:
  12. $InternetConn='disconnected';
  13. break;
  14. case 1:
  15. $InternetConn='connected';
  16. break;
  17. }
  18. $WifiNetworkConn='';
  19. switch ($obj->{'WifiNetworkConn'}){
  20. case 0:
  21. $WifiNetworkConn='disconnected';
  22. break;
  23. case 1:
  24. $WifiNetworkConn='connected';
  25. break;
  26. }
  27. $TelcomNetworkConn='';
  28. switch ($obj->{'TelcomNetworkConn'}){
  29. case 0:
  30. $TelcomNetworkConn='disconnected';
  31. break;
  32. case 1:
  33. $TelcomNetworkConn='connected';
  34. break;
  35. }
  36. $TelcomSimStatus='';
  37. switch ($obj->{'TelcomSimStatus'}){
  38. case 0:
  39. $TelcomSimStatus='no SIM card is found';
  40. break;
  41. case 1:
  42. $TelcomSimStatus='valid SIM card';
  43. break;
  44. case 2:
  45. $TelcomSimStatus='invalid SIM card';
  46. break;
  47. }
  48. $TelcomModemMode='';
  49. switch ($obj->{'TelcomModemMode'}){
  50. case 0:
  51. $TelcomModemMode='No services';
  52. break;
  53. case 1:
  54. $TelcomModemMode='CDMA';
  55. break;
  56. case 2:
  57. $TelcomModemMode='GSM/GPRS';
  58. break;
  59. case 3:
  60. $TelcomModemMode='WCDMA';
  61. break;
  62. case 4:
  63. $TelcomModemMode='GSM/WCDMA';
  64. break;
  65. case 5:
  66. $TelcomModemMode='TD_SCDMA mode';
  67. break;
  68. case 6:
  69. $TelcomModemMode='Unknow';
  70. break;
  71. }
  72. ?>
  73. <style>
  74. img {
  75. display: block;
  76. margin-left: auto;
  77. margin-right: auto;
  78. }
  79. </style>
  80. <div class="envor-content">
  81. <!--
  82. Page Title start
  83. //-->
  84. <section class="envor-page-title-1" data-stellar-background-ratio="0.5">
  85. <div class="container">
  86. <div class="row">
  87. <div class="col-lg-9 col-md-9 col-sm-9">
  88. <h1><?php echo $lang->showWord("network"); ?></h1>
  89. </div>
  90. </div>
  91. </div>
  92. <!--
  93. Page Title end
  94. //-->
  95. </section>
  96. <!--
  97. Main Content start
  98. //-->
  99. <a id="loadinghref"><div id="loading" style="display:none;"><img src="img/giphy.gif"/></div></a>
  100. <section class="envor-section">
  101. <div class="container">
  102. <div class="row">
  103. <div class="col-lg-12">
  104. <div class="envor-sorting" id="faq-sorting">
  105. <div class="envor-toggle">
  106. <!--Network Status-->
  107. <article class="envor-sorting-item css">
  108. <header><?php echo $lang->showWord("network_status"); ?><i class="fa fa-plus"></i></header>
  109. <section>
  110. <div class="form-group" style="display:<?php echo $am101;?>">
  111. <label>Internet Connection Status</label>
  112. <input type="text" readonly class="form-control" placeholder="<?php echo $InternetConn;?>">
  113. <input type="hidden" name="InternetConn" id="InternetConn" value="<?php echo $obj->{'InternetConn'};?>">
  114. </div>
  115. <?php /* <div class="form-group" style="display:<?php echo $am101;?>">
  116. <label>FtpServer</label>
  117. <input type="text" name="FtpServer" id="FtpServer" class="form-control" value="<?php echo $obj->{'FtpServer'};?>">
  118. </div>*/?>
  119. </section>
  120. </article>
  121. <!--Ethernet Interface0-->
  122. <article class="envor-sorting-item css" style="display:<?php echo $am101;?>">
  123. <header><?php echo $lang->showWord("ethernet_interface"); ?><i class="fa fa-plus"></i></header>
  124. <section>
  125. <div class="form-group">
  126. <label>DHCP Client</label>
  127. <select class="form-control" id="Eth0DhcpClient" name="Eth0DhcpClient" onchange="EthDhcp_changed();">
  128. <option value="0" <?php echo $obj->{'Eth0DhcpClient'}=="0"?"selected":""?>>enable</option>
  129. <option value="1" <?php echo $obj->{'Eth0DhcpClient'}=="1"?"selected":""?>>disable</option>
  130. </select>
  131. </div>
  132. <div class="form-group">
  133. <label>Mac Address</label>
  134. <input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'Eth0MacAddress'};?>">
  135. <input type="hidden" name="Eth0MacAddress" id="Eth0MacAddress" value="<?php echo $obj->{'Eth0MacAddress'};?>">
  136. </div>
  137. <div class="form-group">
  138. <label>IP Address</label>
  139. <input type="text" name="Eth0IpAddress" id="Eth0IpAddress" class="form-control" value="<?php echo $obj->{'Eth0IpAddress'};?>">
  140. </div>
  141. <div class="form-group">
  142. <label>Submask Address</label>
  143. <input type="text" name="Eth0SubmaskAddress" id="Eth0SubmaskAddress" class="form-control" value="<?php echo $obj->{'Eth0SubmaskAddress'};?>">
  144. </div>
  145. <div class="form-group">
  146. <label>Gateway Address</label>
  147. <input type="text" name="Eth0GatewayAddress" id="Eth0GatewayAddress" class="form-control" value="<?php echo $obj->{'Eth0GatewayAddress'};?>">
  148. </div>
  149. </section>
  150. </article>
  151. <?php /* <!--Ethernet Interface1-->
  152. <article class="envor-sorting-item css" style="display:<?php echo $am101;?>">
  153. <header><?php echo $lang->showWord("ethernet_interface"); ?><i class="fa fa-plus"></i></header>
  154. <section>
  155. <div class="form-group">
  156. <label>Eth1DhcpClient</label>
  157. <select class="form-control" id="Eth1DhcpClient" name="Eth1DhcpClient">
  158. <option value="0" <?php echo $obj->{'Eth1DhcpClient'}=="0"?"selected":""?>>enable</option>
  159. <option value="1" <?php echo $obj->{'Eth1DhcpClient'}=="1"?"selected":""?>>disable</option>
  160. </select>
  161. </div>
  162. <div class="form-group">
  163. <label>Eth1MacAddress</label>
  164. <input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'Eth1MacAddress'};?>">
  165. <input type="hidden" name="Eth1MacAddress" id="Eth1MacAddress" value="<?php echo $obj->{'Eth1MacAddress'};?>">
  166. </div>
  167. <div class="form-group">
  168. <label>Eth1IpAddress</label>
  169. <input type="text" name="Eth1IpAddress" id="Eth1IpAddress" class="form-control" value="<?php echo $obj->{'Eth1IpAddress'};?>">
  170. </div>
  171. <div class="form-group">
  172. <label>Eth1SubmaskAddress</label>
  173. <input type="text" name="Eth1SubmaskAddress" id="Eth1SubmaskAddress" class="form-control" value="<?php echo $obj->{'Eth1SubmaskAddress'};?>">
  174. </div>
  175. <div class="form-group">
  176. <label>Eth1GatewayAddress</label>
  177. <input type="text" name="Eth1GatewayAddress" id="Eth1GatewayAddress" class="form-control" value="<?php echo $obj->{'Eth1GatewayAddress'};?>">
  178. </div>
  179. </section>
  180. </article>*/?>
  181. <!--WiFi Module-->
  182. <article class="envor-sorting-item css" style="display:<?php echo $showWifi;?>">
  183. <header><?php echo $lang->showWord("WiFi_module"); ?><i class="fa fa-plus"></i></header>
  184. <section>
  185. <div class="form-group">
  186. <label>Mode</label>
  187. <select class="form-control" id="WifiMode" name="WifiMode" onchange="WifiMode_changed();">
  188. <option value="0" <?php echo $obj->{'WifiMode'}=="0"?"selected":""?>>disable</option>
  189. <option value="1" <?php echo $obj->{'WifiMode'}=="1"?"selected":""?>>station</option>
  190. <option value="2" <?php echo $obj->{'WifiMode'}=="2"?"selected":""?>>Access Point</option>
  191. <?php /* <option value="3" <?php echo $obj->{'WifiMode'}=="3"?"selected":""?>>Ad-Hoc</option>*/?>
  192. </select>
  193. </div>
  194. <div class="form-group" id="WifiSsidDiv">
  195. <label>SSID</label>
  196. <input type="text" name="WifiSsid" id="WifiSsid" class="form-control" value="<?php echo $obj->{'WifiSsid'};?>">
  197. </div>
  198. <div class="form-group" id="WifiPasswordDiv">
  199. <label>Password</label>
  200. <input type="text" name="WifiPassword" id="WifiPassword" class="form-control" value="<?php echo $obj->{'WifiPassword'};?>">
  201. </div>
  202. <div class="form-group" id="WifiRssiDiv">
  203. <label>RSSI</label>
  204. <input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'WifiRssi'};?> dBm">
  205. <input type="hidden" name="WifiRssi" id="WifiRssi" value="<?php echo $obj->{'WifiRssi'};?>">
  206. </div>
  207. <div class="form-group" id="WifiDhcpServerDiv">
  208. <label>DHCP Server</label>
  209. <select class="form-control" id="WifiDhcpServer" name="WifiDhcpServer">
  210. <option value="0" <?php echo $obj->{'WifiDhcpServer'}=="0"?"selected":""?>>enable</option>
  211. <option value="1" <?php echo $obj->{'WifiDhcpServer'}=="1"?"selected":""?>>disable</option>
  212. </select>
  213. </div>
  214. <div class="form-group" id="WifiDhcpClientDiv">
  215. <label>DHCP Client</label>
  216. <select class="form-control" id="WifiDhcpClient" name="WifiDhcpClient" onchange="WifiDhcp_changed();">
  217. <option value="0" <?php echo $obj->{'WifiDhcpClient'}=="0"?"selected":""?>>enable</option>
  218. <option value="1" <?php echo $obj->{'WifiDhcpClient'}=="1"?"selected":""?>>disable</option>
  219. </select>
  220. </div>
  221. <div class="form-group" id="WifiMacAddressDiv">
  222. <label>Mac Address</label>
  223. <input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'WifiMacAddress'};?>">
  224. <input type="hidden" name="WifiMacAddress" id="WifiMacAddress" value="<?php echo $obj->{'WifiMacAddress'};?>">
  225. </div>
  226. <div class="form-group" id="WifiIpAddressDiv">
  227. <label>IP Address</label>
  228. <input type="text" name="WifiIpAddress" id="WifiIpAddress" class="form-control" value="<?php echo $obj->{'WifiIpAddress'};?>">
  229. </div>
  230. <div class="form-group" id="WifiSubmaskAddressDiv">
  231. <label>Submask Address</label>
  232. <input type="text" name="WifiSubmaskAddress" id="WifiSubmaskAddress" class="form-control" value="<?php echo $obj->{'WifiSubmaskAddress'};?>">
  233. </div>
  234. <div class="form-group" id="WifiGatewayAddressDiv">
  235. <label>Gateway Address</label>
  236. <input type="text" name="WifiGatewayAddress" id="WifiGatewayAddress" class="form-control" value="<?php echo $obj->{'WifiGatewayAddress'};?>">
  237. </div>
  238. <div class="form-group" id="WifiNetworkConnDiv">
  239. <label>Network Connection Status</label>
  240. <input type="text" readonly class="form-control" value="<?php echo $WifiNetworkConn;?>">
  241. <input type="hidden" name="WifiNetworkConn" id="WifiNetworkConn" value="<?php echo $obj->{'WifiNetworkConn'};?>">
  242. </div>
  243. </section>
  244. </article>
  245. <!--3G/4G Module-->
  246. <article class="envor-sorting-item css" style="display:<?php echo $showTelcom;?>">
  247. <header><?php echo $lang->showWord("3G/4G_module"); ?><i class="fa fa-plus"></i></header>
  248. <section>
  249. <div class="form-group">
  250. <label>Mode</label>
  251. <select class="form-control" id="TelcomEnabled" name="TelcomEnabled">
  252. <option value="0" <?php echo $obj->{'TelcomEnabled'}=="0"?"selected":""?>>Disable</option>
  253. <option value="1" <?php echo $obj->{'TelcomEnabled'}=="1"?"selected":""?>>Enable</option>
  254. </select>
  255. </div>
  256. <div class="form-group">
  257. <label>APN</label>
  258. <input type="text" name="TelcomApn" id="TelcomApn" class="form-control" value="<?php echo $obj->{'TelcomApn'};?>">
  259. </div>
  260. <div class="form-group">
  261. <label>RSSI</label>
  262. <input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomRssi'};?> dBm">
  263. <input type="hidden" name="TelcomRssi" id="TelcomRssi" value="<?php echo $obj->{'TelcomRssi'};?>">
  264. </div>
  265. <div class="form-group">
  266. <label>Chap Pap Id</label>
  267. <input type="text" name="TelcomChapPapId" id="TelcomChapPapId" class="form-control" value="<?php echo $obj->{'TelcomChapPapId'};?>">
  268. </div>
  269. <div class="form-group">
  270. <label>Chap Pap Pwd</label>
  271. <input type="text" name="TelcomChapPapPwd" id="TelcomChapPapPwd" class="form-control" value="<?php echo $obj->{'TelcomChapPapPwd'};?>">
  272. </div>
  273. <div class="form-group">
  274. <label>Modem IMEI</label>
  275. <input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomModemImei'};?>">
  276. <input type="hidden" name="TelcomModemImei" id="TelcomModemImei" value="<?php echo $obj->{'TelcomModemImei'};?>">
  277. </div>
  278. <div class="form-group">
  279. <label>SIM IMSI</label>
  280. <input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomSimImsi'};?>">
  281. <input type="hidden" name="TelcomSimImsi" id="TelcomSimImsi" value="<?php echo $obj->{'TelcomSimImsi'};?>">
  282. </div>
  283. <div class="form-group">
  284. <label>SIM ICCID</label>
  285. <input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomSimIccid'};?>">
  286. <input type="hidden" name="TelcomSimIccid" id="TelcomSimIccid" value="<?php echo $obj->{'TelcomSimIccid'};?>">
  287. </div>
  288. <div class="form-group">
  289. <label>SIM Status</label>
  290. <input type="text" readonly class="form-control" placeholder="<?php echo $TelcomSimStatus;?>">
  291. <input type="hidden" name="TelcomSimStatus" id="TelcomSimStatus" value="<?php echo $obj->{'TelcomSimStatus'};?>">
  292. </div>
  293. <div class="form-group">
  294. <label>Modem Mode</label>
  295. <input type="text" readonly class="form-control" placeholder="<?php echo $TelcomModemMode;?>">
  296. <input type="hidden" name="TelcomModemMode" id="TelcomModemMode" value="<?php echo $obj->{'TelcomModemMode'};?>">
  297. </div>
  298. <div class="form-group">
  299. <label>IP Address</label>
  300. <input type="text" name="TelcomIpAddress" id="TelcomIpAddress" class="form-control" value="<?php echo $obj->{'TelcomIpAddress'};?>">
  301. </div>
  302. <div class="form-group">
  303. <label>Network Connection Status</label>
  304. <input type="text" readonly class="form-control" value="<?php echo $TelcomNetworkConn;?>">
  305. <input type="hidden" name="TelcomNetworkConn" id="TelcomNetworkConn" value="<?php echo $obj->{'TelcomNetworkConn'};?>">
  306. </div>
  307. </section>
  308. </article>
  309. <!--Bluetooth Module-->
  310. <?php /* <article class="envor-sorting-item css">
  311. <header><?php echo $lang->showWord("bluetooth_module"); ?><i class="fa fa-plus"></i></header>
  312. <section>
  313. <div class="form-group" style="display:<?php echo $am101;?>">
  314. <label>LoginCentralID</label>
  315. <input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'LoginCentralID'};?>">
  316. <input type="hidden" name="LoginCentralID" id="LoginCentralID" value="<?php echo $obj->{'LoginCentralID'};?>">
  317. </div>
  318. <div class="form-group" style="display:<?php echo $am101;?>">
  319. <label>isLogin</label>
  320. <input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'isLogin'};?>">
  321. <input type="hidden" name="isLogin" id="isLogin" value="<?php echo $obj->{'isLogin'};?>">
  322. </div>
  323. <div class="form-group" style="display:<?php echo $am101;?>">
  324. <label>isRequestStart</label>
  325. <input type="text" readonly class="form-control" value="<?php echo $isRequestStart;?>">
  326. <input type="hidden" name="isRequestStart" id="isRequestStart" value="<?php echo $obj->{'isRequestStart'};?>">
  327. </div>
  328. <div class="form-group" style="display:<?php echo $am101;?>">
  329. <label>isRequestStop</label>
  330. <input type="text" readonly class="form-control" value="<?php echo $isRequestStop;?>">
  331. <input type="hidden" name="isRequestStop" id="isRequestStop" value="<?php echo $obj->{'isRequestStop'};?>">
  332. </div>
  333. </section>
  334. </article> */?>
  335. <article class="envor-sorting-item css">
  336. <div align="center"><button id="save"><?php echo $lang->showWord("set")?></button></div>
  337. </article>
  338. </div>
  339. </div>
  340. </div>
  341. </div>
  342. </div>
  343. </section>
  344. </div>
  345. <?php
  346. include 'foot.php';
  347. ?>
  348. <script type="text/JavaScript">
  349. $(document).ready(function(){
  350. WifiMode_changed();
  351. EthDhcp_changed();
  352. WifiDhcp_changed();
  353. });
  354. document.getElementById("save").onclick = function() {
  355. if(formCheck())
  356. {
  357. window.location="#loadinghref";
  358. document.getElementById("loading").style.display="block";
  359. // 發送 Ajax 查詢請求並處理
  360. var request = new XMLHttpRequest();
  361. request.open("POST", "set_network_action.php");
  362. // POST 參數須使用 send() 發送
  363. // var data = "FtpServer=" + document.getElementById("FtpServer").value +
  364. var data = "Eth0DhcpClient=" + document.getElementById("Eth0DhcpClient").value+
  365. "&Eth0IpAddress=" + document.getElementById("Eth0IpAddress").value+
  366. "&Eth0SubmaskAddress=" + document.getElementById("Eth0SubmaskAddress").value+
  367. "&Eth0GatewayAddress=" + document.getElementById("Eth0GatewayAddress").value+
  368. // "&Eth1DhcpClient=" + document.getElementById("Eth1DhcpClient").value+
  369. // "&Eth1IpAddress=" + document.getElementById("Eth1IpAddress").value+
  370. // "&Eth1SubmaskAddress=" + document.getElementById("Eth1SubmaskAddress").value+
  371. // "&Eth1GatewayAddress=" + document.getElementById("Eth1GatewayAddress").value+
  372. "&WifiMode=" + document.getElementById("WifiMode").value+
  373. "&WifiSsid=" + document.getElementById("WifiSsid").value+
  374. "&WifiPassword=" + document.getElementById("WifiPassword").value+
  375. "&WifiDhcpServer=" + document.getElementById("WifiDhcpServer").value+
  376. "&WifiDhcpClient=" + document.getElementById("WifiDhcpClient").value+
  377. "&WifiIpAddress=" + document.getElementById("WifiIpAddress").value+
  378. "&WifiSubmaskAddress=" + document.getElementById("WifiSubmaskAddress").value+
  379. "&WifiGatewayAddress=" + document.getElementById("WifiGatewayAddress").value+
  380. "&TelcomApn=" + document.getElementById("TelcomApn").value+
  381. "&TelcomChapPapId=" + document.getElementById("TelcomChapPapId").value+
  382. "&TelcomChapPapPwd=" + document.getElementById("TelcomChapPapPwd").value+
  383. "&TelcomIpAddress=" + document.getElementById("TelcomIpAddress").value+
  384. "&TelcomEnabled=" + document.getElementById("TelcomEnabled").value;
  385. // POST 請求必須設置表頭在 open() 下面,send() 上面
  386. request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  387. request.send(data);
  388. request.onreadystatechange = function() {
  389. // 伺服器請求完成
  390. if (request.readyState == 4) {
  391. document.getElementById("loading").style.display="none";
  392. // 伺服器回應成功
  393. if (request.status == 200 && JSON.parse(request.responseText).result=="Success") {
  394. alert("<?php echo $lang->showWord("done")?>");
  395. location.href="set_network.php";
  396. } else {
  397. alert(JSON.parse(request.responseText).message);
  398. }
  399. request = null;
  400. }
  401. }
  402. }
  403. }
  404. function formCheck()
  405. {
  406. if(document.getElementById("Eth0IpAddress").value != ""){
  407. if(!ValidateIPaddress("Eth0IpAddress")) return false;
  408. }
  409. if(document.getElementById("Eth0SubmaskAddress").value != ""){
  410. if(!ValidateIPaddress("Eth0SubmaskAddress")) return false;
  411. }
  412. if(document.getElementById("Eth0GatewayAddress").value != ""){
  413. if(!ValidateIPaddress("Eth0GatewayAddress")) return false;
  414. }
  415. // if(document.getElementById("Eth1IpAddress").value != ""){
  416. // if(!ValidateIPaddress("Eth1IpAddress")) return false;
  417. // }
  418. // if(document.getElementById("Eth1SubmaskAddress").value != ""){
  419. // if(!ValidateIPaddress("Eth1SubmaskAddress")) return false;
  420. // }
  421. // if(document.getElementById("Eth1GatewayAddress").value != ""){
  422. // if(!ValidateIPaddress("Eth1GatewayAddress")) return false;
  423. // }
  424. if(document.getElementById("WifiIpAddress").value != ""){
  425. if(!ValidateIPaddress("WifiIpAddress")) return false;
  426. }
  427. if(document.getElementById("WifiSubmaskAddress").value != ""){
  428. if(!ValidateIPaddress("WifiSubmaskAddress")) return false;
  429. }
  430. if(document.getElementById("WifiGatewayAddress").value != ""){
  431. if(!ValidateIPaddress("WifiGatewayAddress")) return false;
  432. }
  433. if(document.getElementById("TelcomIpAddress").value != ""){
  434. if(!ValidateIPaddress("TelcomIpAddress")) return false;
  435. }
  436. return true;
  437. }
  438. function WifiMode_changed(){
  439. if(document.getElementById("WifiMode").value=="0"){
  440. document.getElementById("WifiDhcpServer").disabled=true;
  441. document.getElementById("WifiDhcpClient").disabled=true;
  442. document.getElementById("WifiSsid").disabled=true;
  443. document.getElementById("WifiPassword").disabled=true;
  444. document.getElementById("WifiIpAddress").disabled=true;
  445. document.getElementById("WifiSubmaskAddress").disabled=true;
  446. document.getElementById("WifiGatewayAddress").disabled=true;
  447. document.getElementById("WifiDhcpServerDiv").style.display="none";
  448. document.getElementById("WifiDhcpClientDiv").style.display="none";
  449. document.getElementById("WifiSsidDiv").style.display="none";
  450. document.getElementById("WifiPasswordDiv").style.display="none";
  451. document.getElementById("WifiRssiDiv").style.display="none";
  452. document.getElementById("WifiMacAddressDiv").style.display="none";
  453. document.getElementById("WifiIpAddressDiv").style.display="none";
  454. document.getElementById("WifiSubmaskAddressDiv").style.display="none";
  455. document.getElementById("WifiGatewayAddressDiv").style.display="none";
  456. document.getElementById("WifiNetworkConnDiv").style.display="none";
  457. }
  458. if(document.getElementById("WifiMode").value=="1"){
  459. document.getElementById("WifiDhcpServer").disabled=true;
  460. document.getElementById("WifiDhcpClient").disabled=false;
  461. document.getElementById("WifiSsid").disabled=false;
  462. document.getElementById("WifiPassword").disabled=false;
  463. document.getElementById("WifiSsid").value="<?php echo $obj->{'WifiSsid'};?>";
  464. document.getElementById("WifiPassword").value="<?php echo $obj->{'WifiPassword'};?>";
  465. document.getElementById("WifiIpAddress").disabled=false;
  466. document.getElementById("WifiSubmaskAddress").disabled=false;
  467. document.getElementById("WifiGatewayAddress").disabled=false;
  468. document.getElementById("WifiIpAddress").value="<?php echo $obj->{'WifiIpAddress'};?>";
  469. document.getElementById("WifiSubmaskAddress").value="<?php echo $obj->{'WifiSubmaskAddress'};?>";
  470. document.getElementById("WifiGatewayAddress").value="<?php echo $obj->{'WifiGatewayAddress'};?>";
  471. document.getElementById("WifiDhcpServerDiv").style.display="none";
  472. document.getElementById("WifiDhcpClientDiv").style.display="block";
  473. document.getElementById("WifiSsidDiv").style.display="block";
  474. document.getElementById("WifiPasswordDiv").style.display="block";
  475. document.getElementById("WifiRssiDiv").style.display="block";
  476. document.getElementById("WifiMacAddressDiv").style.display="block";
  477. document.getElementById("WifiIpAddressDiv").style.display="block";
  478. document.getElementById("WifiSubmaskAddressDiv").style.display="block";
  479. document.getElementById("WifiGatewayAddressDiv").style.display="block";
  480. document.getElementById("WifiNetworkConnDiv").style.display="block";
  481. }
  482. if(document.getElementById("WifiMode").value=="2"){
  483. document.getElementById("WifiDhcpServer").disabled=false;
  484. document.getElementById("WifiDhcpClient").disabled=true;
  485. document.getElementById("WifiSsid").disabled=true;
  486. document.getElementById("WifiPassword").disabled=true;
  487. document.getElementById("WifiSsid").value="<?php echo $ModelName.$SerialNumber?>";
  488. document.getElementById("WifiPassword").value="";
  489. document.getElementById("WifiIpAddress").disabled=true;
  490. document.getElementById("WifiSubmaskAddress").disabled=true;
  491. document.getElementById("WifiGatewayAddress").disabled=true;
  492. document.getElementById("WifiDhcpServerDiv").style.display="block";
  493. document.getElementById("WifiDhcpClientDiv").style.display="none";
  494. document.getElementById("WifiSsidDiv").style.display="block";
  495. document.getElementById("WifiPasswordDiv").style.display="block";
  496. document.getElementById("WifiRssiDiv").style.display="block";
  497. document.getElementById("WifiMacAddressDiv").style.display="block";
  498. document.getElementById("WifiIpAddressDiv").style.display="none";
  499. document.getElementById("WifiSubmaskAddressDiv").style.display="none";
  500. document.getElementById("WifiGatewayAddressDiv").style.display="none";
  501. document.getElementById("WifiNetworkConnDiv").style.display="block";
  502. }
  503. WifiDhcp_changed();
  504. }
  505. function EthDhcp_changed(){
  506. if(document.getElementById("Eth0DhcpClient").value=="0"){
  507. document.getElementById("Eth0IpAddress").disabled=true;
  508. document.getElementById("Eth0SubmaskAddress").disabled=true;
  509. document.getElementById("Eth0GatewayAddress").disabled=true;
  510. }
  511. if(document.getElementById("Eth0DhcpClient").value=="1"){
  512. document.getElementById("Eth0IpAddress").disabled=false;
  513. document.getElementById("Eth0SubmaskAddress").disabled=false;
  514. document.getElementById("Eth0GatewayAddress").disabled=false;
  515. document.getElementById("Eth0IpAddress").value="<?php echo $obj->{'Eth0IpAddress'};?>";
  516. document.getElementById("Eth0SubmaskAddress").value="<?php echo $obj->{'Eth0SubmaskAddress'};?>";
  517. document.getElementById("Eth0GatewayAddress").value="<?php echo $obj->{'Eth0GatewayAddress'};?>";
  518. }
  519. }
  520. function WifiDhcp_changed(){
  521. if(document.getElementById("WifiDhcpClient").disabled===false && document.getElementById("WifiDhcpClient").value=="0"){
  522. document.getElementById("WifiIpAddress").disabled=true;
  523. document.getElementById("WifiSubmaskAddress").disabled=true;
  524. document.getElementById("WifiGatewayAddress").disabled=true;
  525. }
  526. if(document.getElementById("WifiDhcpClient").disabled===false && document.getElementById("WifiDhcpClient").value=="1"){
  527. document.getElementById("WifiIpAddress").disabled=false;
  528. document.getElementById("WifiSubmaskAddress").disabled=false;
  529. document.getElementById("WifiGatewayAddress").disabled=false;
  530. document.getElementById("WifiIpAddress").value="<?php echo $obj->{'WifiIpAddress'};?>";
  531. document.getElementById("WifiSubmaskAddress").value="<?php echo $obj->{'WifiSubmaskAddress'};?>";
  532. document.getElementById("WifiGatewayAddress").value="<?php echo $obj->{'WifiGatewayAddress'};?>";
  533. }
  534. }
  535. function isNumberKey(evt)
  536. {
  537. var charCode = (evt.which) ? evt.which : event.keyCode
  538. if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode != 46))
  539. return false;
  540. return true;
  541. }
  542. function ValidateIPaddress(id) {
  543. var ipaddress = document.getElementById(id).value;
  544. 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)) {
  545. return true;
  546. }
  547. alert("You have entered an invalid IP address on " + id + "!")
  548. document.getElementById(id).focus();
  549. return false;
  550. }
  551. </script>
  552. </html>