<?php

$accessControl = array("Admin" => true);
require_once '../../AccessControl.php';

if (isset($_POST["authtype"])) {
	setGlobalSetting("UserAuthenticationType", $_POST["authtype"]);
	setGlobalSetting("UserAuthenticationType_Var", $_POST["authtypevar"]);
	$mes = _AUTH_METH_SET_TO . " ".$_POST["authtype"];
} else {
	$mes = "";
}

$adminQ = "SELECT username FROM ".TBL_USERS." WHERE isAdmin = 1 LIMIT 1;";
$result = $db->Execute($adminQ);
$admins = $result->fetchRow();	

$db_authtype = getGlobalSetting("UserAuthenticationType", USER_AUTHENTICATION_NONE);

echo json_encode(array(
	"Status" => "Success",
	"Message" => $mes
	,"Admins" => $admins
	,"Authtype" => $db_authtype
	,"UserAuthVar" => $userAuthenticationOther_Var
));
?>