Внедрение шаблонизатора.
This commit is contained in:
parent
cf8f795550
commit
32ce7ad7e4
39
chat.php
39
chat.php
@ -11,13 +11,13 @@ if (empty($_SESSION['uid'])) {
|
||||
exit;
|
||||
}
|
||||
require_once "config.php";
|
||||
//include_once "functions.php";
|
||||
|
||||
$msg = $_POST['msg'] ?? null;
|
||||
$uid = $_SESSION['uid'];
|
||||
$uid = $_SESSION['uid'] ?? null;
|
||||
if ($msg) {
|
||||
try { db::c()->query('INSERT INTO `chat` (`user_id`, `msg`) VALUES (?i, "?s")', $uid, $msg); }
|
||||
catch (\Krugozor\Database\Mysql\Exception $e) {
|
||||
try {
|
||||
db::c()->query('INSERT INTO `chat` (`user_id`, `msg`) VALUES (?i, "?s")', $uid, $msg);
|
||||
} catch (\Krugozor\Database\Mysql\Exception $e) {
|
||||
echo "<div style='background-color: #ffaaaa;'>Ошибка: " . $e->getMessage() . "<br> В файле: " . $e->getFile() . " (" . $e->getLine() . ")</div>";
|
||||
}
|
||||
}
|
||||
@ -50,19 +50,29 @@ function show_messages()
|
||||
|
||||
|
||||
show_messages();
|
||||
Template::header('chat');
|
||||
?>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<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; }
|
||||
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;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<?php ?>
|
||||
</div>
|
||||
@ -70,4 +80,3 @@ show_messages();
|
||||
<input id="msg" name="msg" size="100" placeholder="Введите сообщение...">
|
||||
<input type="submit" value="Отправить">
|
||||
</form>
|
||||
</body>
|
Loading…
Reference in New Issue
Block a user