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.
 
 
 
 

41 lines
1.1 KiB

<?php
require_once('../../scripts/sys_utils.php');
//require_once('../../scripts/distro_web_utils.php');
$COP = -1;
if( isset( $_GET['OP'] ) ){
$COP = intval( $_GET['OP'] );
} else if( isset( $_POST['OP'] ) ){
$COP = intval( $_POST['OP'] );
};
if( $COP > -1 ){
switch( $COP ){
case 1:{
//Add user
if( !isset( $SYS_CONFIG['NGINX_AUTH_ACCESS_LIST'] ) ) $SYS_CONFIG['NGINX_AUTH_ACCESS_LIST'] = array();
foreach( $SYS_CONFIG['NGINX_AUTH_ACCESS_LIST'] as $U ) if( $U['USERNAME'] == $_POST['uname'] ){
header( 'location: /add_auth.php' );
exit();
};
$NU = array();
$NU['USERNAME'] = $_POST['uname'];
$NU['PASSWORD'] = $_POST['upass'];
$SYS_CONFIG['NGINX_AUTH_ACCESS_LIST'][] = $NU;
save_system_config();
if( $SYS_CONFIG['NGINX_AUTH_IS_SET'] ){
header( 'location: /task_wait.php?TID=8' );
exit();
};
break;
};
case 2:{
//remove user
$UID =$_GET['UID'];
//echo "UID: " . $UID. "\n";
unset( $SYS_CONFIG['NGINX_AUTH_ACCESS_LIST'][$UID] );
save_system_config();
break;
};
};
};
header( 'location: /add_auth.php' );
?>