receiving POST method data in php and do some math

I am working on a chat application that using chat timer.

My problem is when each time i send data(time Stamp and total time) from JavaScript file using Post Method and json.
But i am not able to manipulate those data in php.

Please help me.

My java script function is:

function livechatLoopRequest(){
alert(‘pauseTimer’+pauseTimer);
var stamp = new Date().getTime();
currentRequestTimestamp.push({stamp: stamp});
$.post(livechat_url+‘chechstatus.php’, {sid: livechat_conf.sid,
type: livechat_conf.type,
uid: livechat_conf.uid,
stamp: stamp,
session_status: livechat_conf.session_status,
session_minutes: livechat_conf.session_minutes,
user_minutes: livechat_conf.user_minutes,
token: livechat_conf.token,
isTyping: $("#isTyping").val(),
msgindex: livechat_conf.msgindex,
liveActivity: userActivity,
pauseTimer: pauseTimer,
totalPauseTime: totalPauseTime
}, livechatReceiveResponse, ‘json’);
}

and in php file:
I want to subtract $totalPauseTime from $usedmin.

$totalPauseTime= $_POST[‘totalPauseTime’];
$usedmin = time() - $session[‘start_timestamp’] - $session[‘pause_time’] - totalPauseTime ;

Sponsor our Newsletter | Privacy Policy | Terms of Service