<?php
	require_once("../system.engine/system.core.php");
	
	$mPong = array();
	$a = &$mPong;
	$p = &$_POST;
	
	global $systemHandler;
	$systemExecution = $systemHandler->loadHandler("EXECUTION");
	$systemHash = $systemHandler->loadHandler("HASH");
	/* ### DO YOUR CODES ONLY FROM HERE ### */

	$mUserId = $systemHandler->loadHandler("USER")->mUserId;
	
	$a["friendCount"] = $systemExecution->runQuery("SELECT COUNT(id) AS friendCount FROM web_friendrequests WHERE receiver_id = '%s'", $mUserId)->fetch_object()->friendCount;
	$a["messageCount"] = $systemExecution->runQuery("SELECT COUNT(id) AS messageCount FROM web_messages WHERE user_two = '%s' AND message_seen_user = '0'", array($mUserId, $mUserId))->fetch_object()->messageCount;
	$a["globalCount"] = $systemExecution->runQuery("SELECT COUNT(id) AS globalCount FROM web_notifications WHERE user_id = '%s' AND has_seen = '0'", $mUserId)->fetch_object()->globalCount;
	
	/* ### DO NOT CHANGE ANYTHING FROM HERE ### */
	header("Content-Type: application/json");
	echo json_encode($mPong);
?>