<?php
if(count(get_included_files()) ==1) exit("Direct access not permitted.");
if(isset($_POST['ikdata'])){
if (!isset($_SESSION)) session_start();
$db=pDatabase::getInstance();
$datafungsi=[
	"simpanpengaturan"=>"simpanpengaturan",
];

if(!$db->ceckmodule($cl)) exit;
	$data=$_POST['ikdata'];
	$ex=false;
	if(isset($datafungsi[$data[0]])) $ex=$datafungsi[$data[0]]($data,$cl);
	echo $ex;
}else{
	echo false;
}
function simpanpengaturan($data){
	$db=pDatabase::getInstance();
	$dataset=array(
		"email"=>$data['email'],
		"host"=>$data['host'],
		"port"=>$data['port'],
		"password"=>$data['password']
	);
	
	$textdata=json_encode($dataset,true);
	error_log($textdata);
	$datain=[
		"setting"=>$textdata,
		"id"=>11
	];
	
	$dataup=[
		"setting"=>$textdata,
	];
	$rs=$db->insertupdate("tb_setting",$datain,$dataup);
	return $rs;
}


?>