set_network.php 27 KB

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