set_network.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  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":""?>>Acess 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">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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>APN</label>
  251. <input type="text" name="TelcomApn" id="TelcomApn" class="form-control" value="<?php echo $obj->{'TelcomApn'};?>">
  252. </div>
  253. <div class="form-group">
  254. <label>RSSI</label>
  255. <input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomRssi'};?> dBm">
  256. <input type="hidden" name="TelcomRssi" id="TelcomRssi" value="<?php echo $obj->{'TelcomRssi'};?>">
  257. </div>
  258. <div class="form-group">
  259. <label>Chap Pap Id</label>
  260. <input type="text" name="TelcomChapPapId" id="TelcomChapPapId" class="form-control" value="<?php echo $obj->{'TelcomChapPapId'};?>">
  261. </div>
  262. <div class="form-group">
  263. <label>Chap Pap Pwd</label>
  264. <input type="text" name="TelcomChapPapPwd" id="TelcomChapPapPwd" class="form-control" value="<?php echo $obj->{'TelcomChapPapPwd'};?>">
  265. </div>
  266. <div class="form-group">
  267. <label>Modem IMEI</label>
  268. <input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomModemImei'};?>">
  269. <input type="hidden" name="TelcomModemImei" id="TelcomModemImei" value="<?php echo $obj->{'TelcomModemImei'};?>">
  270. </div>
  271. <div class="form-group">
  272. <label>SIM IMSI</label>
  273. <input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomSimImsi'};?>">
  274. <input type="hidden" name="TelcomSimImsi" id="TelcomSimImsi" value="<?php echo $obj->{'TelcomSimImsi'};?>">
  275. </div>
  276. <div class="form-group">
  277. <label>SIM ICCID</label>
  278. <input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomSimIccid'};?>">
  279. <input type="hidden" name="TelcomSimIccid" id="TelcomSimIccid" value="<?php echo $obj->{'TelcomSimIccid'};?>">
  280. </div>
  281. <div class="form-group">
  282. <label>SIM Status</label>
  283. <input type="text" readonly class="form-control" placeholder="<?php echo $TelcomSimStatus;?>">
  284. <input type="hidden" name="TelcomSimStatus" id="TelcomSimStatus" value="<?php echo $obj->{'TelcomSimStatus'};?>">
  285. </div>
  286. <div class="form-group">
  287. <label>Modem Mode</label>
  288. <input type="text" readonly class="form-control" placeholder="<?php echo $TelcomModemMode;?>">
  289. <input type="hidden" name="TelcomModemMode" id="TelcomModemMode" value="<?php echo $obj->{'TelcomModemMode'};?>">
  290. </div>
  291. <div class="form-group">
  292. <label>IP Address</label>
  293. <input type="text" name="TelcomIpAddress" id="TelcomIpAddress" class="form-control" value="<?php echo $obj->{'TelcomIpAddress'};?>">
  294. </div>
  295. <div class="form-group">
  296. <label>Network Connection Status</label>
  297. <input type="text" readonly class="form-control" value="<?php echo $TelcomNetworkConn;?>">
  298. <input type="hidden" name="TelcomNetworkConn" id="TelcomNetworkConn" value="<?php echo $obj->{'TelcomNetworkConn'};?>">
  299. </div>
  300. </section>
  301. </article>
  302. <!--Bluetooth Module-->
  303. <?php /* <article class="envor-sorting-item css">
  304. <header><?php echo $lang->showWord("bluetooth_module"); ?><i class="fa fa-plus"></i></header>
  305. <section>
  306. <div class="form-group" style="display:<?php echo $am101;?>">
  307. <label>LoginCentralID</label>
  308. <input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'LoginCentralID'};?>">
  309. <input type="hidden" name="LoginCentralID" id="LoginCentralID" value="<?php echo $obj->{'LoginCentralID'};?>">
  310. </div>
  311. <div class="form-group" style="display:<?php echo $am101;?>">
  312. <label>isLogin</label>
  313. <input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'isLogin'};?>">
  314. <input type="hidden" name="isLogin" id="isLogin" value="<?php echo $obj->{'isLogin'};?>">
  315. </div>
  316. <div class="form-group" style="display:<?php echo $am101;?>">
  317. <label>isRequestStart</label>
  318. <input type="text" readonly class="form-control" value="<?php echo $isRequestStart;?>">
  319. <input type="hidden" name="isRequestStart" id="isRequestStart" value="<?php echo $obj->{'isRequestStart'};?>">
  320. </div>
  321. <div class="form-group" style="display:<?php echo $am101;?>">
  322. <label>isRequestStop</label>
  323. <input type="text" readonly class="form-control" value="<?php echo $isRequestStop;?>">
  324. <input type="hidden" name="isRequestStop" id="isRequestStop" value="<?php echo $obj->{'isRequestStop'};?>">
  325. </div>
  326. </section>
  327. </article> */?>
  328. <article class="envor-sorting-item css">
  329. <div align="center"><button id="save"><?php echo $lang->showWord("set")?></button></div>
  330. </article>
  331. </div>
  332. </div>
  333. </div>
  334. </div>
  335. </div>
  336. </section>
  337. </div>
  338. <?php
  339. include 'foot.php';
  340. ?>
  341. <script type="text/JavaScript">
  342. $(document).ready(function(){
  343. WifiMode_changed();
  344. EthDhcp_changed();
  345. WifiDhcp_changed();
  346. });
  347. document.getElementById("save").onclick = function() {
  348. if(formCheck())
  349. {
  350. window.location="#loadinghref";
  351. document.getElementById("loading").style.display="block";
  352. // 發送 Ajax 查詢請求並處理
  353. var request = new XMLHttpRequest();
  354. request.open("POST", "set_network_action.php");
  355. // POST 參數須使用 send() 發送
  356. // var data = "FtpServer=" + document.getElementById("FtpServer").value +
  357. var data = "Eth0DhcpClient=" + document.getElementById("Eth0DhcpClient").value+
  358. "&Eth0IpAddress=" + document.getElementById("Eth0IpAddress").value+
  359. "&Eth0SubmaskAddress=" + document.getElementById("Eth0SubmaskAddress").value+
  360. "&Eth0GatewayAddress=" + document.getElementById("Eth0GatewayAddress").value+
  361. // "&Eth1DhcpClient=" + document.getElementById("Eth1DhcpClient").value+
  362. // "&Eth1IpAddress=" + document.getElementById("Eth1IpAddress").value+
  363. // "&Eth1SubmaskAddress=" + document.getElementById("Eth1SubmaskAddress").value+
  364. // "&Eth1GatewayAddress=" + document.getElementById("Eth1GatewayAddress").value+
  365. "&WifiMode=" + document.getElementById("WifiMode").value+
  366. "&WifiSsid=" + document.getElementById("WifiSsid").value+
  367. "&WifiPassword=" + document.getElementById("WifiPassword").value+
  368. "&WifiDhcpServer=" + document.getElementById("WifiDhcpServer").value+
  369. "&WifiDhcpClient=" + document.getElementById("WifiDhcpClient").value+
  370. "&WifiIpAddress=" + document.getElementById("WifiIpAddress").value+
  371. "&WifiSubmaskAddress=" + document.getElementById("WifiSubmaskAddress").value+
  372. "&WifiGatewayAddress=" + document.getElementById("WifiGatewayAddress").value+
  373. "&TelcomApn=" + document.getElementById("TelcomApn").value+
  374. "&TelcomChapPapId=" + document.getElementById("TelcomChapPapId").value+
  375. "&TelcomChapPapPwd=" + document.getElementById("TelcomChapPapPwd").value+
  376. "&TelcomIpAddress=" + document.getElementById("TelcomIpAddress").value;
  377. // POST 請求必須設置表頭在 open() 下面,send() 上面
  378. request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  379. request.send(data);
  380. request.onreadystatechange = function() {
  381. // 伺服器請求完成
  382. if (request.readyState == 4) {
  383. document.getElementById("loading").style.display="none";
  384. // 伺服器回應成功
  385. if (request.status == 200 && JSON.parse(request.responseText).result=="Success") {
  386. alert("<?php echo $lang->showWord("done")?>");
  387. location.href="set_network.php";
  388. } else {
  389. alert(JSON.parse(request.responseText).message);
  390. }
  391. request = null;
  392. }
  393. }
  394. }
  395. }
  396. function formCheck()
  397. {
  398. if(document.getElementById("Eth0IpAddress").value != ""){
  399. if(!ValidateIPaddress("Eth0IpAddress")) return false;
  400. }
  401. if(document.getElementById("Eth0SubmaskAddress").value != ""){
  402. if(!ValidateIPaddress("Eth0SubmaskAddress")) return false;
  403. }
  404. if(document.getElementById("Eth0GatewayAddress").value != ""){
  405. if(!ValidateIPaddress("Eth0GatewayAddress")) return false;
  406. }
  407. // if(document.getElementById("Eth1IpAddress").value != ""){
  408. // if(!ValidateIPaddress("Eth1IpAddress")) return false;
  409. // }
  410. // if(document.getElementById("Eth1SubmaskAddress").value != ""){
  411. // if(!ValidateIPaddress("Eth1SubmaskAddress")) return false;
  412. // }
  413. // if(document.getElementById("Eth1GatewayAddress").value != ""){
  414. // if(!ValidateIPaddress("Eth1GatewayAddress")) return false;
  415. // }
  416. if(document.getElementById("WifiIpAddress").value != ""){
  417. if(!ValidateIPaddress("WifiIpAddress")) return false;
  418. }
  419. if(document.getElementById("WifiSubmaskAddress").value != ""){
  420. if(!ValidateIPaddress("WifiSubmaskAddress")) return false;
  421. }
  422. if(document.getElementById("WifiGatewayAddress").value != ""){
  423. if(!ValidateIPaddress("WifiGatewayAddress")) return false;
  424. }
  425. if(document.getElementById("TelcomIpAddress").value != ""){
  426. if(!ValidateIPaddress("TelcomIpAddress")) return false;
  427. }
  428. return true;
  429. }
  430. function WifiMode_changed(){
  431. if(document.getElementById("WifiMode").value=="0"){
  432. document.getElementById("WifiDhcpServer").disabled=true;
  433. document.getElementById("WifiDhcpClient").disabled=true;
  434. // document.getElementById("WifiDhcpServer").selectedIndex=1;
  435. // document.getElementById("WifiDhcpClient").selectedIndex=1;
  436. document.getElementById("WifiSsid").disabled=true;
  437. document.getElementById("WifiPassword").disabled=true;
  438. document.getElementById("WifiSsid").value="";
  439. document.getElementById("WifiPassword").value="";
  440. document.getElementById("WifiIpAddress").disabled=true;
  441. document.getElementById("WifiSubmaskAddress").disabled=true;
  442. document.getElementById("WifiGatewayAddress").disabled=true;
  443. document.getElementById("WifiIpAddress").value="";
  444. document.getElementById("WifiSubmaskAddress").value="";
  445. document.getElementById("WifiGatewayAddress").value="";
  446. }
  447. if(document.getElementById("WifiMode").value=="1"){
  448. document.getElementById("WifiDhcpServer").disabled=true;
  449. document.getElementById("WifiDhcpClient").disabled=false;
  450. // document.getElementById("WifiDhcpServer").selectedIndex=1;
  451. // document.getElementById("WifiDhcpClient").selectedIndex=0;
  452. document.getElementById("WifiSsid").disabled=false;
  453. document.getElementById("WifiPassword").disabled=false;
  454. document.getElementById("WifiSsid").value="<?php echo $obj->{'WifiSsid'};?>";
  455. document.getElementById("WifiPassword").value="<?php echo $obj->{'WifiPassword'};?>";
  456. document.getElementById("WifiIpAddress").disabled=false;
  457. document.getElementById("WifiSubmaskAddress").disabled=false;
  458. document.getElementById("WifiGatewayAddress").disabled=false;
  459. document.getElementById("WifiIpAddress").value="<?php echo $obj->{'WifiIpAddress'};?>";
  460. document.getElementById("WifiSubmaskAddress").value="<?php echo $obj->{'WifiSubmaskAddress'};?>";
  461. document.getElementById("WifiGatewayAddress").value="<?php echo $obj->{'WifiGatewayAddress'};?>";
  462. }
  463. if(document.getElementById("WifiMode").value=="2"){
  464. document.getElementById("WifiDhcpServer").disabled=false;
  465. document.getElementById("WifiDhcpClient").disabled=true;
  466. // document.getElementById("WifiDhcpServer").selectedIndex=0;
  467. // document.getElementById("WifiDhcpClient").selectedIndex=1;
  468. document.getElementById("WifiSsid").disabled=true;
  469. document.getElementById("WifiPassword").disabled=true;
  470. document.getElementById("WifiSsid").value="<?php echo $ModelName.$SerialNumber?>";
  471. document.getElementById("WifiPassword").value="";
  472. document.getElementById("WifiIpAddress").disabled=true;
  473. document.getElementById("WifiSubmaskAddress").disabled=true;
  474. document.getElementById("WifiGatewayAddress").disabled=true;
  475. document.getElementById("WifiIpAddress").value="";
  476. document.getElementById("WifiSubmaskAddress").value="";
  477. document.getElementById("WifiGatewayAddress").value="";
  478. }
  479. WifiDhcp_changed();
  480. }
  481. function EthDhcp_changed(){
  482. if(document.getElementById("Eth0DhcpClient").value=="0"){
  483. document.getElementById("Eth0IpAddress").disabled=true;
  484. document.getElementById("Eth0SubmaskAddress").disabled=true;
  485. document.getElementById("Eth0GatewayAddress").disabled=true;
  486. document.getElementById("Eth0IpAddress").value="";
  487. document.getElementById("Eth0SubmaskAddress").value="";
  488. document.getElementById("Eth0GatewayAddress").value="";
  489. }
  490. if(document.getElementById("Eth0DhcpClient").value=="1"){
  491. document.getElementById("Eth0IpAddress").disabled=false;
  492. document.getElementById("Eth0SubmaskAddress").disabled=false;
  493. document.getElementById("Eth0GatewayAddress").disabled=false;
  494. document.getElementById("Eth0IpAddress").value="<?php echo $obj->{'Eth0IpAddress'};?>";
  495. document.getElementById("Eth0SubmaskAddress").value="<?php echo $obj->{'Eth0SubmaskAddress'};?>";
  496. document.getElementById("Eth0GatewayAddress").value="<?php echo $obj->{'Eth0GatewayAddress'};?>";
  497. }
  498. }
  499. function WifiDhcp_changed(){
  500. if(document.getElementById("WifiDhcpClient").disabled===false && document.getElementById("WifiDhcpClient").value=="0"){
  501. document.getElementById("WifiIpAddress").disabled=true;
  502. document.getElementById("WifiSubmaskAddress").disabled=true;
  503. document.getElementById("WifiGatewayAddress").disabled=true;
  504. document.getElementById("WifiIpAddress").value="";
  505. document.getElementById("WifiSubmaskAddress").value="";
  506. document.getElementById("WifiGatewayAddress").value="";
  507. }
  508. if(document.getElementById("WifiDhcpClient").disabled===false && document.getElementById("WifiDhcpClient").value=="1"){
  509. document.getElementById("WifiIpAddress").disabled=false;
  510. document.getElementById("WifiSubmaskAddress").disabled=false;
  511. document.getElementById("WifiGatewayAddress").disabled=false;
  512. document.getElementById("WifiIpAddress").value="<?php echo $obj->{'WifiIpAddress'};?>";
  513. document.getElementById("WifiSubmaskAddress").value="<?php echo $obj->{'WifiSubmaskAddress'};?>";
  514. document.getElementById("WifiGatewayAddress").value="<?php echo $obj->{'WifiGatewayAddress'};?>";
  515. }
  516. }
  517. function isNumberKey(evt)
  518. {
  519. var charCode = (evt.which) ? evt.which : event.keyCode
  520. if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode != 46))
  521. return false;
  522. return true;
  523. }
  524. function ValidateIPaddress(id) {
  525. var ipaddress = document.getElementById(id).value;
  526. 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)) {
  527. return true;
  528. }
  529. alert("You have entered an invalid IP address on " + id + "!")
  530. document.getElementById(id).focus();
  531. return false;
  532. }
  533. </script>
  534. </html>