<?php
if(count(get_included_files()) ==1) exit("Direct access not permitted.");
header("Content-type: application/json");
if(isset($_POST['ikdata'])){
	if (!isset($_SESSION)) session_start();
	$db=pDatabase::getInstance();
	$datafungsi=[
		"updateprofile"=>"updateprofile"
	];
	
	//if(!$db->ceckmodule($cl)) exit;
	$data=$_POST['ikdata'];
	$ex=false;
	if(isset($datafungsi[$data[0]])) $ex=$datafungsi[$data[0]]($data);
	echo $ex;
}else{
	echo false;
}

function updateprofile($data){
	$db=pDatabase::getInstance();
	$dataprof=json_encode($data['profile']);
	$query="insert into tb_setting (id,setting) values (3,?) on duplicate key update setting=?";
	$rs=$db->query($query,array($dataprof,$dataprof));
	return $rs;
}
?>