select("operatorchat", ["[>]user" => ["fromid" => "id"]], ["operatorchat.id", "operatorchat.fromid", "operatorchat.message", "operatorchat.system_message", "operatorchat.sent", "user.username"], ["AND" => ["operatorchat.opid" => $opcacheid, "msgpublic" => 1, "sent[>]" => $sent_time], "ORDER" => ["sent" => "ASC"]]); if (isset($result) && !empty($result)) { $chatmsg = ''; } die($chatmsg); } break; case 'send-msg': if (empty($_POST['message'])) { echo $jkl['e1']; } else { $message = trim($_POST['message']); $message = filter_var($message, FILTER_SANITIZE_FULL_SPECIAL_CHARS); $jakdb->insert("operatorchat", ["opid" => $opcacheid, "fromid" => $_POST['uid'], "toid" => 0, "message" => $message, "sent" => time(), "received" => 1, "msgpublic" => 1]); $lastid = $jakdb->id(); if ($lastid) { echo 'success'; } else { echo $jkl['e1']; } } break; default: return false; }