function sendchatmsg($data) { $need = array('msg'); $ec = 1; $odata = 0; if (!Fun::isAllSet($need, $data)) { $ec = -9; } else { if ($data["msg"] != "") { if (!($_SESSION["chatthid"] > 0)) { $_SESSION["chatthid"] = Sqle::insertVal("chattingthread", array("ip" => $_SERVER['REMOTE_ADDR'], "time" => time(), "uid" => User::loginId(), "isclosed" => "f")); } $odata = array("msgid" => Help::sendchatmsg($data["msg"], $_SESSION["chatthid"])); } } return array('ec' => $ec, 'data' => $odata); }