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.
 
 
 
 

102 lines
2.6 KiB

<?php
require_once('../../scripts/sys_utils.php');
require_once('../../scripts/distro_web_utils.php');
if( isset( $_GET['OP'] ) ){
$OP = intval( $_GET['OP'] );
switch( $OP ){
case 1:{
// Creating New Profile
if( !isset( $_POST['cp_name'] ) ){
header('location: nm_error.php?eid=1');
exit();
} else {
$add_params = array();
if( isset($_POST['cp_aa']) && $_POST['cp_aa'] == 'yes' ) $add_params['connection.autoconnect'] = 'yes';
if( strlen( $_POST['gsm_num'] ) ) $add_params['gsm.number'] = $_POST['gsm_num'];
if( strlen( $_POST['gsm_user'] ) ) $add_params['gsm.username'] = $_POST['gsm_user'];
if( strlen( $_POST['gsm_pass'] ) ) $add_params['gsm.password'] = $_POST['gsm_pass'];
if( strlen( $_POST['gsm_apn'] ) ) $add_params['gsm.apn'] = $_POST['gsm_apn'];
if( !create_NetworkManager_Profile( $_POST['cp_type'], $_POST['cp_name'], $add_params ) ){
header('location: nm_error.php?eid=2');
exit();
};
};
break;
};
case 2:{
// modify
break;
};
case 3:{
// delete
if( isset( $_GET['pid'] ) ){
if( !delete_NetworkManager_Profile( $_GET['pid'] ) ){
header('location: nm_error.php?eid=3');
exit();
};
} else {
header('location: nm_error.php?eid=4');
exit();
};
break;
};
case 4:{
// connect
if( isset( $_GET['dev'] ) ){
if( !connect_NetworkManager_Device( $_GET['dev'] ) ){
header('location: nm_error.php?eid=5');
exit();
};
} else {
header('location: nm_error.php?eid=6');
exit();
};
break;
};
case 5:{
// disconnect
if( isset( $_GET['dev'] ) ){
if( !disconnect_NetworkManager_Device( $_GET['dev'] ) ){
header('location: nm_error.php?eid=7');
exit();
};
} else {
header('location: nm_error.php?eid=6');
exit();
};
break;
};
case 6:{
// set Active
if( isset( $_GET['pid'] ) ){
if( !activate_NetworkManager_Profile( $_GET['pid'] ) ){
header('location: nm_error.php?eid=8');
exit();
};
} else {
header('location: nm_error.php?eid=9');
exit();
};
break;
};
case 7:{
// unset Active
if( isset( $_GET['pid'] ) ){
if( !deactivate_NetworkManager_Profile( $_GET['pid'] ) ){
header('location: nm_error.php?eid=10');
exit();
};
} else {
header('location: nm_error.php?eid=9');
exit();
};
break;
};
};
header('location: /wan_cp.php');
} else {
print_PAGE_HEADER();
echo "WRONG USE";
print_PAGE_BOTTOM();
};
?>