set_network.php 27 KB

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