<?php

	if (Session::get("tipo_usuario") != "6"){ show_403();} 
	if ($_SERVER["REQUEST_METHOD"] == "GET"){
		import_file(DIR_MODELS."Model.class.php");

		$id_solicitacao_saldo = encrypt_decode(filter_input(INPUT_GET, "saldo", FILTER_SANITIZE_STRING));
		$transacao = filter_input(INPUT_GET, "transacao", FILTER_SANITIZE_STRING);

		$model = new Model();

		$result = $model->update("solicitacao_saldo", [
			"codigo_transacao" => $transacao
		], [
			"id_solicitacao_saldo" => $id_solicitacao_saldo
		]);

		if ($result > 0) {
			echo "<script>window.location.href='".show_link("/dashboard/?status=true")."'</script>";
			$model->commit();
		}
		else{
			echo "<script>window.location.href='".show_link("/dashboard/?status=false")."'</script>";
			$model->rollback();
		}
	}
	else{
		show_403();
	}

?>