function action_deletemsg() { if (!isset($_COOKIE['username'])) { header("Location: /"); die; } $this->model = new ModelMessage($_POST['msgid'], $_COOKIE['username'], null, 1, null, null); $res = $this->model->deleteMessage(); if ($res) { echo 'success'; $arr = array('action' => 'deletemsg', 'user' => $_COOKIE['username'], 'msgid' => $_POST['msgid']); $message = json_encode($arr); $sock = new SocketClient(); $sock->connect('localhost', 8000, '/'); $sock->sendData($message); $sock->disconnect(); } }
<?php require_once 'SocketClient.php'; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ $sock = new SocketClient(); $sock->connect('localhost', 8000, '/'); $sock->sendData('test'); $sock->disconnect();