set_network.php 28 KB

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