@@ -1,12 +1,12 @@ | |||||
<?php | <?php | ||||
require_once './modules/common.mod.php'; | |||||
require_once './modules/chat.mod.php'; | |||||
$db = new Chat; | |||||
$chat = new Chat; | |||||
$user_id = $_POST['id']; | $user_id = $_POST['id']; | ||||
$chat_message = $_POST['text']; | $chat_message = $_POST['text']; | ||||
$db -> send_chat ($user_id, $chat_message); | |||||
$chat -> send ($user_id, $chat_message); | |||||
@@ -3,10 +3,11 @@ | |||||
class | class | ||||
Chat | Chat | ||||
{ | { | ||||
var $db; | |||||
private $db; | |||||
function | function | ||||
__construct () | |||||
__construct (): | |||||
void | |||||
{ | { | ||||
$config = include (__DIR__ . '/config.php'); | $config = include (__DIR__ . '/config.php'); | ||||
@@ -28,7 +29,7 @@ Chat | |||||
$sql = " | $sql = " | ||||
INSERT INTO | INSERT INTO | ||||
chats ( | chats ( | ||||
id, | |||||
user_id, | |||||
text) | text) | ||||
VALUES | VALUES | ||||
( | ( | ||||