<?php
ob_start();
if(!(is_readable(realpath(dirname(__FILE__).'/../').'/include/includesroutines.inc'))) {
	die('Error - Could not open or read file '.realpath(dirname(__FILE__).'/../').'/include/includesroutines.inc');
} else {
	include_once(realpath(dirname(__FILE__).'/../').'/include/includesroutines.inc');
}

if(!(is_readable(realpath(dirname(__FILE__).'/../').'/include/bsservice.inc'))) {
	die('Error - Could not open or read file '.realpath(dirname(__FILE__).'/../').'/include/bsservice.inc');
} else {
	include_once(realpath(dirname(__FILE__).'/../').'/include/bsservice.inc');
}
$token = $_REQUEST['token'];
$sstoken = $_SESSION['adminconsoletoken'];
if (getSetting('portal','useRights',0) == 1 && IsUserLogin() == 1 && $token !== NULL && strcmp($token, $sstoken) == 0){
	$cn = db_connect();
	$aticket = getAuthTicket();
	session_write_close();
	$call = sendServiceConsoleDataCall($cn, $aticket);
	db_disconnect($cn);
	if ( strlen(trim($call)) > 0 ) {
		echo $call;
	}
}
ob_end_flush();
?>