-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
94 lines (84 loc) · 3.24 KB
/
index.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
session_start();
require_once('./myid.php');
$strcode = array(PDO::MYSQL_ATTR_INIT_COMMAND=>"SET CHARACTER SET 'utf8mb4'");
try {
$dbh = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME, DB_ID, DB_PASS, $strcode);
$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
} catch (PDOException $e) {
echo $e->getMessage();
exit;
}
$query = "SELECT * FROM archiveList";
$stmt = $dbh->prepare($query);
$stmt->execute();
$posts = $stmt->fetchAll();
?>
<!doctype html>
<html>
<head>
<title><?php echo BLOG_NAME; ?></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/style2.css">
<link rel="stylesheet" type="text/css" href="css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="js/materialize.min.js"></script>
</head>
<header>
<div class="navbar-fixed">
<nav class="blue">
<div class="nav-wrapper">
<!-- <a href="./index.php" class="brand-logo"><img src="img/portallogo.png" class="logo-img"></a> -->
<?php echo BLOG_NAME; ?>
<a href="#" data-target="sideNavMobile" class="sidenav-trigger"><i class="material-icons">menu</i></a>
<ul class="right hide-on-med-and-down" style="padding: 0 1vw 0 0;">
<li><a href="index.php">Home</a></li>
</ul>
</div>
</nav>
</div>
<ul class="sidenav" id="sideNavMobile">
<li><a href="index.php" class="waves-effect"><i class="material-icons">home</i>ホーム</a></li>
</ul>
</header>
<body>
<div class="titleBack">
<div class="whiteColor">
<div class="topContent">
<div class="headObject">
<span class="subContent" style="vertical-align:middle;">記事一覧</span>
</div>
</div>
</div>
</div>
<div class="container">
<div class="objectMargin">
<?php
if(count($posts) != 0){
$counter = 0;
foreach($posts as $data){
if(empty($data['ID'])){
break;
}
if($counter == 0){
echo '<ul class="collapsible">';
}
echo '<li><a href="read.php?id=' . $data['ID'] . '"><div class="collapsible-header">';
echo htmlspecialchars($data['Name'], ENT_QUOTES, 'UTF-8');
echo '</div></a></li>';
$counter++;
}
echo '</ul>';
}else{
echo '<div class="row"><div class="col s12 m12 pink lighten-5"><h5 class="valign-wrapper"><i style="font-size: 2.5rem;" class="material-icons orange-text text-darken-5">warning</i><span style="color:#000;font-size:1.2rem;">';
echo '  このサイトには、まだ記事が投稿されていません。</span></h5></div></div>';
}
?>
</div>
</div>
</body>
<footer>
</footer>