$value) { $result = $db->execute(" SELECT typing FROM arrowchat_status WHERE userid = '" . $db->escape_string($value) . "' "); if ($result AND $db->count_select() > 0 AND logged_in($userid)) { $row = $db->fetch_array($result); $old_data = $row['typing']; if (preg_match("#:$userid/[0-9]+#", $old_data, $matches)) { $typing_insert = str_replace($matches[0], ":".$userid."/0", $old_data); } else { $typing_insert = ":".$userid."/0"; } $db->execute(" UPDATE arrowchat_status SET typing = '" . $db->escape_string($typing_insert) . "' WHERE userid = '" . $db->escape_string($value) . "' "); if ($push_on == 1) { $arrowpush->publish(array( 'channel' => 'u' . $value, 'message' => array('nottyping' => array("id" => $userid)) )); } } } unset($_SESSION['typing_to']); } } header('Content-type: application/json; charset=utf-8'); echo 1; close_session(); exit; ?>