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;
|
2021-02-01 01:39:50 +00:00
|
|
|
use Battles\Database\DBPDO;
|
|
|
|
use Battles\Template;
|
|
|
|
|
2020-06-23 12:22:32 +00:00
|
|
|
require_once "config.php";
|
2021-08-25 15:24:12 +00:00
|
|
|
$chat = new Chat(new DBPDO());
|
|
|
|
if (!empty($_POST['msg'])) {
|
|
|
|
$chat->addMessage($_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>
|