54 lines
1.6 KiB
PHP
54 lines
1.6 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>
|
|
</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" value="Delete"></form></li>
|
|
</ul>
|
|
</div>
|
|
<section>
|
|
<ul>
|
|
<li><?php echo $title; ?></li>
|
|
<li><?php echo $content; ?></li>
|
|
</ul>
|
|
<ul>
|
|
<li>最後修改:<?php echo $updated_at; ?></li>
|
|
<li>建立時間:<?php echo $created_at; ?></li>
|
|
</ul>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|