-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmd.php
64 lines (57 loc) · 1.71 KB
/
md.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
//error_reporting(E_ALL);
//ini_set('display_errors','On');
include_once "./markdown.php";
//***SETTINGS***
$pagetitle = 'チラシの裏';
$dbfile = './data/chirashi.db';
$dsn = 'sqlite:'.$dbfile;
//**OPEN DATABASE**
try {
$dbh = new PDO($dsn);
$dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
} catch (PDOException $e) {
die("PDO error 001: ".$e->getMessage());
}
//**MAIN**
if(!empty($_REQUEST['textid'])) {
$textid = $_REQUEST['textid'];
$res = $dbh->query('SELECT * FROM memo WHERE id = '.$textid);
$item = $res->fetch();
$textname = $item['name'];
$mdtext = $item['content'];
$status = $item['status'];
$registdate = $item['registdate'];
$lastupdate = $item['lastupdate'];
$pagetitle = $item['name'].' - '.$pagetitle;
} else {
header('Location: ./');
exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<link rel="stylesheet" type="text/css" href="./md.css">
<title><?php echo $pagetitle; ?></title>
</head>
<body>
<div data-role="page">
<div class="title" data-role="header">
<?php echo $textname ?>
</div><!-- /header -->
<div data-role="content" style="border: outset; text-align: left; margin: 0 100px;">
<?php
echo Markdown($mdtext);
?>
</div><!-- /content -->
<div class="footer" data-role="footer">
php-chirashi (C) ozzozz
</div><!-- /footer -->
</div><!-- /page -->
</body>
</html>