addnew.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. include '../../../auth.php';
  3. ?>
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <meta charset="UTF-8">
  8. <link rel="stylesheet" href="../../../script/tocas/tocas.css">
  9. <script type='text/javascript' src="../../../script/tocas/tocas.js"></script>
  10. <script src="../../../script/jquery.min.js"></script>
  11. <title>WIFI</title>
  12. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  13. </head>
  14. <body>
  15. <div class="ts fluid borderless slate">
  16. <div class="ts segment" style="width:100%;">
  17. <div class="ts header">
  18. Add new Wi-Fi network
  19. <div class="sub header">Connect Wi-Fi.</div>
  20. </div>
  21. </div>
  22. <div class="ts container">
  23. </div>
  24. </div>
  25. <br>
  26. <div class="ts container">
  27. <form id="form" class="ts form" id="wifi" action="">
  28. <div class="field">
  29. <label>Encryption method</label>
  30. <select name="encryption" id="encryption">
  31. <option>Select</option>
  32. <option id="WPA2">WPA2</option>
  33. <option id="802.1x">802.1x</option>
  34. <option id="no">no</option>
  35. </select>
  36. </div>
  37. <div id="info"></div>
  38. </form>
  39. <br><button class="ts button" onclick="submit()">Add</button>
  40. </div>
  41. <div id="msgbox" class="ts bottom right snackbar">
  42. <div class="content">
  43. Your request is processing now.
  44. </div>
  45. </div>
  46. <script>
  47. startup();
  48. function startup(){
  49. //Please ADD ALL LOAD ON STARTUP SCRIPT HERE
  50. }
  51. $( "#encryption" ).change(function() {
  52. form(this);
  53. });
  54. function form(method){
  55. if($(method).val() == "WPA2"){
  56. $( "#info" ).html('<div class="sixteen wide field"><input id="ssid" name="ssid" placeholder="SSID" type="text"></div><div class="sixteen wide field"><input id="psk" name="psk" placeholder="Password" type="password"></div>');
  57. }else if($(method).val() == "802.1x"){
  58. $( "#info" ).html('<div class="sixteen wide field"><input id="ssid" name="ssid" placeholder="SSID" type="text"></div><div class="sixteen wide field"><input id="identity" name="identity" placeholder="Username" type="text"></div><div class="sixteen wide field"><input ut id="psk" name="psk" placeholder="Password" type="password"></div>');
  59. }else if($(method).val() == "no"){
  60. $( "#info" ).html('<div class="sixteen wide field"><input id="ssid" name="ssid" placeholder="SSID" type="text"></div>');
  61. }
  62. }
  63. function msg(content) {
  64. ts('.snackbar').snackbar({
  65. content: content,
  66. actionEmphasis: 'negative',
  67. });
  68. }
  69. function submit(){
  70. $.post( "opr.php?opr=addwifi", $( "#form" ).serialize()).done(function() {
  71. msg("WPA Updated. Restarting wireless interface services.");
  72. $.ajax({url:"opr.php?opr=restart",async:false});
  73. msg('Added Wi-Fi Network.');
  74. scannetwork();
  75. })
  76. .fail(function() {
  77. msg( "Failed" );
  78. });
  79. }
  80. </script>
  81. </body>
  82. </html>