2018-03-01 23:21:53 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Copyright (c) 2018.
|
|
|
|
* Author: Igor Barkov <lopar.4ever@gmail.com>
|
|
|
|
* Project name: Battles-Game
|
|
|
|
*/
|
|
|
|
|
2021-08-25 15:24:12 +00:00
|
|
|
use Battles\Chat;
|
2022-01-26 23:15:33 +00:00
|
|
|
use Battles\Database\Db;
|
2021-02-01 01:39:50 +00:00
|
|
|
use Battles\Template;
|
|
|
|
|
2020-06-23 12:22:32 +00:00
|
|
|
require_once "config.php";
|
2022-01-26 23:15:33 +00:00
|
|
|
$chat = new Chat(Db::getInstance());
|
2021-08-25 15:24:12 +00:00
|
|
|
if (!empty($_POST['msg'])) {
|
2022-06-10 21:36:30 +00:00
|
|
|
$chat->sendMessage($_POST['msg']);
|
2018-03-01 23:21:53 +00:00
|
|
|
}
|
2020-06-23 12:22:32 +00:00
|
|
|
|
2021-02-01 01:39:50 +00:00
|
|
|
Template::header('chat');
|
2021-08-25 15:24:12 +00:00
|
|
|
echo $chat->getMessages();
|
2018-03-01 23:21:53 +00:00
|
|
|
?>
|
2020-09-30 14:15:13 +00:00
|
|
|
<style>
|
|
|
|
form {
|
|
|
|
padding: 3px;
|
|
|
|
position: fixed;
|
|
|
|
bottom: 0;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
form input {
|
|
|
|
border: 0;
|
|
|
|
padding: 10px;
|
|
|
|
width: 80%;
|
|
|
|
margin-right: .5%;
|
|
|
|
}
|
|
|
|
|
|
|
|
form input[type="submit"] {
|
|
|
|
width: 15%;
|
|
|
|
border: none;
|
|
|
|
padding: 10px;
|
|
|
|
}
|
2021-08-25 15:24:12 +00:00
|
|
|
|
|
|
|
span.chatsys {
|
|
|
|
color:maroon;
|
|
|
|
background:#faa;
|
|
|
|
}
|
|
|
|
span.chatsms {
|
|
|
|
color:darkgreen;
|
|
|
|
background:#afa;
|
|
|
|
}
|
|
|
|
span.chatprivate {
|
|
|
|
background:#efe;
|
|
|
|
}
|
2020-09-30 14:15:13 +00:00
|
|
|
</style>
|
2020-06-23 13:39:22 +00:00
|
|
|
<div>
|
2020-09-30 14:15:13 +00:00
|
|
|
<?php ?>
|
2020-06-23 13:39:22 +00:00
|
|
|
</div>
|
|
|
|
<form action="chat.php" method="post">
|
|
|
|
<input id="msg" name="msg" size="100" placeholder="Введите сообщение...">
|
|
|
|
<input type="submit" value="Отправить">
|
2020-09-30 14:15:13 +00:00
|
|
|
</form>
|