<?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 ### */

	$mChatMessage = $p["chatMessage"];
	$mReceiverUser = $p["receiverUser"];
	$mSenderUser = $systemHandler->loadHandler("USER")->mUserId;
	
	$systemExecution->runQuery("INSERT INTO web_messages (user_one, user_two, submit_date, message) VALUES ('%s', '%s', '%s', '%s')", array($mSenderUser, $mReceiverUser, time(), $mChatMessage));
	
	/* ### DO NOT CHANGE ANYTHING FROM HERE ### */
	header("Content-Type: application/json");
	echo json_encode($mPong);
?>