71 lines
1.9 KiB
PHP
71 lines
1.9 KiB
PHP
<?php
|
|
$id = $_GET["id"];
|
|
|
|
require_once 'config.php';
|
|
require_once FOLDER_ROOT.'/lib/Database/DbMessage.php';
|
|
use MessageBoard\Database\DbMessage;
|
|
|
|
|
|
$db = new DbMessage();
|
|
if(!$item = $db->getDataByid($id)) {
|
|
header('Location: index.php');
|
|
}
|
|
$title = $item['title'];
|
|
$content = $item['content'];
|
|
$updated_at = $item['updated_at'];
|
|
$created_at = $item['created_at'];
|
|
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="stylesheet" href="css/general.css">
|
|
<title>Document</title>
|
|
<style>
|
|
article {
|
|
margin: 0 1.5em;
|
|
border: 2px brown dotted;
|
|
padding: 1em;
|
|
background: #fff7dc;
|
|
}
|
|
|
|
section ul.info {
|
|
margin-top: 3rem;
|
|
}
|
|
|
|
section ul.info li{
|
|
display: inline;
|
|
padding-right:3em;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="container">
|
|
<header>
|
|
<h1>留言板 - <?php echo $id; ?></h1>
|
|
</header>
|
|
<div id="main">
|
|
<div class="func-btn">
|
|
<ul>
|
|
<li><a href="index.php" class="btn">Index</a></li>
|
|
<li><a href="edit.php?id=<?php echo $id; ?>" class="btn">Edit</a></li>
|
|
<li><form action="save.php" method="post"><input type="hidden" name="id" value="<?php echo $id; ?>"><input type="hidden" name="delete" value="true"><input type="submit" class="btn red" value="Delete"></form></li>
|
|
</ul>
|
|
</div>
|
|
<section>
|
|
<h2><?php echo $title; ?></h2>
|
|
<article>
|
|
<?php echo $content; ?>
|
|
</article>
|
|
<ul class="info">
|
|
<li>最後修改:<?php echo $updated_at; ?></li>
|
|
<li>建立時間:<?php echo $created_at; ?></li>
|
|
</ul>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|