execute(" SELECT typing FROM arrowchat_status WHERE userid = '" . $db->escape_string($typing) . "' "); if ($result AND $db->count_select() > 0 AND logged_in($userid)) { $row = $db->fetch_array($result); $old_data = $row['typing']; if (empty($untype)) { if (!empty($old_data)) { if (preg_match("#:$userid/[0-9]+#", $old_data, $matches)) { $typing_insert = str_replace($matches[0], ":".$userid."/".time()."", $old_data); } else { $typing_insert = $old_data.":".$userid."/".time(); } } else { $typing_insert = ":".$userid."/".time(); } if ($push_on == 1) { $arrowpush->publish(array( 'channel' => 'u' . $typing, 'message' => array('typing' => array("id" => $userid)) )); } $_SESSION['typing_to'][] = $typing; } else { if (preg_match("#:$userid/[0-9]+#", $old_data, $matches)) { $typing_insert = str_replace($matches[0], ":".$userid."/0", $old_data); } else { $typing_insert = ":".$userid."/0"; } if ($push_on == 1) { $arrowpush->publish(array( 'channel' => 'u' . $typing, 'message' => array('nottyping' => array("id" => $userid)) )); } if (($key = array_search($typing, $_SESSION['typing_to'])) !== false) { unset($_SESSION['typing_to'][$key]); } } $db->execute(" UPDATE arrowchat_status SET typing = '" . $db->escape_string($typing_insert) . "' WHERE userid = '" . $db->escape_string($typing) . "' "); } echo "1"; close_session(); exit(0); } ?>