Installer/Updater
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.6 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../../scripts/sys_utils.php');
  3. require_once('../../scripts/distro_web_utils.php');
  4. if( isset( $_GET['OP'] ) ){
  5. $OP = intval( $_GET['OP'] );
  6. switch( $OP ){
  7. case 1:{
  8. // Creating New Profile
  9. if( !isset( $_POST['cp_name'] ) ){
  10. header('location: nm_error.php?eid=1');
  11. exit();
  12. } else {
  13. $add_params = array();
  14. if( isset($_POST['cp_aa']) && $_POST['cp_aa'] == 'yes' ) $add_params['connection.autoconnect'] = 'yes';
  15. if( strlen( $_POST['gsm_num'] ) ) $add_params['gsm.number'] = $_POST['gsm_num'];
  16. if( strlen( $_POST['gsm_user'] ) ) $add_params['gsm.username'] = $_POST['gsm_user'];
  17. if( strlen( $_POST['gsm_pass'] ) ) $add_params['gsm.password'] = $_POST['gsm_pass'];
  18. if( strlen( $_POST['gsm_apn'] ) ) $add_params['gsm.apn'] = $_POST['gsm_apn'];
  19. if( !create_NetworkManager_Profile( $_POST['cp_type'], $_POST['cp_name'], $add_params ) ){
  20. header('location: nm_error.php?eid=2');
  21. exit();
  22. };
  23. };
  24. break;
  25. };
  26. case 2:{
  27. // modify
  28. break;
  29. };
  30. case 3:{
  31. // delete
  32. if( isset( $_GET['pid'] ) ){
  33. if( !delete_NetworkManager_Profile( $_GET['pid'] ) ){
  34. header('location: nm_error.php?eid=3');
  35. exit();
  36. };
  37. } else {
  38. header('location: nm_error.php?eid=4');
  39. exit();
  40. };
  41. break;
  42. };
  43. case 4:{
  44. // connect
  45. if( isset( $_GET['dev'] ) ){
  46. if( !connect_NetworkManager_Device( $_GET['dev'] ) ){
  47. header('location: nm_error.php?eid=5');
  48. exit();
  49. };
  50. } else {
  51. header('location: nm_error.php?eid=6');
  52. exit();
  53. };
  54. break;
  55. };
  56. case 5:{
  57. // disconnect
  58. if( isset( $_GET['dev'] ) ){
  59. if( !disconnect_NetworkManager_Device( $_GET['dev'] ) ){
  60. header('location: nm_error.php?eid=7');
  61. exit();
  62. };
  63. } else {
  64. header('location: nm_error.php?eid=6');
  65. exit();
  66. };
  67. break;
  68. };
  69. case 6:{
  70. // set Active
  71. if( isset( $_GET['pid'] ) ){
  72. if( !activate_NetworkManager_Profile( $_GET['pid'] ) ){
  73. header('location: nm_error.php?eid=8');
  74. exit();
  75. };
  76. } else {
  77. header('location: nm_error.php?eid=9');
  78. exit();
  79. };
  80. break;
  81. };
  82. case 7:{
  83. // unset Active
  84. if( isset( $_GET['pid'] ) ){
  85. if( !deactivate_NetworkManager_Profile( $_GET['pid'] ) ){
  86. header('location: nm_error.php?eid=10');
  87. exit();
  88. };
  89. } else {
  90. header('location: nm_error.php?eid=9');
  91. exit();
  92. };
  93. break;
  94. };
  95. };
  96. header('location: /wan_cp.php');
  97. } else {
  98. print_PAGE_HEADER();
  99. echo "WRONG USE";
  100. print_PAGE_BOTTOM();
  101. };
  102. ?>