set_network.php 30 KB

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